Skip to content

NO-JIRA: machine-api-termination-handler: add scc annotation, terminationMessage: FallbackToLogsOnError#1494

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
damdo:term-handler-add-scc-log-to-err
May 4, 2026
Merged

NO-JIRA: machine-api-termination-handler: add scc annotation, terminationMessage: FallbackToLogsOnError#1494
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
damdo:term-handler-add-scc-log-to-err

Conversation

@damdo
Copy link
Copy Markdown
Member

@damdo damdo commented May 1, 2026

Summary by CodeRabbit

  • Chores
    • Applied required OpenShift security constraint to the termination-handler pod so it meets platform security requirements.
    • Updated termination behavior to prefer logs on errors for the termination-handler container, improving post-termination diagnostics and error visibility.

The termination-handler container was missing terminationMessagePolicy=FallbackToLogsOnError
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@damdo: This pull request explicitly references no jira issue.

Details

In response to this:

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-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 1, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a53626b3-026e-4fd3-8dbb-a539d011a099

📥 Commits

Reviewing files that changed from the base of the PR and between e527fdd and d787f6b.

📒 Files selected for processing (1)
  • pkg/operator/sync.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/operator/sync.go

Walkthrough

newTerminationPodTemplateSpec now clones the shared pod annotations and adds the OpenShift SCC annotation for the termination-handler Pod template. The termination-handler container spec now sets TerminationMessagePolicy to TerminationMessageFallbackToLogsOnError.

Changes

Termination Handler Pod Configuration

Layer / File(s) Summary
Annotation Mutation Fix
pkg/operator/sync.go
newTerminationPodTemplateSpec clones commonPodTemplateAnnotations (via maps.Clone) into a local annotations map and adds openshift.io/required-scc: machine-api-termination-handler to that clone.
Container Field
pkg/operator/sync.go
newTerminationContainers sets TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError on the termination-handler container.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the two main changes: adding the scc annotation and setting terminationMessage to FallbackToLogsOnError for the termination-handler.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR only modifies production code in sync.go; no Ginkgo test files are changed, so there are no test names to validate for stability.
Test Structure And Quality ✅ Passed This PR does not modify any Ginkgo test files, only production code in pkg/operator/sync.go. The custom check for Ginkgo test quality is not applicable.
Microshift Test Compatibility ✅ Passed PR modifies operator sync configuration code but does not add any new Ginkgo e2e tests, so the MicroShift compatibility check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The pull request adds no new Ginkgo e2e tests, only unit tests using the testing package and Gomega matchers.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds operational metadata and logging configuration without introducing scheduling constraints that would break SNO, Two-Node, TNA, or HyperShift topologies.
Ote Binary Stdout Contract ✅ Passed Changes are purely Kubernetes resource configuration (annotations and container settings) without process-level stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR modifies operator code only; no new Ginkgo e2e tests introduced, so custom check for IPv6 and disconnected network compatibility is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

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

@openshift-ci openshift-ci Bot requested review from mdbooth and nrb May 1, 2026 16:18
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/operator/sync.go`:
- Around line 1006-1011: The pod-template annotation map is being shared and
later mutated by ensureDependecyAnnotations, leaking deployment-specific
dependency-hash annotations into other pods; instead of relying on
maps.Clone(commonPodTemplateAnnotations) in only some places, ensure every use
creates an independent copy: replace any direct aliasing of
commonPodTemplateAnnotations (including where deployment pod templates are
created) with a fresh clone (e.g., call maps.Clone(commonPodTemplateAnnotations)
at each assignment site) or modify ensureDependecyAnnotations to accept and
mutate a copy rather than the original; update usages around
maps.Clone(commonPodTemplateAnnotations), commonPodTemplateAnnotations, and
ensureDependecyAnnotations so no shared map is passed into multiple pod
templates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 53476141-736e-49dd-b290-250edf49b3c7

📥 Commits

Reviewing files that changed from the base of the PR and between ddc3269 and e527fdd.

📒 Files selected for processing (1)
  • pkg/operator/sync.go

Comment thread pkg/operator/sync.go
@damdo
Copy link
Copy Markdown
Member Author

damdo commented May 4, 2026

/retest

pin the termination-handler DaemonSet pods to the dedicated
machine-api-termination-handler SCC using the openshift.io/required-scc annotation.

This makes the SCC binding explicit and prevents silent fallback to a different
SCC if admission ordering changes
@damdo damdo force-pushed the term-handler-add-scc-log-to-err branch from e527fdd to d787f6b Compare May 4, 2026 11:42
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 4, 2026

@damdo: 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.

2 similar comments
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 4, 2026

@damdo: 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.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 4, 2026

@damdo: 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.

@nrb
Copy link
Copy Markdown
Contributor

nrb commented May 4, 2026

/lgtm
/approve
/verified by checking CI artifacts and observing the SCC is retained

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 4, 2026
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 4, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@nrb: This PR has been marked as verified by checking CI artifacts and observing the SCC is retained.

Details

In response to this:

/lgtm
/approve
/verified by checking CI artifacts and observing the SCC is retained

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
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 4, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nrb

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-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit f35014d into openshift:main May 4, 2026
16 checks passed
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. 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.

3 participants