kyma-project / lifecycle-manager

Controller that manages the lifecycle of Kyma Modules in your cluster.
http://kyma-project.io
Apache License 2.0
10 stars 30 forks source link

Make `watched-by` label more transparent #1822

Closed janmedrek closed 1 month ago

janmedrek commented 2 months ago

Description

The watched-by label is used by Runtime Watcher to query resources that should be monitored. Since we want to keep the feature and provide more transparency we would need to revisit its value.

The proposal is to switch from watched-by: watcher or watched-by: lifecycle-manager to watched-by: kyma-runtime-watcher.

Reasons

We want to get rid of cryptic label messages in order to not confuse the users.

Acceptance Criteria

Feature Testing

No response

Testing approach

No response

Attachments

https://github.com/kyma-project/lifecycle-manager/blob/a180040ef2e6b8742a61ccc44eaaabae1dded8f5/config/watcher/operator_v1beta2_watcher.yaml#L9

https://github.com/kyma-project/lifecycle-manager/blob/9be2538f0201fe61eb7ac1f620242137f6178c74/internal/declarative/v2/default_transforms.go#L66

https://github.com/kyma-project/lifecycle-manager/blob/2f79d89435c8aba14e3043098116b04a59089853/internal/remote/skr_context.go#L212

c-pius commented 1 month ago

I think this needs to be revisited... One STAGE we have now many other resources that are labelled with watched-by:

kubectl get all --all-namespaces -l operator.kyma-project.io/watched-by=kyma      
NAMESPACE     NAME                                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
kyma-system   service/api-gateway-operator-metrics   ClusterIP   10.106.202.107   <none>        8080/TCP   43h
kyma-system   service/api-gateway-webhook-service    ClusterIP   10.105.74.52     <none>        9443/TCP   43h
kyma-system   service/btp-manager-metrics-service    ClusterIP   10.109.23.159    <none>        8080/TCP   43h
kyma-system   service/istio-operator-metrics         ClusterIP   10.109.86.88     <none>        8080/TCP   43h
kyma-system   service/warden-admission               ClusterIP   10.107.179.142   <none>        443/TCP    43h
kyma-system   service/warden-operator                ClusterIP   10.104.153.188   <none>        8443/TCP   43h

NAMESPACE     NAME                                             READY   UP-TO-DATE   AVAILABLE   AGE
kyma-system   deployment.apps/api-gateway-controller-manager   1/1     1            1           43h
kyma-system   deployment.apps/btp-manager-controller-manager   1/1     1            1           43h
kyma-system   deployment.apps/istio-controller-manager         1/1     1            1           43h
kyma-system   deployment.apps/keda-manager                     1/1     1            1           21m
kyma-system   deployment.apps/nats-manager                     1/1     1            1           37h
kyma-system   deployment.apps/warden-admission                 1/1     1            1           43h
kyma-system   deployment.apps/warden-operator                  1/1     1            1           43h

The same is not the case for PROD (old lifecycle-manager value):

kubectl get all --all-namespaces -l operator.kyma-project.io/watched-by=lifecycle-manager

My understanding is that only KymaCR is supposed to have the watched-by label.

c-pius commented 1 month ago

Update. It seems like we already have been adding watched-by labels to other resources. But the value was module-manager not lifecycle-manager. Query on PROD:

kubectl get all --all-namespaces -l operator.kyma-project.io/watched-by=module-manager
NAMESPACE     NAME                                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
kyma-system   service/api-gateway-operator-metrics   ClusterIP   10.109.78.99     <none>        8080/TCP   26h
kyma-system   service/api-gateway-webhook-service    ClusterIP   10.104.180.159   <none>        9443/TCP   26h
kyma-system   service/btp-manager-metrics-service    ClusterIP   10.104.184.252   <none>        8080/TCP   26h
kyma-system   service/istio-operator-metrics         ClusterIP   10.107.59.128    <none>        8080/TCP   26h
kyma-system   service/warden-admission               ClusterIP   10.107.218.127   <none>        443/TCP    26h
kyma-system   service/warden-operator                ClusterIP   10.107.240.209   <none>        8443/TCP   26h

NAMESPACE     NAME                                             READY   UP-TO-DATE   AVAILABLE   AGE
kyma-system   deployment.apps/api-gateway-controller-manager   1/1     1            1           26h
kyma-system   deployment.apps/btp-manager-controller-manager   1/1     1            1           26h
kyma-system   deployment.apps/istio-controller-manager         1/1     1            1           26h
kyma-system   deployment.apps/warden-admission                 1/1     1            1           26h
kyma-system   deployment.apps/warden-operator                  1/1     1            1           26h

This value has been assigned with lbls[shared.WatchedByLabel] = OperatorName, where OperatorName = "module-manager" . => we were previously already applying it to all resources that we apply to the cluster (except the default CR).