Skip to content

[release-4.22] OCPBUGS-111083: fix(hcco): run kas-connection-checker as non-root - #9320

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:release-4.22from
matlaj:matlaj/kas_conn_checker_nonroot_422
Aug 17, 2026
Merged

[release-4.22] OCPBUGS-111083: fix(hcco): run kas-connection-checker as non-root#9320
openshift-merge-bot[bot] merged 1 commit into
openshift:release-4.22from
matlaj:matlaj/kas_conn_checker_nonroot_422

Conversation

@matlaj

@matlaj matlaj commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

This is a manual backport of #9296. The test code is slightly different due to helpers introduced by #8309 missing from the release-4.22 branch.

The Deployment set no securityContext, and kube-system is exempt from both SCC and Pod Security admission, so nothing assigned a UID and the cli image ran as root.

The workload only reads the ServiceAccount token (mode 0644) and curls an endpoint, so it needs none of those privileges.

The openshift.io/required-scc annotation was inert in kube-system, and once a UID is pinned it becomes a hazard: if that exemption ever changed, restricted-v2 (MustRunAsRange) would reject UID 1000 as outside the namespace uid-range and the checker would fail admission.

Pin RunAsUser to 1000 at the pod level and add the restricted container security context (no privilege escalation, read-only rootfs, RunAsNonRoot, drop ALL capabilities), matching konnectivity-agent, which solves the same problem in the same namespace.

Clear the required-scc annotation by setting the annotation map to nil rather than dropping the assignment, so it is also removed from Deployments created by earlier versions.

Extend the unit tests to assert the security context, invert the annotation assertion, and add the stale annotation to the pre-existing Deployment fixture so the upgrade path is exercised.

Which issue(s) this PR fixes:

Fixes OCPBUGS-105875

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Signed-off-by: Máté Lajkó mate.lajko@ibm.com
Commit-Message-Assisted-by: Claude (via Claude Code)
Co-Authored-By: Claude Opus 5 noreply@anthropic.com

The Deployment set no securityContext, and kube-system is exempt from both SCC and Pod Security
admission, so nothing assigned a UID and the cli image ran as root.

The workload only reads the ServiceAccount token (mode 0644) and curls an endpoint, so it needs
none of those privileges.

The openshift.io/required-scc annotation was inert in kube-system, and once a UID is pinned it
becomes a hazard: if that exemption ever changed, restricted-v2 (MustRunAsRange) would reject
UID 1000 as outside the namespace uid-range and the checker would fail admission.

Pin RunAsUser to 1000 at the pod level and add the restricted container security context (no
privilege escalation, read-only rootfs, RunAsNonRoot, drop ALL capabilities), matching
konnectivity-agent, which solves the same problem in the same namespace.

Clear the required-scc annotation by setting the annotation map to nil rather than dropping the
assignment, so it is also removed from Deployments created by earlier versions.

Extend the unit tests to assert the security context, invert the annotation assertion, and add the
stale annotation to the pre-existing Deployment fixture so the upgrade path is exercised.

Signed-off-by: Máté Lajkó <mate.lajko@ibm.com>
Commit-Message-Assisted-by: Claude (via Claude Code)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 02db6ac)
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci

openshift-ci Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 15, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 15, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@matlaj: This pull request references Jira Issue OCPBUGS-105875, which is invalid:

  • expected the bug to target either version "4.22.0." or "openshift-4.22.0.", but it targets "5.0" instead
  • expected the bug to be in one of the following states: NEW, ASSIGNED, POST, but it is MODIFIED instead
  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected Jira Issue OCPBUGS-105875 to depend on a bug targeting a version in 5.0.0 and in one of the following states: MODIFIED, ON_QA, VERIFIED, but no dependents were found

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does / why we need it:

This is a manual backport of #9296. The test code is slightly different due to helpers introduced by #8309 missing from the release-4.22 branch.

The Deployment set no securityContext, and kube-system is exempt from both SCC and Pod Security admission, so nothing assigned a UID and the cli image ran as root.

The workload only reads the ServiceAccount token (mode 0644) and curls an endpoint, so it needs none of those privileges.

The openshift.io/required-scc annotation was inert in kube-system, and once a UID is pinned it becomes a hazard: if that exemption ever changed, restricted-v2 (MustRunAsRange) would reject UID 1000 as outside the namespace uid-range and the checker would fail admission.

Pin RunAsUser to 1000 at the pod level and add the restricted container security context (no privilege escalation, read-only rootfs, RunAsNonRoot, drop ALL capabilities), matching konnectivity-agent, which solves the same problem in the same namespace.

Clear the required-scc annotation by setting the annotation map to nil rather than dropping the assignment, so it is also removed from Deployments created by earlier versions.

Extend the unit tests to assert the security context, invert the annotation assertion, and add the stale annotation to the pre-existing Deployment fixture so the upgrade path is exercised.

Which issue(s) this PR fixes:

Fixes OCPBUGS-105875

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Signed-off-by: Máté Lajkó mate.lajko@ibm.com
Commit-Message-Assisted-by: Claude (via Claude Code)
Co-Authored-By: Claude Opus 5 noreply@anthropic.com

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 8b9f91c6-59d5-4a95-b75b-432e743da359

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release and removed do-not-merge/needs-area labels Aug 15, 2026
@matlaj

matlaj commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

/verified by verifyKASCheckerSecurityContext, @matlaj

I deployed a hosted cluster with this change and confirmed the UID on the kas-connection-checker pods.

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Aug 15, 2026
@matlaj

matlaj commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

/auto-cc

@openshift-ci-robot

Copy link
Copy Markdown

@matlaj: This PR has been marked as verified by verifyKASCheckerSecurityContext,@matlaj.

Details

In response to this:

/verified by verifyKASCheckerSecurityContext, @matlaj

I deployed a hosted cluster with this change and confirmed the UID on the kas-connection-checker pods.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from cblecker and devguyio August 15, 2026 11:30
@matlaj
matlaj marked this pull request as ready for review August 15, 2026 11:30
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 15, 2026
@openshift-ci
openshift-ci Bot requested review from csrwng and muraee August 15, 2026 11:30
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.51%. Comparing base (605d002) to head (9f30e19).
⚠️ Report is 2 commits behind head on release-4.22.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-4.22    #9320      +/-   ##
================================================
+ Coverage         36.50%   36.51%   +0.01%     
================================================
  Files               777      777              
  Lines             95244    95265      +21     
================================================
+ Hits              34768    34789      +21     
  Misses            57637    57637              
  Partials           2839     2839              
Files with missing lines Coverage Δ
...rconfigoperator/controllers/resources/resources.go 51.15% <100.00%> (+0.35%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cblecker

Copy link
Copy Markdown
Member

/uncc

@openshift-ci
openshift-ci Bot removed the request for review from cblecker August 15, 2026 17:25

@rtheis rtheis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 15, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-azure-aks-external-oidc
/test e2e-azure-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@rtheis

rtheis commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

/test e2e-aks

@openshift-ci

openshift-ci Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

@matlaj: all tests passed!

Full PR test history. Your PR dashboard.

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.

@TwoDCube

Copy link
Copy Markdown
Member

/jira cherrypick OCPBUGS-105875

@openshift-ci-robot

Copy link
Copy Markdown

@TwoDCube: Jira Issue OCPBUGS-105875 has been cloned as Jira Issue OCPBUGS-111083. Will retitle bug to link to clone.
/retitle OCPBUGS-111083: [release-4.22] OCPBUGS-105875: fix(hcco): run kas-connection-checker as non-root

Details

In response to this:

/jira cherrypick OCPBUGS-105875

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot changed the title [release-4.22] OCPBUGS-105875: fix(hcco): run kas-connection-checker as non-root OCPBUGS-111083: [release-4.22] OCPBUGS-105875: fix(hcco): run kas-connection-checker as non-root Aug 16, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 16, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@matlaj: This pull request references Jira Issue OCPBUGS-111083, which is valid. The bug has been moved to the POST state.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-105875 is in the state Verified, which is one of the valid states (MODIFIED, ON_QA, VERIFIED)
  • dependent Jira Issue OCPBUGS-105875 targets the "5.0" version, which is one of the valid target versions: 5.0.0
  • bug has dependents

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does / why we need it:

This is a manual backport of #9296. The test code is slightly different due to helpers introduced by #8309 missing from the release-4.22 branch.

The Deployment set no securityContext, and kube-system is exempt from both SCC and Pod Security admission, so nothing assigned a UID and the cli image ran as root.

The workload only reads the ServiceAccount token (mode 0644) and curls an endpoint, so it needs none of those privileges.

The openshift.io/required-scc annotation was inert in kube-system, and once a UID is pinned it becomes a hazard: if that exemption ever changed, restricted-v2 (MustRunAsRange) would reject UID 1000 as outside the namespace uid-range and the checker would fail admission.

Pin RunAsUser to 1000 at the pod level and add the restricted container security context (no privilege escalation, read-only rootfs, RunAsNonRoot, drop ALL capabilities), matching konnectivity-agent, which solves the same problem in the same namespace.

Clear the required-scc annotation by setting the annotation map to nil rather than dropping the assignment, so it is also removed from Deployments created by earlier versions.

Extend the unit tests to assert the security context, invert the annotation assertion, and add the stale annotation to the pre-existing Deployment fixture so the upgrade path is exercised.

Which issue(s) this PR fixes:

Fixes OCPBUGS-105875

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Signed-off-by: Máté Lajkó mate.lajko@ibm.com
Commit-Message-Assisted-by: Claude (via Claude Code)
Co-Authored-By: Claude Opus 5 noreply@anthropic.com

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 openshift-eng/jira-lifecycle-plugin repository.

@TwoDCube

Copy link
Copy Markdown
Member

/retitle [release-4.22] OCPBUGS-111083: fix(hcco): run kas-connection-checker as non-root

@openshift-ci openshift-ci Bot changed the title OCPBUGS-111083: [release-4.22] OCPBUGS-105875: fix(hcco): run kas-connection-checker as non-root [release-4.22] OCPBUGS-111083: fix(hcco): run kas-connection-checker as non-root Aug 16, 2026
@muraee

muraee commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

/approve

@csrwng csrwng added approved Indicates a PR has been approved by an approver from all required OWNERS files. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. labels Aug 17, 2026
@openshift-ci

openshift-ci Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: matlaj, muraee, rtheis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit d6f475e into openshift:release-4.22 Aug 17, 2026
25 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@matlaj: Jira Issue Verification Checks: Jira Issue OCPBUGS-111083
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-111083 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

What this PR does / why we need it:

This is a manual backport of #9296. The test code is slightly different due to helpers introduced by #8309 missing from the release-4.22 branch.

The Deployment set no securityContext, and kube-system is exempt from both SCC and Pod Security admission, so nothing assigned a UID and the cli image ran as root.

The workload only reads the ServiceAccount token (mode 0644) and curls an endpoint, so it needs none of those privileges.

The openshift.io/required-scc annotation was inert in kube-system, and once a UID is pinned it becomes a hazard: if that exemption ever changed, restricted-v2 (MustRunAsRange) would reject UID 1000 as outside the namespace uid-range and the checker would fail admission.

Pin RunAsUser to 1000 at the pod level and add the restricted container security context (no privilege escalation, read-only rootfs, RunAsNonRoot, drop ALL capabilities), matching konnectivity-agent, which solves the same problem in the same namespace.

Clear the required-scc annotation by setting the annotation map to nil rather than dropping the assignment, so it is also removed from Deployments created by earlier versions.

Extend the unit tests to assert the security context, invert the annotation assertion, and add the stale annotation to the pre-existing Deployment fixture so the upgrade path is exercised.

Which issue(s) this PR fixes:

Fixes OCPBUGS-105875

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Signed-off-by: Máté Lajkó mate.lajko@ibm.com
Commit-Message-Assisted-by: Claude (via Claude Code)
Co-Authored-By: Claude Opus 5 noreply@anthropic.com

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 openshift-eng/jira-lifecycle-plugin repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants