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

cass-operator's spec.podTemplateSpec.spec.tolerations is overwritten by spec.tolerations without error message #195

Closed
tylergu opened this issue Jan 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@tylergu
Copy link
Member

tylergu commented Jan 1, 2023

What happened?

We were specify the tolerations for the podTemplateSpec through the field spec.podTemplateSpec.spec.tolerations but our configuration was overwritten by another field in the CR spec.tolerations without notice or warning.

Did you expect to see something different?

We expect our input to be rejected with clear error message up front, if the desired behavior of the handling of spec.podTemplateSpec.spec.tolerations is to be overwritten by spec.tolerations.

How to reproduce it (as minimally and precisely as possible):

  1. Deploy the cass-operator
  2. Deploy CassandraDB with the following CR yaml
apiVersion: cassandra.datastax.com/v1beta1
kind: CassandraDatacenter
metadata:
  name: test-cluster
spec:
  clusterName: cluster1
  podTemplateSpec:
    spec:
      containers: []
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/control-plane
        operator: Exists

Environment

  • Cass Operator version:

    v1.10.3

  • Kubernetes version information:

    Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:41:01Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-19T15:39:43Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"linux/amd64"}

  • Kubernetes cluster kind:

    kind

  • Manifests:

Shown above in the reproduce section

  • Cass Operator Logs:
insert Cass Operator logs relevant to the issue here

Anything else we need to know?:
The root cause is at https://github.com/k8ssandra/cass-operator/blob/a6054d271b7034ab06fd97be9472b693ed523e49/pkg/reconciliation/construct_podtemplatespec.go#L635

One possible fix is to add a check in the admission webhook which rejects the CR if the field spec.podTemplateSpec.spec.tolerations is not empty.
An alternative is to add a error level log message near https://github.com/k8ssandra/cass-operator/blob/a6054d271b7034ab06fd97be9472b693ed523e49/pkg/reconciliation/construct_podtemplatespec.go#L635 to print error in log to indicate that the toleration is overwritten by another field.

@tylergu tylergu added the bug Something isn't working label Jan 1, 2023
@tylergu
Copy link
Member Author

tylergu commented Jan 1, 2023

Issued: k8ssandra/cass-operator#471

@tylergu tylergu closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant