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

Issue copying secret name with more than 63 characters #61

Open
sashanka-kandala opened this issue Mar 19, 2020 · 1 comment
Open

Issue copying secret name with more than 63 characters #61

sashanka-kandala opened this issue Mar 19, 2020 · 1 comment

Comments

@sashanka-kandala
Copy link

Having issue syncing secret name with more than 63 characters
Docker image used : bourneid/secret-sync-operator
ERROR from secret-sync pod:
"error":"Secret "clustername-xxxxxxxxxxxxxxx-0001" is invalid: metadata.labels: Invalid value: "default.clustername-xxxxxxxxxxxxxxx-0001": must be no more than 63 characters",

@adamj9431
Copy link

adamj9431 commented Jan 20, 2021

We ran into this same issue. Our cluster's name is 18 characters, xyz-k8s-production. The operator attempts to create a secret with a label secretsync.ibm.com/replicated-from: default.xyz-k8s-production-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-0000. This fails because the label is longer than 63 characters. We added code to secret_controller.go at line 68 to limit the secret name to 63 characters. This works but there's probably a better way.

const (
	max_length = 63
)
replicated_from := fmt.Sprintf("%s.%s", secret.Namespace, secret.Name)
if len(replicated_from) > max_length {
	replicated_from = replicated_from[:max_length]
}
labels := map[string]string{
	"secretsync.ibm.com/replicated-from": replicated_from,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants