Kyma Companion Manager
Overview
Kyma Companion Manager is a standard Kubernetes operator that observes the state of companion resources and reconciles their state according to the desired state. It uses Controllers, which provide a reconcile function responsible for synchronizing resources until the desired state is reached in the cluster.
This project is scaffolded using Kubebuilder, and all the Kubebuilder makefile
helpers mentioned here can be used.
Get Started
You need a Kubernetes cluster to run against. You can use k3d to get a local cluster for testing, or run against a remote cluster.
[!NOTE]
Your controller automatically uses the current context in your kubeconfig file, that is, whatever cluster kubectl cluster-info
shows.
Development
Prerequisites
Run Kyma Companion Manager Locally
-
Install the CRDs into the cluster:
make install
-
Run Kyma Companion Manager. It runs in the foreground, so if you want to leave it running, switch to a new terminal.
make run
[!NOTE]
You can also run this in one step with the command: make install run
.
Run Tests
Run the unit and integration tests:
make generate-and-test
Linting
-
Fix common lint issues:
make imports
make fmt
make lint
Modify the API Definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs:
make manifests
[!NOTE]
Run make --help
for more information on all potential make
targets.
For more information, see the Kubebuilder documentation.
Build Container Images
Build and push your image to the location specified by IMG
:
make docker-build docker-push IMG=<container-registry>/kyma-companion-manager:<tag> # If using docker, <container-registry> is your username.
NOTE: For MacBook M1 devices, run:
make docker-buildx IMG=<container-registry>/kyma-companion-manager:<tag>
Deployment
You need a Kubernetes cluster to run against. You can use k3d to get a local cluster for testing, or run against a remote cluster.
[!NOTE]
Your controller automatically uses the current context in your kubeconfig file, that is, whatever cluster kubectl cluster-info
shows.
Deploy in the Cluster
-
Download Go packages:
go mod vendor && go mod tidy
-
Install the CRDs to the cluster:
make install
-
Build and push your image to the location specified by IMG
:
make docker-build docker-push IMG=<container-registry>/kyma-companion-manager:<tag>
-
Deploy the kyma-companion-manager
controller to the cluster:
make deploy IMG=<container-registry>/kyma-companion-manager:<tag>
-
[Optional] Install Companion
Custom Resource:
kubectl apply -f config/samples/default.yaml
Undeploy Kyma Companion Manager
Undeploy Kyma Companion Manager from the cluster:
make undeploy
Uninstall CRDs
To delete the CRDs from the cluster:
make uninstall
Contributing
See the Contributing Rules.
Code of Conduct
See the Code of Conduct document.
Licensing
See the license file.