Kuadrant / authorino-operator

Kubernetes Operator to manage Authorino instances
Apache License 2.0
9 stars 20 forks source link

Propagating Authorino labels #91

Closed didierofrivia closed 2 years ago

didierofrivia commented 2 years ago

This PR makes it possible to propagate the labels defined in the Custom Resource Authorino to all the Kubernetes objects the operator creates.

Closes https://github.com/Kuadrant/authorino-operator/issues/82

Verification Steps

  1. Create cluster

    kind create cluster
  2. Create namespace for the operator

    kubectl create namespace authorino-operator
  3. Install manifests

    make install
  4. Run the operator

    make run
  5. In another terminal apply the following Authorino CR

    kubectl apply  -f -<<EOF
    apiVersion: operator.authorino.kuadrant.io/v1beta1
    kind: Authorino
    metadata:
    name: authorino
    labels:
    lola: mento
    spec:
    image: quay.io/kuadrant/authorino:latest
    replicas: 1
    clusterWide: true
    listener:
    tls:
      enabled: false
    oidcServer:
    tls:
      enabled: false
    EOF
  6. Find the Kubernetes objects created by filtering that level

    
    kubectl get services -l 'lola in (mento)'

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE authorino-authorino-authorization ClusterIP 10.96.134.186 50051/TCP,5001/TCP 5m2s authorino-authorino-oidc ClusterIP 10.96.142.39 8083/TCP 5m2s authorino-controller-metrics ClusterIP 10.96.140.39 8080/TCP 5m2s


```bash
kubectl get deployments -l 'lola in (mento)'

NAME        READY   UP-TO-DATE   AVAILABLE   AGE
authorino   1/1     1            1           6m43s
  1. PROFIT! Now you can delete the cluster
    kind delete cluster