Skip to content
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

RequiresUpdate condition is not set when expected #665

Closed
olim7t opened this issue Jun 4, 2024 · 0 comments · Fixed by #667
Closed

RequiresUpdate condition is not set when expected #665

olim7t opened this issue Jun 4, 2024 · 0 comments · Fixed by #667
Assignees
Labels
done Issues in the state 'done'

Comments

@olim7t
Copy link
Contributor

olim7t commented Jun 4, 2024

Following #566, an operator upgrade that triggers changes to an existing CassandraDatacenter should result in a new RequiresUpdate condition to be set. This does not appear to work.

Reproduction steps

Install the operator in a local kind cluster:

kind create cluster
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml
make docker-build docker-logger-build
make docker-kind docker-logger-kind
make deploy

Create a DC:

apiVersion: cassandra.datastax.com/v1beta1
kind: CassandraDatacenter
metadata:
  namespace: cass-operator
  name: dc1
spec:
  clusterName: demo
  racks:
    - name: rack1
  serverType: cassandra
  serverVersion: 4.1.0
  size: 1
  storageConfig:
    cassandraDataVolumeClaimSpec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 100Mi
      storageClassName: standard

Add a mock label to simulate an operator change:

diff --git a/pkg/reconciliation/construct_statefulset.go b/pkg/reconciliation/construct_statefulset.go
index a9b1ca8..38e0ee4 100644
--- a/pkg/reconciliation/construct_statefulset.go
+++ b/pkg/reconciliation/construct_statefulset.go
@@ -75,6 +75,7 @@ func newStatefulSetForCassandraDatacenter(

        statefulSetLabels := dc.GetRackLabels(rackName)
        oplabels.AddOperatorLabels(statefulSetLabels, dc)
+       statefulSetLabels["mock-label"] = "mock-value"

        statefulSetSelectorLabels := dc.GetRackLabels(rackName)

Commit the changes and redeploy the operator (same make commands as above).

I see the expected log message in the operator logs:

update is blocked, but statefulset needs an update. Marking datacenter as requiring update

The STS does not have the new label, which shows that the update was correctly blocked.
However, the CassandraDatacenter has the condition set to false. It seems that either the patch was not applied correctly (unlikely because I don't get any error logs), or it got overridden.

If I annotate the DC, the update is unblocked and the new label appears on the STS.

kubectl annotate CassandraDatacenter dc1 -ncass-operator \
  cassandra.datastax.com/autoupdate-spec=once
@adejanovski adejanovski moved this to Assess/Investigate in K8ssandra Jun 5, 2024
@adejanovski adejanovski added the assess Issues in the state 'assess' label Jun 5, 2024
@burmanm burmanm moved this from Assess/Investigate to Ready For Review in K8ssandra Jun 19, 2024
@adejanovski adejanovski added ready-for-review Issues in the state 'ready-for-review' and removed assess Issues in the state 'assess' labels Jun 19, 2024
@burmanm burmanm self-assigned this Jun 19, 2024
@adejanovski adejanovski moved this from Ready For Review to Review in K8ssandra Jun 20, 2024
@adejanovski adejanovski added review Issues in the state 'review' and removed ready-for-review Issues in the state 'ready-for-review' labels Jun 20, 2024
@github-project-automation github-project-automation bot moved this from Review to Done in K8ssandra Jun 24, 2024
@adejanovski adejanovski added done Issues in the state 'done' and removed review Issues in the state 'review' labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done Issues in the state 'done'
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants