The Namespace Annotator
Kubernetes operator is designed to allow end-users to have greater control over user-defined annotations on their Kubernetes namespace. Annotations are key-value pairs that can be attached to Kubernetes resources, providing additional information that can be used by applications and tools.
The Namespace Annotator operator can be used to automatically add or modify annotations on a namespace. This can be useful for a variety of purposes, such as adding metadata to namespaces for better organization or controlling access to certain resources based on their annotations.
You’ll need a Kubernetes cluster to run against. You can use KIND to get a local cluster for testing, or run against a remote cluster.
Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
- Install Instances of Custom Resources:
kubectl apply -f config/samples/
- Build and push your image to the location specified by
IMG
:
make docker-build docker-push IMG=<some-registry>/namesapceannotateor:tag
- Deploy the controller to the cluster with the image specified by
IMG
:
make deploy IMG=<some-registry>/namesapceannotateor:tag
To delete the CRDs from the cluster:
make uninstall
UnDeploy the controller to the cluster:
make undeploy
first, create the resource NamespaceAnnotate
.
apiVersion: devops.example.io/v1alpha1
kind: NamespaceAnnotate
metadata:
name: example
namespace: test-ann
spec:
annotations:
"test": "test"
"example": "examples"
and watch how its syncs with your namespace by applying your annotations.
if you want to edit the annotations simply edit the NamespaceAnnotate
resource or delete it to get rid of them.