Tolerate absence of resources in post-build substitution#570
Merged
stefanprodan merged 4 commits intofluxcd:mainfrom Feb 15, 2022
Merged
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
Member
stefanprodan
left a comment
There was a problem hiding this comment.
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
Contributor
Author
|
Please let me know if the documentation suits your style. I am amenable to adjusting the voice and level of detail. |
makkes
reviewed
Feb 15, 2022
|
|
||
| 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 |
Member
There was a problem hiding this comment.
Suggested change
| at renconciliation time. The controller's default behavior―with | |
| at renconciliation time. The controller's default behavior ― with |
Contributor
Author
There was a problem hiding this comment.
Ah, spaces around your em dashes, then? I can meet you there.
| 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 |
Member
There was a problem hiding this comment.
Suggested change
| `optional` unspecified or set to false―has it fail reconciliation if | |
| `optional` unspecified or set to false ― has it fail reconciliation if |
| 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 |
Member
There was a problem hiding this comment.
Suggested change
| 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.