Skip to content

injection: fix sidecar template for TPROXY mode on OpenShift#56577

Merged
istio-testing merged 3 commits intoistio:masterfrom
jewertow:fix-tproxy-on-ocp
Jun 11, 2025
Merged

injection: fix sidecar template for TPROXY mode on OpenShift#56577
istio-testing merged 3 commits intoistio:masterfrom
jewertow:fix-tproxy-on-ocp

Conversation

@jewertow
Copy link
Copy Markdown
Member

@jewertow jewertow commented Jun 11, 2025

Please provide a description of this PR:

Injection webhook on OpenShift sets proxy UID and GID based on openshift.io/sa.scc.uid-range annotation to avoid the requirement of assigning anyuid SCC for regular pods. However, proxies running in TPROXY mode need privileged SCC and injection webhook should assign UID=0 and GID=1337 as it is by default. Init container istio-validation also should use default UID=1337 and GID=1337.

Signed-off-by: Jacek Ewertowski <jacek.ewertowski1@gmail.com>
@jewertow jewertow requested review from a team as code owners June 11, 2025 11:03
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 11, 2025
Signed-off-by: Jacek Ewertowski <jacek.ewertowski1@gmail.com>
readOnlyRootFilesystem: true
runAsGroup: {{ .ProxyGID | default "1337" }}
runAsUser: {{ .ProxyUID | default "1337" }}
runAsUser: {{ if $tproxy }} 1337 {{ else }} {{ .ProxyUID | default "1337" }} {{ end }}
Copy link
Copy Markdown
Contributor

@dgn dgn Jun 11, 2025

Choose a reason for hiding this comment

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

nit: why change the order, ie runAsUser before runAsGroup? Before it was alphabetically ordered

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.

Sorry, I didn't do that intentionally. This is the result of refactoring a few subsequent changes to this template. I will revert it.

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.

Done

Copy link
Copy Markdown
Contributor

@dgn dgn left a comment

Choose a reason for hiding this comment

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

LGTM but ordering changes seem unnecessary. not a blocker though

Signed-off-by: Jacek Ewertowski <jacek.ewertowski1@gmail.com>
@dgn
Copy link
Copy Markdown
Contributor

dgn commented Jun 11, 2025

Actually, now that I think about it... Can't we also configure a default interception mode in MeshConfig? If so, that would mean TPROXY being enabled without the annotation being present. So maybe move this into pkg/kube/inject instead of the template?

@jewertow
Copy link
Copy Markdown
Member Author

This condition takes into account the annotation as well as a proxyConfig that can be defined in meshConfig or per-proxy:

{{ $tproxy := (eq (annotation .ObjectMeta `sidecar.istio.io/interceptionMode` .ProxyConfig.InterceptionMode) `TPROXY`) }}

@dgn
Copy link
Copy Markdown
Contributor

dgn commented Jun 11, 2025

This condition takes into account the annotation as well as a proxyConfig that can be defined in meshConfig or per-proxy:

{{ $tproxy := (eq (annotation .ObjectMeta `sidecar.istio.io/interceptionMode` .ProxyConfig.InterceptionMode) `TPROXY`) }}

Ah, perfect. Thank you

@jewertow jewertow changed the title injection: fix sidecar for TPROXY mode on OpenShift injection: fix sidecar template for TPROXY mode on OpenShift Jun 11, 2025
@istio-testing istio-testing merged commit 60bf05b into istio:master Jun 11, 2025
30 checks passed
@jewertow jewertow added cherrypick/release-1.24 Set this label on a PR to auto-merge it to the release-1.24 branch cherrypick/release-1.25 Set this label on a PR to auto-merge it to the release-1.25 branch cherrypick/release-1.26 Set this label on a PR to auto-merge it to the release-1.26 branch labels Jun 11, 2025
@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request created: #56584

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request created: #56585

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request could not be created: failed to create pull request against istio/istio#release-1.24 from head istio-testing:cherry-pick-56577-to-release-1.24: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for istio-testing:cherry-pick-56577-to-release-1.24."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request created: #56586

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request could not be created: failed to create pull request against istio/istio#release-1.24 from head istio-testing:cherry-pick-56577-to-release-1.24: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for istio-testing:cherry-pick-56577-to-release-1.24."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request could not be created: failed to create pull request against istio/istio#release-1.25 from head istio-testing:cherry-pick-56577-to-release-1.25: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for istio-testing:cherry-pick-56577-to-release-1.25."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request could not be created: failed to create pull request against istio/istio#release-1.26 from head istio-testing:cherry-pick-56577-to-release-1.26: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for istio-testing:cherry-pick-56577-to-release-1.26."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request could not be created: failed to create pull request against istio/istio#release-1.25 from head istio-testing:cherry-pick-56577-to-release-1.25: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for istio-testing:cherry-pick-56577-to-release-1.25."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

@istio-testing
Copy link
Copy Markdown
Collaborator

In response to a cherrypick label: new pull request could not be created: failed to create pull request against istio/istio#release-1.26 from head istio-testing:cherry-pick-56577-to-release-1.26: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for istio-testing:cherry-pick-56577-to-release-1.26."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

fjglira pushed a commit to fjglira/istio that referenced this pull request Sep 26, 2025
* upstream/master:
  injection: fix sidecar template for TPROXY mode on OpenShift (istio#56577)
  Update BASE_VERSION to master-2025-06-11T19-01-21 (istio#56581)
  Automator: update proxy@master in istio/istio@master (istio#56580)
  Fix: create-remote-secret create redundant rbac resources (istio#56559)
  support trafficDistribution in pilot service (istio#56556)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/environments cherrypick/release-1.24 Set this label on a PR to auto-merge it to the release-1.24 branch cherrypick/release-1.25 Set this label on a PR to auto-merge it to the release-1.25 branch cherrypick/release-1.26 Set this label on a PR to auto-merge it to the release-1.26 branch size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants