Skip to content

Commit e64a43b

Browse files
fmountclaude
andcommitted
Inherit the cluster TLS security profile
This patch represents the first step toward OCPSTRAT-2611. The openstack-operator reads the TLSSecurityProfile from the OpenShift APIServer CR and publish it in a well-known ConfigMap that is used to inject global defaults to the underlying OpenStack services. This ConfigMap contains the Apache httpd directives (SSLCipherSuite and SSLProtocol), plus MinTLSVersion in neutral form for the services that are not httpd based. lib-common merges that ConfigMap with global TLS defaults underneath the ConfigOptions of every Template it renders. Sharing the constant with lib-common keeps producer and consumer from drifting on the object name. Acting on the keys stays opt-in per service: a Service asks for the common template it wants (e.g. ssl.conf in this case) and the service's httpd config has to Include the rendered file. This fearure is currently off by default, and gated on spec.tls.inheritClusterProfile, so a minor update does not change the TLS behavior. When the flag is set to false, the inheritance mechanism is not executed, and the TLSProfileReady condition is neither initialised nor set in the Status of the control plane CR. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 93eb209 commit e64a43b

12 files changed

Lines changed: 1630 additions & 4 deletions

File tree

‎api/bases/core.openstack.org_openstackcontrolplanes.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18684,6 +18684,9 @@ spec:
1868418684
default: true
1868518685
type: boolean
1868618686
type: object
18687+
inheritClusterProfile:
18688+
default: false
18689+
type: boolean
1868718690
podLevel:
1868818691
default:
1868918692
enabled: true

‎api/core/v1beta1/conditions.go‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ const (
108108
// OpenStackControlPlaneCustomTLSReadyCondition Status=True condition which indicates if custom TLS certificate secrets are configured and operational
109109
OpenStackControlPlaneCustomTLSReadyCondition condition.Type = "OpenStackControlPlaneCustomTLSReadyCondition"
110110

111+
// OpenStackControlPlaneTLSProfileReadyCondition Status=True condition which indicates if the APIServer TLS profile has been resolved and the SSL profile ConfigMap created
112+
OpenStackControlPlaneTLSProfileReadyCondition condition.Type = "OpenStackControlPlaneTLSProfileReady"
113+
111114
// OpenStackControlPlaneTelemetryReadyCondition Status=True condition which indicates if OpenStack Telemetry service is configured and operational
112115
OpenStackControlPlaneTelemetryReadyCondition condition.Type = "OpenStackControlPlaneTelemetryReady"
113116

@@ -483,6 +486,18 @@ const (
483486
// OpenStackControlPlaneCAReadyErrorMessage
484487
OpenStackControlPlaneCustomTLSReadyErrorMessage = "OpenStackControlPlane custom TLS cert secret %s error occured %s"
485488

489+
// OpenStackControlPlaneTLSProfileReadyInitMessage
490+
OpenStackControlPlaneTLSProfileReadyInitMessage = "OpenStackControlPlane TLS profile not started"
491+
492+
// OpenStackControlPlaneTLSProfileReadyMessage
493+
OpenStackControlPlaneTLSProfileReadyMessage = "OpenStackControlPlane TLS profile ConfigMap created"
494+
495+
// OpenStackControlPlaneTLSProfileReadyNoProfileMessage
496+
OpenStackControlPlaneTLSProfileReadyNoProfileMessage = "OpenStackControlPlane TLS profile not declared by the cluster, using built-in defaults"
497+
498+
// OpenStackControlPlaneTLSProfileReadyErrorMessage
499+
OpenStackControlPlaneTLSProfileReadyErrorMessage = "OpenStackControlPlane TLS profile error occured %s"
500+
486501
// OpenStackControlPlaneTestCMReadyErrorMessage
487502
OpenStackControlPlaneTestCMReadyErrorMessage = "OpenStackControlPlane Test Operator CM error occured %s"
488503

‎api/core/v1beta1/openstackcontrolplane_types.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ type TLSSection struct {
266266
// +kubebuilder:default={enabled: true, internal:{ca: {duration: "87600h"}, cert: {duration: "43800h"}}, libvirt: {ca: {duration: "87600h"}, cert: {duration: "43800h"}}, ovn: {ca: {duration: "87600h"}, cert: {duration: "43800h"}}}
267267
PodLevel TLSPodLevelConfig `json:"podLevel,omitempty"`
268268

269+
// +kubebuilder:validation:optional
270+
// +operator-sdk:csv:customresourcedefinitions:type=spec
271+
// InheritClusterProfile - Whether the OpenStack services should
272+
// inherit the cluster-wide TLS security profile from the OpenShift
273+
// APIServer. When false (the default), no profile is resolved or
274+
// published and the services keep the built-in defaults shipped
275+
// with lib-common.
276+
// +kubebuilder:default=false
277+
InheritClusterProfile bool `json:"inheritClusterProfile,omitempty"`
278+
269279
// +kubebuilder:validation:optional
270280
// +operator-sdk:csv:customresourcedefinitions:type=spec
271281
// Secret containing any additional CA certificates, which should be added to deployment pods.
@@ -1244,6 +1254,16 @@ func (instance *OpenStackControlPlane) InitConditions() {
12441254
cl.Set(condition.UnknownCondition(OpenStackControlPlaneWatcherReadyCondition, condition.InitReason, OpenStackControlPlaneWatcherReadyInitMessage))
12451255
}
12461256

1257+
// Init the TLS profile condition only when the control plane inherits the
1258+
// cluster profile. With inheritance off ReconcileTLSProfile removes it
1259+
// again, but it only gets that far on a full reconcile: an early return
1260+
// (minor update staging, CA requeue, first-pass finalizer) would otherwise
1261+
// persist an Unknown for a feature that is switched off, and drag the
1262+
// overall Ready condition down with it.
1263+
if instance.Spec.TLS.InheritClusterProfile {
1264+
cl.Set(condition.UnknownCondition(OpenStackControlPlaneTLSProfileReadyCondition, condition.InitReason, OpenStackControlPlaneTLSProfileReadyInitMessage))
1265+
}
1266+
12471267
// Init Topology condition if there's a reference
12481268
if instance.Spec.TopologyRef != nil {
12491269
cl.Set(condition.UnknownCondition(condition.TopologyReadyCondition, condition.InitReason, condition.TopologyReadyInitMessage))

‎bindata/crds/crds.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19218,6 +19218,9 @@ spec:
1921819218
default: true
1921919219
type: boolean
1922019220
type: object
19221+
inheritClusterProfile:
19222+
default: false
19223+
type: boolean
1922119224
podLevel:
1922219225
default:
1922319226
enabled: true

0 commit comments

Comments
 (0)