Table of Contents generated with DocToc
Multcloud-Operators projects are built with following tools, use following links to get them installed in your env.
Kubernetes:
- Version 1.13+. Use following link to find an environment or setup one.
Build:
Lint:
- hadolint
- shellcheck
- yamllint
- helm client
- golangci-lint
- autopep8
- mdl
- awesome_bot
- sass-lint
- tslint
- prototool
- goimports - Run
go get -v golang.org/x/tools/cmd/goimports
to install
Test:
- Clone the repository
git clone git@github.com:open-cluster-management/multicloud-operators-subscription.git
cd multicloud-operators-subscription
- Login to your hub cluster. Then build the local image
make local
- Verify that the image was built successfully. The
ls -l build/_output/bin
command should return following values
ls -l build/_output/bin
-rwxr-xr-x 1 user group 74786048 Jun 14 13:53 appsubsummary
-rwxr-xr-x 1 user group 60232176 Jun 14 13:53 multicluster-operators-placementrule
-rwxr-xr-x 1 user group 90153648 Jun 14 13:52 multicluster-operators-subscription
-rwxr-xr-x 1 user group 52879056 Jun 14 13:52 uninstall-crd
- Edit hub subscription pod to make it invalid, this is the prerequisite to start your local image
Find the hub-sub pod
oc get pods -n open-cluster-management | grep hub-sub
multicluster-operators-hub-subscription-${random-number}
Edit hub-sub to make it invalid
oc edit pod multicluster-operators-hub-subscription-${random-number} -n open-cluster-management
Search for the image name in the edit mode. Add -invalid to the end of the image name or anything to make it no longer valid. Check the pod status to make it crash (InvalidImageName)
- As subscription deployment has many scenarios: deploy to local, deploy to managed clusters, etc. We have four ways to run the image locally.
- Start subscription manager on hub cluster
export WATCH_NAMESPACE=
export KUBECONFIG=~/.kube/kubeconfig.hub
build/_output/bin/multicluster-operators-subscription --alsologtostderr --sync-interval=60 --v=1 --debug
- Standalone subscription
export WATCH_NAMESPACE=
export KUBECONFIG=~/.kube/kubeconfig.hub
build/_output/bin/multicluster-operators-subscription --alsologtostderr --standalone --sync-interval=60 --v=1
- Start subscription manager on local managed cluster (hub cluster is managed cluster)
export WATCH_NAMESPACE=
$ export KUBECONFIG=~/.kube/kubeconfig.hub
build/_output/bin/multicluster-operators-subscription --alsologtostderr --v=1 \
--hub-cluster-configfile=/Users/youruser/.kube/kubeconfig.hub \
--sync-interval=60 \
--cluster-name=local-cluster --debug
- Start subscription manager on remote managed cluster
export WATCH_NAMESPACE=
export KUBECONFIG=~/.kube/kubeconfig.managed
build/_output/bin/multicluster-operators-subscription --alsologtostderr --v=1 \
--hub-cluster-configfile=/Users/philipwu/.kube/kubeconfig.hub \
--sync-interval=60 \
--cluster-name=managed-cluster-1 \
--cluster-namespace=managed-cluster-1
git clone git@github.com:open-cluster-management/multicloud-operators-subscription.git
cd multicloud-operators-subscription
export GITHUB_USER=<github_user>
export GITHUB_TOKEN=<github_token>
make
make build
./build/_output/bin/multicluster-operators-subscription
git clone git@github.com:open-cluster-management/multicloud-operators-subscription.git
cd multicloud-operators-subscription
export GITHUB_USER=<github_user>
export GITHUB_TOKEN=<github_token>
make
make build-images