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

Fix reconciliation of clusters with BackupConfig reference featuring credentialsType in k8ssandra-operator #1489

Open
rzvoncek opened this issue Feb 18, 2025 · 0 comments · May be fixed by #1490
Labels
bug Something isn't working

Comments

@rzvoncek
Copy link
Contributor

rzvoncek commented Feb 18, 2025

What happened?
Creating a k8ssandra cluster without a reference to storage credentials, eg:

---
apiVersion: medusa.k8ssandra.io/v1alpha1
kind: MedusaConfiguration
metadata:
  name: global-medusa-config
  namespace: k8ssandra-operator
spec:
  storageProperties:
    storageProvider: s3_compatible
    bucketName: k8ssandra-medusa
    credentialsType: role-based
---
apiVersion: k8ssandra.io/v1alpha1
kind: K8ssandraCluster
metadata:
  name: test-cluster
  namespace: k8ssandra-operator
spec:  
  cassandra:
    ...
  medusa:
    storageProperties:
      prefix: test
    medusaConfigurationRef:
      name: global-medusa-config

is currently broken:

2025-02-18T06:50:41.961Z	ERROR	Reconciler error	{"controller": "k8ssandracluster", "controllerGroup": "k8ssandra.io", "controllerKind": "K8ssandraCluster", "K8ssandraCluster": {"name":"imbalanced-racks","namespace":"k8ssandra-operator"}, "namespace": "k8ssandra-operator", "name": "imbalanced-racks", "reconcileID": "2f9626a0-0ff9-482a-ac38-81a4bc85460a", "error": "ReplicatedSecret.replication.k8ssandra.io \"07db578b-\" is invalid: metadata.name: Invalid value: \"07db578b-\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:329
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:227

This is because the operator tries to create the secret holding the credentials no matter what. Because the name ends up blank, it only get's prefixed with the cluster name, nothing comes after the - and the pattern is offended.

Did you expect to see something different?
I expect everything reconcilied without errors, resulting in medusa.ini file without the key_file field, and no storage secret being created.

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

  • Deploy the above manifest, with some Cassandra configuration.

Environment

  • K8ssandra Operator version:

    Insert image tag or Git SHA here

  • Kubernetes version information:

    kubectl version

  • Kubernetes cluster kind:

    insert how you created your cluster: kops, bootkube, etc.

  • Manifests:

insert manifests relevant to the issue
  • K8ssandra Operator Logs:
insert K8ssandra Operator logs relevant to the issue here

Anything else we need to know?:

┆Issue is synchronized with this Jira Story by Unito
┆Issue Number: K8OP-312

@rzvoncek rzvoncek added the bug Something isn't working label Feb 18, 2025
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
1 participant