-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
enable extended patch transformer and add tests #1355
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Liujingfang1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Other pieces look good.
@@ -200,7 +200,6 @@ func (k *Kustomization) EnforceFields() []string { | |||
// new field names. | |||
func FixKustomizationPreUnmarshalling(data []byte) []byte { | |||
deprecateFieldsMap := map[string]string{ | |||
"patches:": "patchesStrategicMerge:", |
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.
Hmm... It seems patches
field was deprecated and patchesStrategicMerge
is the replacement for it.
But now we want to reuse patches
field as a different meaning.
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.
It might be a breaking change for "lazy" people that haven't migrated yet.
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.
I've asked about this as well. The patches
keyword has been removed since kustomize v2.0.0, so I think this is fine.
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.
As I've seen, many users already changed patches
to patchesStrategicMerge
. Maybe @damienr74 can provide some data for how many patches
are used in kustomization.yaml file.
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.
On public github it appears there's still about 1k of them out of ~6k. But in any case, they would already be broken for kustomize v2+, so I'm not sure there's much of a concern for this.
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.
@damienr74 @mengqiy We can address this issue by kustomize edit fix
command to convert the old patches
to the new patches
format. I will have a separate PR for it.
name: busybox | ||
`) | ||
th.WriteF("/app/base/patch.yaml", ` | ||
apiVersion: apps/v1beta2 |
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 we shrink this patch to
metadata:
name: busybox
annotations:
new-key: new-value
or
metadata:
annotations:
new-key: new-value
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.
We couldn't do that. If we remove name
, then it's not a valid strategic merge patch.
kind: Deployment | ||
`) | ||
th.WriteF("/app/base/patch.yaml", ` | ||
apiVersion: apps/v1beta2 |
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.
same question here
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
It turns out we (kubebuilder) are the "lazy" people, we are still using the deprecates
This seems to be not true. Deprecated |
Updates the example for patching multiple objects to match the implementation in kubernetes-sigs#1355, which supports name as a regular expression (not wildcard pattern). Fixes kubernetes-sigs#4258.
Updates the example for patching multiple objects to match the implementation in kubernetes-sigs#1355, which supports name as a regular expression (not wildcard pattern).
part of #720
enable extended patch transformer in kustomization by adding and triggering the config function
add unit tests for extended transformer to select targets