Skip to content

Enable auto-registration when Rancher Prime is deployed via Helm with registration code#126

Merged
susesamu merged 9 commits into
rancher:mainfrom
susesamu:125-label
Jul 9, 2026
Merged

Enable auto-registration when Rancher Prime is deployed via Helm with registration code#126
susesamu merged 9 commits into
rancher:mainfrom
susesamu:125-label

Conversation

@susesamu

@susesamu susesamu commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

issue: #125

Fixes automatic SCC registration when Rancher Prime is installed via Helm with registration.enabled=true and registration.regCode set.

Previously, the operator would skip processing the scc-registration Secret created by Helm due to a label ownership conflict (Helm sets app.kubernetes.io/managed-by: Helm, but the operator expected rancher-scc-operator).

…tion code

Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
@susesamu
susesamu requested a review from a team as a code owner July 8, 2026 14:43
@susesamu
susesamu requested a review from Copilot July 8, 2026 14:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes automatic SCC registration when Rancher Prime is installed via Helm with registration.enabled=true and registration.regCode by adjusting how the operator determines whether it should process the Helm-created scc-registration Secret, avoiding conflicts with Helm’s app.kubernetes.io/managed-by: Helm label.

Changes:

  • Preserve (do not overwrite) the existing app.kubernetes.io/managed-by label on Helm-created entrypoint Secrets while still allowing the operator to process them.
  • Introduce SCC-specific ownership helpers (scc.cattle.io/managed-by) and associated unit tests.
  • Replace maps.Copy label merges in the Secret controller with explicit merge logic.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
pkg/controllers/resources.go Updates registration param extraction/label production to preserve existing k8s managed-by.
pkg/controllers/helpers/ownership.go Adds SCC-specific ownership helpers and management decision logic.
pkg/controllers/helpers/ownership_scc_test.go Adds unit tests for the new SCC-specific ownership helpers.
pkg/controllers/controller.go Updates Secret reconciliation to use SCC ownership rules for Helm entrypoint secrets and preserve Helm’s managed-by label during label merges.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/controllers/resources.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/resources.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>

@mallardduck mallardduck left a comment

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.

Just a few more nits - great work

Comment thread pkg/controllers/controller.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/controller.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/helpers/ownership.go
Comment thread pkg/controllers/helpers/ownership.go
Comment thread pkg/controllers/controller.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>

@mallardduck mallardduck left a comment

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.

lgtm, if @alemorcuq also approves we can merge in the AM

Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/helpers/ownership_test.go
Comment thread pkg/controllers/controller.go
Comment thread pkg/controllers/helpers/ownership.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>

@alemorcuq alemorcuq left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, great work.

Comment thread pkg/controllers/helpers/ownership.go Outdated
Comment thread pkg/controllers/helpers/ownership.go Outdated
Signed-off-by: Samuel Vasconcelos <samuel.vasconcelos@suse.com>
@susesamu
susesamu merged commit a2ad950 into rancher:main Jul 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants