OCPNODE-4106: Propagate KubeletConfig TLS min version to CRI-O via ContainerRuntime #5672
All Vouch review confidence checks passed
Residual risk 0.45 = Change Risk (0.82) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.82 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.082
Real PR Conversation Timeline
1 comments
"Review active on #5672"
general
weight: 0.35
asahay19
What this PR does
This PR is part of the OCPSTRAT-2748 and epic OCPNODE-3916 initiative to enforce consistent TLS security policies across all OpenShift components. Today, when a cluster administrator sets a TLS security profile (via KubeletConfig or the cluster APIServer), the kubelet does it but CRI-O does not — leaving CRI-O's streaming and metrics servers with default TLS settings that may not meet the organization's security requirements.
The CRI-O side of this work has already been done and PR has been merged : https://github.com/cri-o/cri-o/pull/9723 , which added support for reading tls_min_version and tls_cipher_suites from CRI-O's drop-in configuration. Both PRs target OpenShift 4.22.
Right now, when an admin sets a TLS profile in KubeletConfig, the kubelet picks it up but CRI-O doesn't. This PR fixes that by generating a CRI-O drop-in file (/etc/crio/crio.conf.d/01-ctrcfg-tls) with the matching TLS version and ciphers. If no KubeletConfig sets TLS, it falls back to the cluster APIServer profile (default: Intermediate/TLS 1.2).
Reference: OCPNODE-4106
Background:
The ContainerRuntimeConfig controller now has a dedicated tlsQueue and syncTLSConfig handler, following the same pattern as kubelet_config_nodes.go. It watches KubeletConfig, APIServer, and MCP events, and for each pool generates a 99-<pool>-generated-containerruntime-tls MachineConfig with the CRI-O drop-in containing both tls_min_version and tls_cipher_suites .
This runs independently of ContainerRuntimeConfig CRs, so every pool gets TLS config even without any CTRCFGs defined. KubeletConfig takes priority; if none is set, it falls back to the APIServer profile (default: Intermediate/TLS 1.2). When multiple KubeletConfigs target the same pool, the most recently created one (greatertimestamp) wins.
At bootstrap, a separate RunTLSBootstrap function generates TLS MachineConfigs for all pools, called outside the ContainerRuntimeConfig block so TLS is propagated from the start.
The controller writes a TOML drop-in at /etc/crio/crio.conf.d/01-ctrcfg-tls containing the [crio.api] section with tls_min_version and tls_cipher_suites. CRI-O reads this on startup (or reload) and applies the settings to its streaming and metrics servers. For example, an Intermediate profile produces tls_min_version = "VersionTLS12" with the full set of IANA cipher suites, while a Modern profile produces tls_min_version = "VersionTLS13" with only TLS 1.3 ciphers.
Output
Locally tested all the unit test cases are Passing :
--- PASS: TestRunTLSBootstrap (0.00s)--- PASS: TestRunTLSBootstrap/NilKubeletConfigsAndNilAPIServer_FallsBackToIntermediate
--- PASS: TestRunTLSBootstrap/KubeletConfigCustomTLS13_OverridesAPIServer
--- PASS: TestRunTLSBootstrap/CustomProfileWithCiphers_PropagatesCipherSuites
--- PASS: TestRunTLSBootstrap/MCNameAndAnnotations
--- PASS: TestCreateCRIOTLSDropinFile (0.00s)
--- PASS: TestCreateCRIOTLSDropinFile/TLS_1.2_generates_drop-in
--- PASS: TestCreateCRIOTLSDropinFile/TLS_1.3_generates_drop-in
--- PASS: TestCreateCRIOTLSDropinFile/Empty_version_returns_error
--- PASS: TestCreateCRIOTLSDropinFile/TLS_1.2_with_cipher_suites
--- PASS: TestTLSConfigFromKubeletConfigs (0.00s)
--- PASS: TestTLSConfigFromKubeletConfigs/No_KubeletConfigs_returns_empty
--- PASS: TestTLSConfigFromKubeletConfigs/KubeletConfig_without_TLS_returns_empty
--- PASS: TestTLSConfigFromKubeletConfigs/KubeletConfig_with_TLS_1.3_matching_worker_pool
--- PASS: TestTLSConfigFromKubeletConfigs/KubeletConfig_with_TLS_targeting_different_pool_returns_empty
--- PASS: TestTLSConfigFromKubeletConfigs/KubeletConfig_with_TLS_matching_master_pool
--- PASS: TestTLSConfigFromKubeletConfigs/Multiple_matching_KubeletConfigs:_newest_wins
--- PASS: TestTLSConfigFromKubeletConfigs/Custom_profile_with_ciphers_returns_ciphers
--- PASS: TestTLSConfigFromKubeletConfigs/Intermediate_profile_returns_ciphers
--- PASS: TestKubeletConfigTLSPropagationToCRIO (20.30s)
--- PASS: TestKubeletConfigTLSPropagationToCRIO/APIServerFallback
--- PASS: TestKubeletConfigTLSPropagationToCRIO/CustomProfileTLS12WithCiphers
--- PASS: TestKubeletConfigTLSPropagationToCRIO/CustomProfileTLS13
--- PASS: TestKubeletConfigTLSPropagationToCRIO/IntermediateProfile
--- PASS: TestKubeletConfigTLSPropagationToCRIO/ModernProfile
--- PASS: TestKubeletConfigTLSPropagationToCRIO/RevertOnKubeletConfigDeletion
e2e test result
asahay@asahay-ubuntu:~/crio-test/machine-config-operator$ go test -v -timeout 30m -run TestKubeletConfigTLSPropagationToCRIO ./test/e2e-2of2/...=== RUN TestKubeletConfigTLSPropagationToCRIO
ctrcfg_test.go:400: Created empty MCP "tls-api-test" (no matching nodes)
ctrcfg_test.go:411: Found dedicated TLS MC "99-tls-api-test-generated-containerruntime-tls"
=== RUN TestKubeletConfigTLSPropagationToCRIO/APIServerFallback
ctrcfg_test.go:506: Verified: APIServer fallback includes cipher suites from Intermediate profile
=== RUN TestKubeletConfigTLSPropagationToCRIO/CustomProfileTLS12WithCiphers
ctrcfg_test.go:529: Verified: Custom profile with TLS 1.2 + specific ciphers propagated to CRI-O
=== RUN TestKubeletConfigTLSPropagationToCRIO/CustomProfileTLS13
ctrcfg_test.go:542: Verified: Custom profile with TLS 1.3 propagated to CRI-O
=== RUN TestKubeletConfigTLSPropagationToCRIO/IntermediateProfile
ctrcfg_test.go:554: Verified: Intermediate profile propagated TLS 1.2 + cipher suites to CRI-O
=== RUN TestKubeletConfigTLSPropagationToCRIO/ModernProfile
ctrcfg_test.go:562: Verified: Modern profile propagated TLS 1.3 to CRI-O
=== RUN TestKubeletConfigTLSPropagationToCRIO/RevertOnKubeletConfigDeletion
ctrcfg_test.go:573: Verified: Reverted to APIServer fallback with cipher suites after KubeletConfig deletion
--- PASS: TestKubeletConfigTLSPropagationToCRIO (20.34s)
--- PASS: TestKubeletConfigTLSPropagationToCRIO/APIServerFallback (0.02s)
--- PASS: TestKubeletConfigTLSPropagationToCRIO/CustomProfileTLS12WithCiphers (0.03s)
--- PASS: TestKubeletConfigTLSPropagationToCRIO/CustomProfileTLS13 (2.04s)
--- PASS: TestKubeletConfigTLSPropagationToCRIO/IntermediateProfile (2.05s)
--- PASS: TestKubeletConfigTLSPropagationToCRIO/ModernProfile (2.03s)
--- PASS: TestKubeletConfigTLSPropagationToCRIO/RevertOnKubeletConfigDeletion (2.03s)
PASS
ok github.com/openshift/machine-config-operator/test/e2e-2of2 20.415s
Pre-Merge Testing : https://issues.redhat.com/browse/OCPNODE-4113
Upgrade Testing : https://redhat.atlassian.net/browse/OCPNODE-4220
Functionality Testing : https://redhat.atlassian.net/browse/OCPNODE-4222
cc @ngopalak-redhat @bitoku @haircommander