singapore
kcp integration service
Running the demo locally
See README.md
Building and deploying to a hub cluster
The following steps were vetted on macOS Big Sur.
- Export a registry where you have write access to push
export IMAGE_REGISTRY=quay.io/your_quay_username
- Install imagebuilder if not found on your machine
which imagebuilder
go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.1
- Log in to your image registry
docker login quay.io -u your_quay_username -p your_quay_password
- Build the image
make image-kcp-ocm-integration-controller
- Push the image. Note your registry will need to be public or you will need to set up a pull secret for it on your hub cluster.
docker push $IMAGE_REGISTRY/kcp-ocm-integration-controller
- Kustomize the deployment.yaml file to use your image
cd deploy/base
kustomize edit set image quay.io/skeeey/kcp-ocm-integration-controller:kcp-release-0.4=$IMAGE_REGISTRY/kcp-ocm-integration-controller:latest
cd ../..
- Export environment variables for your hub and kcp kubeconfigs
export HUB_KUBECONFIG=~/.kube/config
export KCP_KUBECONFIG=/path/to/your/kcp.kubeconfig
- Run
make deploy
to create the deployment on your hub cluster
make deploy
- Test the integration by annotating a ManagedClusterSet. If the controller is working correctly, you should then see a SyncTarget created in your KCP workspace and a syncer deployed on the managed clusters in your managed cluster set.
kubectl annotate managedclusterset your_clusterset_name "kcp-workspace=root:org_name:ws_name"
Customizing KCP Syncer
There are several environment variables that can be used in deploy/base/deployment.yaml for the kcp-ocm-integration-controller
container. To see the current environment variables in use:
oc get deployment kcp-ocm-integration-controller -n open-cluster-management -o jsonpath='{.spec.template.spec.containers[0].env[*]}'
Environment variables:
-
KCP_SYNCER_IMAGE
Specify the docker image to use for the kcp syncer. The default is "quay.io/skeeey/kcp-syncer:release-0.4"
-
KCP_SYNCER_CRONJOB_SCHEDULE
Specify the frequency, using cron schedule syntax, that the syncer deployment will perform a rolling restart. By default, this CronJob is disabled if the environment variable is not defined. This will allow the syncer to pick up the latest image when a floating tag is used. Typically only needed when using development/unstable branches. Example value, every day at 02:00 "0 2 * * *"
Removing from a hub cluster
- Remove the annotation from the managedclusterset
kubectl annotate managedclusterset your_clusterset_name kcp-workspace-
- Run
make undeploy
to remove the deployment on your hub cluster
make undeploy