feat: Add opt-in option for zarf init #4467
Open
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.
Description
This PR adds flags
--agent-namespaces-mode=[active|passive]and--agent-objects-mode=[active|passive]tozarf initcommand. By default, both are set to active. When using either of them to passive, MutatingWebhookConfiguration will be deployed with rules that enforce namespaces/objects to be labeled withzarf.dev/agent: mutate, or else the images won't be mutated. An exception that was added is zarf namespace, there effectively modes are always active (which enables us deploy there Gitea for instance)examples:
zarf.dev/agent: mutatethen like current zarf behaviour on this whole namespace. Otherwise no images are mutated at all. If the pod is labeled withzarf.dev/agent: ignore, then it won't be mutated neither.zarf.dev/agent: mutatethen image is mutated pod. Otherwise no mutation is applied.zarf.dev/agent: mutatethen image mutation occurs.Related Issue
Relates to #4419
Checklist before merging