Skip to content

WINC-1988: TLS profile adherence - #4340

Draft
mansikulkarni96 wants to merge 2 commits into
openshift:masterfrom
mansikulkarni96:tls_profile
Draft

WINC-1988: TLS profile adherence#4340
mansikulkarni96 wants to merge 2 commits into
openshift:masterfrom
mansikulkarni96:tls_profile

Conversation

@mansikulkarni96

@mansikulkarni96 mansikulkarni96 commented Jul 17, 2026

Copy link
Copy Markdown
Member

Add TLS strict obedience for PQC readiness
Fetch TLS configuration from cluster APIServer and apply to metrics server.
Watch for TLS profile changes and restart pod to reload config.
Uses SecurityProfileWatcher from controller-runtime-common following the pattern from machine-api-operator. Satisfies OpenShift 5.0 TLS.
Strict Obedience requirement for centralized TLS management.

@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 Jul 17, 2026
@openshift-ci

openshift-ci Bot commented Jul 17, 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

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Excluded labels (none allowed) (2)
  • do-not-merge/work-in-progress
  • do-not-merge/hold

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: Pro Plus

Run ID: 22148a94-0136-4639-9055-721d92803294

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mansikulkarni96

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 Jul 17, 2026
@mansikulkarni96 mansikulkarni96 changed the title TLS profile adherence WINC-1988: TLS profile adherence Jul 17, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 17, 2026

Copy link
Copy Markdown

@mansikulkarni96: This pull request references WINC-1988 which is a valid 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 Jul 17, 2026
@mansikulkarni96

Copy link
Copy Markdown
Member Author

@code-rabbit review

@mansikulkarni96

Copy link
Copy Markdown
Member Author

@code-rabbit full review

@mansikulkarni96

Copy link
Copy Markdown
Member Author

/test aws-e2e-operator

@mansikulkarni96
mansikulkarni96 requested a review from jrvaldes July 17, 2026 16:38
@jrvaldes

Copy link
Copy Markdown
Contributor

/test lint

@openshift-ci

openshift-ci Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

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

Test name Commit Details Required Rerun command
ci/prow/aws-e2e-operator 527f1be link true /test aws-e2e-operator
ci/prow/lint 527f1be link true /test lint

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.

@jrvaldes jrvaldes 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.

@mansikulkarni96 thanks for working on this, mostly LGTM.

PTAL at the comments.

Comment thread cmd/operator/main.go Outdated
// get cluster configuration
ctx := ctrl.SetupSignalHandler()

// Fetch TLS configuration from APIServer for PQC readiness (OpenShift 4.22 requirement)

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.

(OpenShift 4.22 requirement)

does this mean the feature must be backported?

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.

no this requirement is moved to 5.0, updated.

Comment thread cmd/operator/main.go Outdated
ctx := ctrl.SetupSignalHandler()

// Fetch TLS configuration from APIServer for PQC readiness (OpenShift 4.22 requirement)
setupLog.Info("fetching TLS configuration from cluster APIServer")

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.

consider debug log for this entry

Comment thread cmd/operator/main.go
Comment thread cmd/operator/main.go
Comment thread cmd/operator/main.go

// Convert TLS profile to config function
tlsConfigFn, unsupportedCiphers := tlspkg.NewTLSConfigFromProfile(tlsProfile)
if len(unsupportedCiphers) > 0 {

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.

should this log a WARN instead?

Comment thread cmd/operator/main.go
}

setupLog.Info("TLS configuration loaded",
"minVersion", tlsProfile.MinTLSVersion,

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.

windows-exporter may need min_version and cipher_suites on it TLS configuration
as it serve metrics over HTTPS

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.

not a blocker, consider a separate PR/jira for this.

Comment thread cmd/operator/main.go
// cache type.
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: metricsserver.Options{

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.

the proposal only sets MinVersion and CipherSuites. It does not set NextProtos. Without this, the metrics server falls back to Go's default
ALPN behavior (which is implementation-defined per Go version).

The doc reference explicitly states:
▎ Set NextProtos / ALPN yourself — the cluster profile does not set it.

https://docs.google.com/document/d/1NoHP2nZdg-xUkcB2y2BtI8469-iicdSG7xJwRad4kF0/edit?tab=t.d6wz8lyxdzg1#heading=h.y3v2qj7yid7t

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.

controller-runtime's metrics server already sets NextProtos: []string{"h2"} in server.go:279 before calling our TLSOpts function. Since NewTLSConfigFromProfile only sets MinVersion and CipherSuites, the
existing NextProtos is preserved. No additional setting needed on our side.

Comment thread cmd/operator/main.go Outdated
setupLog.Info("TLS security profile changed, pod will restart",
"oldMinVersion", oldProfile.MinTLSVersion,
"newMinVersion", newProfile.MinTLSVersion)
os.Exit(0) // Graceful exit - Kubernetes will restart pod

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.

os.Exit does not run deferred functions. All ongoing node configuration, FTP transfers, Windows service management is abandoned
without cleanup. This can leave Windows nodes partially configured.

consider using context cancellation, which allows mgr.Start(ctx) to return cleanly, running all deferred cleanup registered with the manager.

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.

updated

Comment thread cmd/operator/main.go
SecureServing: true,
FilterProvider: filters.WithAuthenticationAndAuthorization,
TLSOpts: []func(*tls.Config){tlsConfigFn}, // Apply cluster TLS profile
},

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.

curve preferences PR merged, consider setting CurvePreferences to include X25519MLKEM768 for post-quantum key exchange

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.

only the enhancement merged, implementation is pending https://github.com/openshift/controller-runtime-common/pull/22/changes

Comment thread cmd/operator/main.go
// Watches for TLS profile or adherence policy changes and restarts pod to reload config
setupLog.Info("setting up TLS security profile watcher")
tlsWatcher := &tlspkg.SecurityProfileWatcher{
Client: mgr.GetClient(),

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.

The PR creates cl, err := client.New(cfg, client.Options{}) exclusively for the initial TLS fetch, then discards it. The manager creates its own
internal client. The early client uses no cache (direct API server calls) which is correct for the pre-start fetch, but the two clients represent different connection pools.

Consider passing the pre-fetched values as parameters rather than creating a second client

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.

updated

Fetch TLS configuration from cluster APIServer and apply to metrics
server. Watch for TLS profile changes and restart pod to reload config.
Uses SecurityProfileWatcher from controller-runtime-common following
the pattern from machine-api-operator. Satisfies OpenShift 5.0 TLS
Strict Obedience requirement for centralized TLS management.
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants