Skip to content

make secretId and versionId required fields#60

Open
endophage wants to merge 1 commit intomumoshu:mainfrom
endophage:required_fields
Open

make secretId and versionId required fields#60
endophage wants to merge 1 commit intomumoshu:mainfrom
endophage:required_fields

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