-
Notifications
You must be signed in to change notification settings - Fork 187
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
Tolerate absence of resources in post-build substitution #570
Tolerate absence of resources in post-build substitution #570
Conversation
Signed-off-by: Steven E. Harris <seh@panix.com>
When the Docker service isn't running, the test suite can't create a Vault instance. Trap this failure earlier in the test program to preclude panicking after tests relying on Vault have failed. Signed-off-by: Steven E. Harris <seh@panix.com>
827484c
to
8847023
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please update the API docs here https://github.com/fluxcd/kustomize-controller/blob/main/docs/spec/v1beta2/kustomization.md#variable-substitution and mention the Optional field and its behaviour. Please also add it to the example YAML in that section, under cluster-vars
.
e6ff305
to
2627262
Compare
Please let me know if the documentation suits your style. I am amenable to adjusting the voice and level of detail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great change, thanks @seh! Just a few nits, otherwise lgtm.
docs/spec/v1beta2/kustomization.md
Outdated
@@ -748,6 +748,16 @@ With `spec.postBuild.substituteFrom` you can provide a list of ConfigMaps and Se | |||
from which the variables are loaded. | |||
The ConfigMap and Secret data keys are used as the var names. | |||
|
|||
The `spec.postBuild.substituteFrom.optional` field indicates how the | |||
controller should handle a referenced ConfigMap or Secret being absent | |||
at renconciliation time. The controller's default behavior―with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at renconciliation time. The controller's default behavior―with | |
at renconciliation time. The controller's default behavior ― with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, spaces around your em dashes, then? I can meet you there.
docs/spec/v1beta2/kustomization.md
Outdated
The `spec.postBuild.substituteFrom.optional` field indicates how the | ||
controller should handle a referenced ConfigMap or Secret being absent | ||
at renconciliation time. The controller's default behavior―with | ||
`optional` unspecified or set to false―has it fail reconciliation if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`optional` unspecified or set to false―has it fail reconciliation if | |
`optional` unspecified or set to false ― has it fail reconciliation if |
docs/spec/v1beta2/kustomization.md
Outdated
at renconciliation time. The controller's default behavior―with | ||
`optional` unspecified or set to false―has it fail reconciliation if | ||
the referenced object is missing. By setting the `optional` field to | ||
true, you can indicate that controller should use the referenced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, you can indicate that controller should use the referenced | |
`true`, you indicate that controller should use the referenced |
In a Kustomization's post-build substitution sources, introduce a new "Optional" field to allow referencing a Kubernetes ConfigMap or Secret that may not exist at time of reconciliation. Treat substitution when the referenced object is missing as if the object had been present but empty, lacking any variable bindings. Retain the longstanding behavior of interpreting references to Kubernetes objects being mandatory by default, such that reconciliation fails if such a referenced object does not exist. Only when the "Optional" field is set to true will reconciliation tolerate finding the referenced object to be missing. Signed-off-by: Steven E. Harris <seh@panix.com>
Signed-off-by: Steven E. Harris <seh@panix.com>
2627262
to
af038d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @seh 🎖️
In a Kustomization's post-build substitution sources, introduce a new "Optional" field to allow referencing a Kubernetes ConfigMap or Secret that may not exist at time of reconciliation. Treat substitution when the referenced object is missing as if the object had been present but empty, lacking any variable bindings.
Retain the longstanding behavior of interpreting references to Kubernetes objects being mandatory by default, such that reconciliation fails if such a referenced object does not exist. Only when the "Optional" field is set to true will reconciliation tolerate finding the referenced object to be missing.
Fixes #565.