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

make secretId and versionId required fields #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

endophage
Copy link
Contributor

@endophage endophage commented Jul 7, 2022

Just turning this proposed change into a PR, it makes a lot of sense to have k8s validate the required fields are present upfront, making it easier for users to debug issues.

Testing on my local k8s instance with a secret missing the versionId:

kubectl apply -f /tmp/secret.yaml
error: error validating "/tmp/secret.yaml": error validating data: ValidationError(AWSSecret.spec.stringDataFrom.secretsManagerSecretRef): missing required field "versionId" in io.github.mumoshu.v1alpha1.AWSSecret.spec.stringDataFrom.secretsManagerSecretRef; if you choose to ignore these errors, turn validation off with --validate=false

Something to be aware of, though nobody should be doing this, if both secretId and versionId are missing, kubernetes doesn't error, i.e. it'll accept the following file even with these updates:

apiVersion: mumoshu.github.io/v1alpha1
kind: AWSSecret
metadata:
  name: bad-aws-secret
  namespace: default                                                                                                                                                                                                                    
spec:
  stringDataFrom:
    secretsManagerSecretRef:

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

Successfully merging this pull request may close these issues.

1 participant