The LeaderWorkerSet Operator provides the ability to deploy a LWS in OpenShift.
-
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}
-
Update the image spec under
.spec.template.spec.containers[0].image
field in thedeploy/05_deployment.yaml
Deployment to point to the newly built image -
Apply the manifests from
deploy
directory:oc apply -f deploy/
This process refers to building the operator in a way that it can be installed locally via the OperatorHub with a custom index image
-
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}
-
Update the
.spec.install.spec.deployments[0].spec.template.spec.containers[0].image
field in the LWS CSV undermanifests/lws-operator.clusterserviceversion.yaml
to point to the newly built image. -
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}
-
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. -
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>>
-
Create
openshift-lws-operator
namespace:$ oc create ns openshift-lws-operator
-
Open the console Operators -> OperatorHub, search for
Leader Worker Set
and install the operator -
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
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