Building environment
In order to get the full developement environment, you must stick to one of the two following procedure.
Requirements
1. Client tools
- Having a RedHat like (Fedora, CentOS, RHEL, …) operating system
- Install git with
sudo yum install git - Install helm with
sudo yum install go - Install a kubernetes client
- openshift client with
sudo yum install openshift-client - kubernetes client with
sudo yum install kubectl - Install operator-sdk and olm client
- operator-sdk client with
sudo yum install operator-sdk - olm client with
sudo yum install olm
2. Get a copy of the repository
export DEVBRANCH="devel-myfeature"
git clone https://gitlab.com/startx1/k8s/sxcollector-operator.git && \
cd sxcollector-operator && \
git checkout devel && \
git checkout -b ${DEVBRANCH}
Quick start
1. Change the code
Make a change in the code, test it and record it in git.
vim internal/controller/sxcollectorconfig_controller.go
# >>>> DO change code and record file(s)
make sx_check && \
git add . && \
git commit -m "my new feature description"
Optionnaly run locally your CRD’s
make sx_check_local
2. Build and publish artifacts
Build your operator binary, manifests and containers
make sx_build && \
make sx_build_docker && \
git add . && \
git commit -m "upgrade the sxcollector version to ${NEWVERSION}" && \
make sx_publish
3. Build and publish artifacts
Create a new release for your codechange
make sx_release NEWVERSION="0.0.9" MSG="Release version 0.0.9 with this new feature"
4. Deploy in cluster
Deploy the operator in the current cluster
make sx_deploy
Slow start
1. Check repository version
Check the tag you’re on.
git status
2. Update Go libraries
Make a update of the go libraries
make sx_update
3. Do your work
3.1. Change the code
Make a change in the code, for example in a controller.
vim internal/controller/sxcollectorconfig_controller.go
# >>>> DO change code and record file(s)
3.2. Test the code
Start testing you code
make sx_check
3.3. Record your change
Record your code change.
git add . && \
git commit -m "my new feature description"
Optionnaly run locally your CRD’s
make sx_check_local
3.4. Build code
Build your operator binary, manifests and containers
make sx_build && \
make sx_build_docker
4. Publish operator
Upgrade and record a new version 0.x.x.
make sx_release NEWVERSION="0.0.9" MSG="Release version 0.0.9 with this new feature"
5. Deploy operator
5.1. Deploy in cluster
Deploy the operator in the current cluster
make sx_deploy
5.2. Check operator status
Check the running operator in the cluster
oc project sxcollector
oc get pod
6. Publish OLM bundle and catalog
6.1. Build and publish OLM bundle
Create the bundle of the latest version and publish it to quay.io and docker.io.
make sx_olm_bundle
6.2. Build and publish OLM catalog
Add to the catalog the latest version and publish it to quay.io and docker.io.
make sx_olm_catalog
7. Create a pull request
Create a pull-request from your feature branch into the devel branch.