2 min read
With operator-sdk, it really makes it easy to create new CRD definitions and create the template to write the reconcile loop for it. But if we want to be able to handle changes on objects that are already present on the Kubernetes cluster (not a custom resources) we can create the Reconciler from scratch.
22/12/2023
Read more...1 min read
If we use //+kubebuilder:printcolumn to add fields to print with kubectl get we'll notice that the AGE colum goes away with it. We can use an additional //+kubebuilder:printcolumn
to add the AGE column back.
29/08/2023
Read more...2 min read
When you have several kubernetes objects (CRDs) that work together it can be useful to be able to query them all together to get a better idea of what's deployed without having to query all the individial resources. With operator-SDK we just need to annotate the objects.
01/08/2023
Read more...2 min read
When writing a custom Kubernetes operator using operator-sdk we might want to change the fields are show when running kubectl get
:
$ kubectl get example
NAME AGE
demo 4h20m
To do so, we'll need to add the additionalPrinterColumns field the the CustomResourceDefinition, but since we are using operator-sdk to take care of this, we'll need to use some annotations in the resource definition file.
15/05/2023
Read more...2 min read
When creating a new API resource using the operator-sdk we can use the namespaced flag to make it Namespaced:
$ operator-sdk create api --group group \
--version v1 \
--kind Example \
--resource \
--controller
Or in the cluster scope:
$ operator-sdk create api --group group \
--version v1 \
--kind Example \
--resource \
--controller \
--namespaced=false
Maybe because we forgot to add the flag or because we have changed our mind, we don't need delete the object to change the scope of it, let's see how.
05/04/2023
Read more...