-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
K8SSAND-1503 ⁃ Unable to remove the additional labels on the seed service through CR #330
Comments
The |
I think this is actually a bit hard to fix cleanly. I guess the key1: value1
key2: value2 then some other sources added some labels to the service, so service has labels as: key1: value1
key2: value2
externalKey: value3 When users change the key1: value1 The cass-operator should only remove the key1: value1
externalKey: value3 I think to achieve this behavior, we need to keep track what labels are added through the CR's |
I am not sure why key1: null would not update the labels though. |
I may have spoken incorrectly when I suggested taking the intersection. It should be pretty straightforward though. The operator's job is to make sure that the actual labels match the desired labels as specified by app.kubernetes.io/instance: cassandra-test
app.kubernetes.io/managed-by: cass-operator
app.kubernetes.io/name: cassandra
app.kubernetes.io/version: 4.0.3
cassandra.datastax.com/cluster: test Now let's say I configure key1: value1
key2: value2 The service should then have: app.kubernetes.io/instance: cassandra-test
app.kubernetes.io/managed-by: cass-operator
app.kubernetes.io/name: cassandra
app.kubernetes.io/version: 4.0.3
cassandra.datastax.com/cluster: test
key1: value1
key2: value2 Now let's update key1: value1.1
key3: value3 3 changes have been made
The actual service labels should then be as follows: app.kubernetes.io/instance: cassandra-test
app.kubernetes.io/managed-by: cass-operator
app.kubernetes.io/name: cassandra
app.kubernetes.io/version: 4.0.3
cassandra.datastax.com/cluster: test
key1: value1.1
key3: value3 |
Yeah I totally agree |
What happened?
We found it impossible to remove the additional labels by unsetting the key-value pairs under the field
spec.additionalServiceConfig.seedService.additionalLabels
. We first added a labellabelKey: labelValue
under theadditionalLabels
field, and cass-operator correctly adds the label to the seed service. However, later we wanted to remove thelabelKey: labelValue
label from the seed service by deleting it from the CR. However, by doing so, cass-operator does not remove the additionalLabel from the seed service.We also tried to change the
labelKey: labelVaule
tolabelKey: null
, but cass-operator still is not able to update the labels in seed service.Did you expect to see something different?
We expected that the CR represents the desired state of the application, based on the declarative model of Kubernetes. So we expected that when remove the label from the
spec.additionalServiceConfig.seedService.additionalLabels
field, cass-operator would automatically remove this label from the seed service.How to reproduce it (as minimally and precisely as possible):
Deploy cass-operator and the
server-storage
storage classDeploy a basic CassandraDB using the example CR:
kubectl apply -f example.yaml
example.yaml
Add additional labels to seed service by applying the cr1.yaml
cr1.yaml
labelKey: labelValue
labelKey: labelValue
Environment
Cass Operator version:
* Kubernetes version information:docker.io/k8ssandra/cass-operator:v1.10.3
Anything else we need to know?:
The root cause is inside the
cass-operator/pkg/reconciliation/reconcile_services.go
Line 103 in 973cea8
A possible fix is to keep track of the labels that are added by the user using the
spec.additionalServiceConfig.seedService.additionalLabels
field, so that when users delete some labels from the field, cass-operator can delete these from the service.The similar problem happens to the annotations too:
cass-operator/pkg/reconciliation/reconcile_services.go
Line 104 in 973cea8
┆Issue is synchronized with this Jira Task by Unito
┆friendlyId: K8SSAND-1503
┆priority: Medium
The text was updated successfully, but these errors were encountered: