Local Development
Build images
Build CNI operator
-
Set
IMAGE_REGISTRY
andVERSION
environment to target image repository for operatorexport IMAGE_REGISTRY=<registry> export VERSION=<version>
-
For private image registry, follow these additional steps to add image-pulling secret
-
Put your secret for pulling operator image (
operator-secret.yaml
) to the secret foldermv operator-secret.yaml config/secret
-
Run script to update relevant kustomization files
export OPERATOR_SECRET_NAME=$(cat config/secret/operator-secret.yaml|yq .metadata.name) make operator-secret
-
-
Build and push operator image
go mod tidy make docker-build docker-push
-
Build and push bundle image (optional)
make bundle make bundle-build bundle-push
To test the bundle, run
operator-sdk run bundle ${IMAGE_REGISTRY}/multi-nic-cni-bundle:v${VERSION}
-
Build and use catalog source image (optional)
make catalog-build catalog-push
To test deploy with customized catalog, deploy the catalogsource resource.
apiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: name: multi-nic-cni-operator namespace: openshift-marketplace spec: displayName: Multi-NIC CNI Operator publisher: IBM sourceType: grpc image: # <YOUR_CATALOG_IMAGE> updateStrategy: registryPoll: interval: 10m
Then, you can deploy via console or subscription resource.
Build CNI daemon
-
Set
IMAGE_REGISTRY
andVERSION
environment to target image repository for daemonexport IMAGE_REGISTRY=<registry> export VERSION=<version>
-
For private image registry, follow these additional steps to add image-pulling secret
-
Put your secret for pulling daemon image (
daemon-secret.yaml
) to the secret foldermv daemon-secret.yaml config/secret
-
Run script to update relevant kustomization files
export DAEMON_SECRET_NAME=$(cat config/secret/daemon-secret.yaml|yq .metadata.name) make daemon-secret
-
-
Build and push daemon image
# build environment: # Linux systems with netlink library cd daemon go mod tidy make docker-build-push
This will also build the cni binary and copy the built binary to daemon component.
Test
# test golang linter (available after v1.0.4)
make golint
# test controller
make test
# test daemon (available after v1.0.3)
make test-daemon
Install operator
make deploy
Uninstall operator
make undeploy
Documentation update
We build the document website using GitHub Page site which is based on mkdocs.
The material for building the website is under the folder documentation
.
To test the updated document locally, please install mkdocs
in your local environment and test with mkdocs serve
under the folder documentation
.
Please do not include any changes outside documentation
folder and push the PR towards doc
branch instead of main
branch.