Open marshall007 opened 3 years ago
@marshall007: This issue is currently awaiting triage.
SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted
label.
The triage/accepted
label can be added by org members by writing /triage accepted
in a comment.
I think it's worth noting that the semantics of options.prefix
/options.suffix
as described here would be consistent with how setters and substitutions work(ed). With the imperative setter commands being removed in v5 (see: https://github.com/kubernetes-sigs/kustomize/issues/3953), users could turn to replacements as a more declarative approach to achieving the same functionality.
What if we provided away to specifically target elements in string arrays? For example, something like spec.template.spec.containers.[name=cert-manager].args.{--leader-election-namespace=kube-system}
I'm not particularly fond of using curly braces for the syntax but I am struggling to think of something better ATM and just want to get some feedback on the idea to see if that would sufficiently resolve the issues you're running into.
What if we provided away to specifically target elements in string arrays?
@natasha41575 I went back and forth on that same idea when I was writing up the proposal. I think the main issue with that approach is that you still need a way to construct a prefixed target value. My understanding of your example would be that it would result in the entire string --leader-election-namespace=kube-system
being replaced with the source value from fieldPath: metadata.namespace
when all you want to do is replace the kube-system
part.
You could potentially address that by also adding some sort of regular expression or other pattern-based syntax to the target fieldPath
, but that seemed like it would open up a big can of worms.
My thinking was that the options.prefix
/options.suffix
proposal was more generally useful as it can be applied to source
as well as targets
. In other words, you could now generically select prefix/suffixed source values and either retain or alter prefix/suffix on the target
.
My understanding of your example would be that it would result in the entire string --leader-election-namespace=kube-system being replaced with the source value from fieldPath: metadata.namespace when all you want to do is replace the kube-system part.
@marshall007 For this, you could use the options:
options:
delimiter: '='
index: 1
@natasha41575 yea the only downside there is that you can't replace multi-part values. Typical examples of that include --arg=namespace/name
and --arg=name.namespace.svc.cluster.local
.
There are some particularly problematic examples of this sort of thing in the cert-manager
helm chart:
Even with my proposal we can't handle the --dynamic-serving-dns-names=
case because there are two delimiters, I don't expect there's much we can do there.
The --dynamic-serving-ca-secret-name=
is solvable with the proposed options.suffix: "-ca"
. We tend to see this pop in cases where a secret is being created/managed by some controller at runtime (and thus we have no resource to source its name from).
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
Hey there :) I would like to learn and contribute, is this still open and a good first issue to work on?
@DaAlbrecht this one might be a bit controversial to start with, I would suggest https://github.com/kubernetes-sigs/kustomize/issues/4292 to start with
This issue has not been updated in over 1 year, and should be re-triaged.
You can:
/triage accepted
(org members only)/close
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/
/remove-triage accepted
Can i work on this?
Is your feature request related to a problem? Please describe.
A huge value-add to using
replacements
over traditional JSON patches is the ability to use[key=value]
selectors in field paths. This makes your patches much more robust since the alternative relies on array field ordering. Unfortunately, this is still true when the field path value is a simple string array... most notably in the case of containerargs
.Describe the solution you'd like
In situations like the following, it would be ideal if we could reliably replace the value of
--leader-election-namespace
:I'm not sure how we would represent this in the
replacements
API, but it could look something like:The new rules would be:
index
anddelimiter
options can only be specified on scalar values and lists consisting only of string valuesprefix
and/orsuffix
options are specified,prefix
andsuffix
prefix
and/orsuffix
is preserved in the resulting valuedelimiter
, only the unprefixed/suffixed portion of the string is split