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 may crash if storageClassName is not set #687

Closed
c3-clement opened this issue Aug 22, 2024 · 2 comments · Fixed by #688
Closed

cass-operator may crash if storageClassName is not set #687

c3-clement opened this issue Aug 22, 2024 · 2 comments · Fixed by #688
Assignees
Labels
bug Something isn't working done Issues in the state 'done'

Comments

@c3-clement
Copy link

What happened?

If Spec.StorageConfig.CassandraDataVolumeClaimSpec.StorageClassName is not set on the datacenter CR, StorageClassName will be a null pointer.
StorageClassName is getting dereferenced here https://github.com/k8ssandra/cass-operator/blame/master/pkg/reconciliation/reconcile_datacenter.go#L191 without a null check before.

If storageClassName is null, the operator will segfault.

What did you expect to happen?

I expect cass-operator to handle the case when storageClassName is not set by the user.
The operator should try to fetch the default storage class instead and call storageClass() with the name of the default storage class.

How can we reproduce it (as minimally and precisely as possible)?

I observed the issue when testing restoration.
I believe the issue will happen when storage expansion is triggered and when storage class name is not set.

I'm not sure why storage expansion got triggered during restoration.

cass-operator version

1.22

Kubernetes version

1.29

Method of installation

helm

Anything else we need to know?

No response

@c3-clement c3-clement added the bug Something isn't working label Aug 22, 2024
@burmanm
Copy link
Contributor

burmanm commented Aug 22, 2024

Ah, PersistentVolume has type string and for PersistentVolumeClaimSpec they made it *string.

@burmanm burmanm self-assigned this Aug 22, 2024
@burmanm burmanm moved this to Ready For Review in K8ssandra Aug 22, 2024
@adejanovski adejanovski added the ready-for-review Issues in the state 'ready-for-review' label Aug 22, 2024
@burmanm
Copy link
Contributor

burmanm commented Aug 22, 2024

Related: #123

@burmanm burmanm moved this from Ready For Review to In Progress in K8ssandra Aug 22, 2024
@adejanovski adejanovski added in-progress Issues in the state 'in-progress' and removed ready-for-review Issues in the state 'ready-for-review' labels Aug 22, 2024
@burmanm burmanm moved this from In Progress to Ready For Review in K8ssandra Aug 23, 2024
@adejanovski adejanovski added ready-for-review Issues in the state 'ready-for-review' and removed in-progress Issues in the state 'in-progress' labels Aug 23, 2024
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in K8ssandra Aug 27, 2024
@adejanovski adejanovski added done Issues in the state 'done' and removed ready-for-review Issues in the state 'ready-for-review' labels Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done Issues in the state 'done'
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants