Skip to content

fix istio-revision-tag-default MutatingWebhookConfigurations is not created during installation#56004

Merged
istio-testing merged 1 commit intoistio:masterfrom
my-git9:tag-default
Apr 21, 2025
Merged

fix istio-revision-tag-default MutatingWebhookConfigurations is not created during installation#56004
istio-testing merged 1 commit intoistio:masterfrom
my-git9:tag-default

Conversation

@my-git9
Copy link
Copy Markdown
Member

@my-git9 my-git9 commented Apr 18, 2025

Please provide a description of this PR:

fix istio-revision-tag-default MutatingWebhookConfiguration is not created during installation when the revision is not default

Fix #55980

@my-git9 my-git9 requested review from a team as code owners April 18, 2025 15:22
@istio-policy-bot
Copy link
Copy Markdown

🤔 🐛 You appear to be fixing a bug in Go code, yet your PR doesn't include updates to any test files. Did you forget to add a test?

Courtesy of your friendly test nag.

@istio-testing istio-testing added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 18, 2025
…reated during installation

Signed-off-by: xin.li <xin.li@daocloud.io>
@my-git9 my-git9 changed the title fix istio-revision-tag-default MutatingWebhookConfigurations are not created during installation fix istio-revision-tag-default MutatingWebhookConfigurations is not created during installation Apr 18, 2025
@my-git9
Copy link
Copy Markdown
Member Author

my-git9 commented Apr 18, 2025

/test integ-ambient-mc

@istio-testing
Copy link
Copy Markdown
Collaborator

@my-git9: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
integ-ambient-mc_istio 5771d5e link false /test integ-ambient-mc
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

func PreviousInstallExists(ctx context.Context, client kubernetes.Interface) bool {
mwhs, err := client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(ctx, metav1.ListOptions{
LabelSelector: "app=sidecar-injector",
LabelSelector: "app=sidecar-injector, istio.io/tag=default",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the old logic for this function in 1.23 was the same (no istio.io/tag). However, this logic seemed to work in 1.23...?

Do we understand why? I am worried we have no tests here so may not be quite targeting the right thing.

Note this PreviousInstallExists is also used in two places, and now no longer really means "previous install exists" so we may want to rename it and make sure its appropriate for all usages?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why this part had problems before is:

  1. During the installation process, mainfest (including MutatingWebhook) will be installed first, and then it will be detected whether the tag operation needs to be performed, https://github.com/istio/istio/blob/master/operator/pkg/webhook/webhook.go#L42-L43
  2. In the detection logic, if there is already a MutatingWebhook with the label "app=sidecar-injector" or the revision specified for this installation is default, a tag operation is required:
    https://github.com/istio/istio/blob/master/operator/pkg/webhook/webhook.go#L171-L176
    https://github.com/istio/istio/blob/master/istioctl/pkg/tag/util.go#L107-L115
  3. But the problem lies in the first point. Since MutatingWebhook is installed first, the MutatingWebhook installed here It must contain the "app=sidecar-injector" tag, so the second point determines that the MutatingWebhook is filtered by "app=sidecar-injector", which is always true, that is, there is only one effective judgment: whether the revision is default

Another part of the use of the PreviousInstallExists function is in CheckWebhooks: https://github.com/istio/istio/blob/master/operator/pkg/webhook/webhook.go#L78
The function should be to determine whether the revision of the MutatingWebhook of the default tag is default if a tag operation is required, otherwise a warning is issued. According to the above logic, this judgment should have been inaccurate before:
https://github.com/istio/istio/blob/master/operator/pkg/webhook/webhook.go#L144-L156

@my-git9 my-git9 requested a review from howardjohn April 19, 2025 13:08
@istio-testing istio-testing merged commit 05b025f into istio:master Apr 21, 2025
29 of 30 checks passed
yxun pushed a commit to yxun/istio that referenced this pull request Apr 23, 2025
…reated during installation (istio#56004)

Signed-off-by: xin.li <xin.li@daocloud.io>
tjons pushed a commit to tjons/istio that referenced this pull request Apr 26, 2025
…reated during installation (istio#56004)

Signed-off-by: xin.li <xin.li@daocloud.io>
fjglira pushed a commit to fjglira/istio that referenced this pull request Sep 26, 2025
* upstream/master:
  remove 1.23 compatibility profile (istio#56023)
  Create ambient multinetwork flag (istio#55991)
  krt: make krt and kube client indexes named (istio#55999)
  Automator: update proxy@master in istio/istio@master (istio#56026)
  fix istio-revision-tag-default MutatingWebhookConfigurations is not created during installation (istio#56004)
  doc: fix typo in accesslog test (istio#55117)
  fix(networking): Add absolute FQDNs (trailing dot) to VirtualHost domains (istio#56008)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/user experience size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change in "istioctl install" behavior with IstioOperator bewteen v1.23 and v1.24

4 participants