Skip to content

openshift/lws-operator

Repository files navigation

LeaderWorkerSet Operator

The LeaderWorkerSet Operator provides the ability to deploy a LWS in OpenShift.

Deploy the Operator

Quick Development

  1. Build and push the operator image to a registry:

    export QUAY_USER=${your_quay_user_id}
    export IMAGE_TAG=${your_image_tag}
    podman build -t quay.io/${QUAY_USER}/lws-operator:${IMAGE_TAG} .
    podman login quay.io -u ${QUAY_USER}
    podman push quay.io/${QUAY_USER}/lws-operator:${IMAGE_TAG}
  2. Update the image spec under .spec.template.spec.containers[0].image field in the deploy/05_deployment.yaml Deployment to point to the newly built image

  3. Apply the manifests from deploy directory:

    oc apply -f deploy/

OperatorHub install with custom index image

This process refers to building the operator in a way that it can be installed locally via the OperatorHub with a custom index image

  1. Build and push the operator image to a registry:

    export QUAY_USER=${your_quay_user_id}
    export IMAGE_TAG=${your_image_tag}
    podman build -t quay.io/${QUAY_USER}/lws-operator:${IMAGE_TAG} .
    podman login quay.io -u ${QUAY_USER}
    podman push quay.io/${QUAY_USER}/lws-operator:${IMAGE_TAG}
  2. Update the .spec.install.spec.deployments[0].spec.template.spec.containers[0].image field in the LWS CSV under manifests/lws-operator.clusterserviceversion.yaml to point to the newly built image.

  3. Build and push the metadata image to a registry (e.g. https://quay.io):

    podman build -t quay.io/${QUAY_USER}/lws-operator-bundle:${IMAGE_TAG} -f bundle.Dockerfile .
    podman push quay.io/${QUAY_USER}/lws-operator-bundle:${IMAGE_TAG}
  4. Build and push image index for operator-registry (pull and build https://github.com/operator-framework/operator-registry/ to get the opm binary)

    opm index add --bundles quay.io/${QUAY_USER}/lws-operator-bundle:${IMAGE_TAG} --tag quay.io/${QUAY_USER}/lws-operator-index:${IMAGE_TAG}
    podman push quay.io/${QUAY_USER}/lws-operator-index:${IMAGE_TAG}

    Don't forget to increase the number of open files, .e.g. ulimit -n 100000 in case the current limit is insufficient.

  5. Create and apply catalogsource manifest (notice to change <<QUAY_USER>> and <<IMAGE_TAG>> to your own values)::

    apiVersion: operators.coreos.com/v1alpha1
    kind: CatalogSource
    metadata:
      name: lws-operator
      namespace: openshift-marketplace
    spec:
      sourceType: grpc
      image: quay.io/<<QUAY_USER>>/lws-operator-index:<<IMAGE_TAG>>
  6. Create openshift-lws-operator namespace:

    $ oc create ns openshift-lws-operator
    
  7. Open the console Operators -> OperatorHub, search for Leader Worker Set and install the operator

  8. Create CR for the LeaderWorkerSet Operator in the console:

apiVersion: operator.openshift.io/v1
kind: LeaderWorkerSetOperator
metadata:
  name: cluster
  namespace: openshift-lws-operator
spec:
  managementState: Managed
  logLevel: Normal
  operatorLogLevel: Normal

Sample CR

A sample CR definition looks like below (the operator expects cluster CR under openshift-lws-operator namespace):

apiVersion: operator.openshift.io/v1
kind: LeaderWorkerSetOperator
metadata:
  name: cluster
  namespace: openshift-lws-operator
spec:
  managementState: Managed
  logLevel: Normal
  operatorLogLevel: Normal

About

An operator to manage and operator the LWS located in https://github.com/kubernetes-sigs/lws

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5