Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions api/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20089,6 +20089,14 @@ spec:
type: object
type: object
type: object
profile:
default: None
enum:
- None
- Inherit
- Intermediate
- Modern
type: string
type: object
topologyRef:
properties:
Expand Down
20 changes: 20 additions & 0 deletions api/core/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ const (
// OpenStackControlPlaneCustomTLSReadyCondition Status=True condition which indicates if custom TLS certificate secrets are configured and operational
OpenStackControlPlaneCustomTLSReadyCondition condition.Type = "OpenStackControlPlaneCustomTLSReadyCondition"

// OpenStackControlPlaneTLSProfileReadyCondition Status=True condition which indicates if the APIServer TLS profile has been resolved and the SSL profile ConfigMap created
OpenStackControlPlaneTLSProfileReadyCondition condition.Type = "OpenStackControlPlaneTLSProfileReady"

// OpenStackControlPlaneTelemetryReadyCondition Status=True condition which indicates if OpenStack Telemetry service is configured and operational
OpenStackControlPlaneTelemetryReadyCondition condition.Type = "OpenStackControlPlaneTelemetryReady"

Expand Down Expand Up @@ -489,6 +492,23 @@ const (
// OpenStackControlPlaneCAReadyErrorMessage
OpenStackControlPlaneCustomTLSReadyErrorMessage = "OpenStackControlPlane custom TLS cert secret %s error occured %s"

// OpenStackControlPlaneTLSProfileReadyInitMessage
OpenStackControlPlaneTLSProfileReadyInitMessage = "OpenStackControlPlane TLS profile not started"

// OpenStackControlPlaneTLSProfileReadyMessage
OpenStackControlPlaneTLSProfileReadyMessage = "OpenStackControlPlane TLS profile ConfigMap created"

// OpenStackControlPlaneTLSProfileReadyNoProfileMessage
OpenStackControlPlaneTLSProfileReadyNoProfileMessage = "OpenStackControlPlane TLS profile not declared by the cluster, using built-in defaults"

// OpenStackControlPlaneTLSProfileReadyErrorMessage
OpenStackControlPlaneTLSProfileReadyErrorMessage = "OpenStackControlPlane TLS profile error occurred %s"

// OpenStackControlPlaneTLSProfileReadyInvalidMessage - names both remedies,
// since only a human editing one of the two CRs can resolve it
OpenStackControlPlaneTLSProfileReadyInvalidMessage = "OpenStackControlPlane TLS profile cannot be resolved: %s. " +
"Set spec.tls.profile to None, Inherit, Intermediate or Modern, or correct the TLS security profile on the cluster APIServer CR"

// OpenStackControlPlaneTestCMReadyErrorMessage
OpenStackControlPlaneTestCMReadyErrorMessage = "OpenStackControlPlane Test Operator CM error occured %s"

Expand Down
49 changes: 49 additions & 0 deletions api/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ type TLSSection struct {
// +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"}}}
PodLevel TLSPodLevelConfig `json:"podLevel,omitempty"`

// +kubebuilder:validation:optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Profile - The TLS security profile the OpenStack services are
// configured with. "None" (the default) publishes nothing, so the services
// keep lib-common's built-in defaults. "Inherit" follows whatever the
// cluster declares on the OpenShift APIServer CR. "Intermediate" and
// "Modern" pin that profile regardless of what the cluster declares.
// +kubebuilder:default=None
Profile TLSProfileType `json:"profile,omitempty"`

// +kubebuilder:validation:optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Secret containing any additional CA certificates, which should be added to deployment pods.
Expand All @@ -280,6 +290,37 @@ type TLSSection struct {
tls.Ca `json:",inline"`
}

// TLSProfileType - the TLS security profile the OpenStack services are
// configured with, either sourced from the cluster or named here directly.
// The named values are spelled out rather than taken from configv1 so this
// module keeps openshift/api indirect; the functional tests pin the spelling.
// "Old" is not offered, but stays reachable through "Inherit" when the
// cluster itself declares it.
// +kubebuilder:validation:Enum=None;Inherit;Intermediate;Modern
type TLSProfileType string

const (
// TLSProfileNone - publish nothing; the services keep lib-common's defaults.
TLSProfileNone TLSProfileType = "None"

// TLSProfileInherit - follow the profile the cluster declares on the APIServer CR.
TLSProfileInherit TLSProfileType = "Inherit"

// TLSProfileIntermediate - pin the OpenShift Intermediate profile.
TLSProfileIntermediate TLSProfileType = "Intermediate"

// TLSProfileModern - pin the OpenShift Modern profile.
TLSProfileModern TLSProfileType = "Modern"
)

// IsEnabled - whether a profile is requested at all. InitConditions and
// ReconcileTLSProfile have to agree on this, or an early-returning reconcile
// leaves an Unknown condition behind for a feature that is off. An unset
// value counts as None.
func (p TLSProfileType) IsEnabled() bool {
return p != TLSProfileNone && p != ""
}

// TLSIngressConfig defines the desired state of the TLS configuration for the ingress configuration (route)
type TLSIngressConfig struct {
// +kubebuilder:validation:Optional
Expand Down Expand Up @@ -1279,6 +1320,14 @@ func (instance *OpenStackControlPlane) InitConditions() {
cl.Set(condition.UnknownCondition(OpenStackControlPlaneCyborgReadyCondition, condition.InitReason, OpenStackControlPlaneCyborgReadyInitMessage))
}

// Only register the condition when a profile is requested: in None mode
// ReconcileTLSProfile removes it again, but an early return (minor update
// staging, CA requeue, first-pass finalizer) never gets that far and would
// persist an Unknown for a feature that is off.
if instance.Spec.TLS.Profile.IsEnabled() {
cl.Set(condition.UnknownCondition(OpenStackControlPlaneTLSProfileReadyCondition, condition.InitReason, OpenStackControlPlaneTLSProfileReadyInitMessage))
}

// Init Topology condition if there's a reference
if instance.Spec.TopologyRef != nil {
cl.Set(condition.UnknownCondition(condition.TopologyReadyCondition, condition.InitReason, condition.TopologyReadyInitMessage))
Expand Down
8 changes: 8 additions & 0 deletions bindata/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21118,6 +21118,14 @@ spec:
type: object
type: object
type: object
profile:
default: None
enum:
- None
- Inherit
- Intermediate
- Modern
type: string
type: object
topologyRef:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20089,6 +20089,14 @@ spec:
type: object
type: object
type: object
profile:
default: None
enum:
- None
- Inherit
- Intermediate
- Modern
type: string
type: object
topologyRef:
properties:
Expand Down
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ rules:
- apiGroups:
- config.openshift.io
resources:
- apiservers
- clusterimagepolicies
- clusteroperators
- clusterversions
Expand Down
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,7 @@ replace k8s.io/component-base => k8s.io/component-base v0.33.13 //allow-merging
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20250627150254-e9823e99808e //allow-merging

replace github.com/cert-manager/cmctl/v2 => github.com/cert-manager/cmctl/v2 v2.3.0 //allow-merging

replace github.com/openstack-k8s-operators/lib-common/modules/common => github.com/fmount/lib-common/modules/common v0.0.0-20261119133733-b9adb5ae4b86

replace github.com/openstack-k8s-operators/lib-common/modules/test => github.com/fmount/lib-common/modules/test v0.0.0-20261119133733-b9adb5ae4b86
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjT
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fmount/lib-common/modules/common v0.0.0-20261119133733-b9adb5ae4b86 h1:0JCqFK0RBAj2Uipd0w9RzTe06qjooSZ13nEHd8FgBNc=
github.com/fmount/lib-common/modules/common v0.0.0-20261119133733-b9adb5ae4b86/go.mod h1:Bs95wrakWtl9bWhWVIuN54hE8+IILqRU0QH+/AjGlDo=
github.com/fmount/lib-common/modules/test v0.0.0-20261119133733-b9adb5ae4b86 h1:TabLXSNTtKh0fSJXC4tlyd+10RW5GdPFaRAtKBc8IUw=
github.com/fmount/lib-common/modules/test v0.0.0-20261119133733-b9adb5ae4b86/go.mod h1:n8vhem98f8sW/Yd4KFmngEHA04kWWNI/WZ9mTG9tOSo=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
Expand Down Expand Up @@ -180,14 +184,10 @@ github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.202611130
github.com/openstack-k8s-operators/lib-common/modules/ansible v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:TkZgZE92VUKHHNKXwuV8b7tT9toaxsZkcGffRafKCSA=
github.com/openstack-k8s-operators/lib-common/modules/certmanager v0.6.1-0.20261113070913-5152d1d626f9 h1:2fbgvf5Vm4CyTkXWFlmIw0aGzyJjO/SNqLf3dnBx0BE=
github.com/openstack-k8s-operators/lib-common/modules/certmanager v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:Br9qj00P2UzWFrtlcSrxBd4eG8fXtRX9h3IN8k5iJGw=
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9 h1:SnR2m0LHH1k+qHT1HSwwx5c7Lc6r1U8PIQpiUj60qrw=
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:Bs95wrakWtl9bWhWVIuN54hE8+IILqRU0QH+/AjGlDo=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20261113070913-5152d1d626f9 h1:lgbKoe9iibFLovaVKqbO6RzcTFhzD7hWW9slJr4TCpE=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:Jd4fWlkX+mMlAyY4I8TM1NAc2EJVUbJNmtKLIuXvBq0=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20261113070913-5152d1d626f9 h1:IU4OU1ECIN0XGdHpK3u+Z5sfVGKlYVP5oArTVoilC/4=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:a7cwXeo63Ce+d/BoQnfK5Qnwxi6B18F7zZlRvSd4XXA=
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261113070913-5152d1d626f9 h1:zdLGDWn8gHxLR6DgZmfq3pXx7Z7/27Uz2Ua/093K7Ks=
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:n8vhem98f8sW/Yd4KFmngEHA04kWWNI/WZ9mTG9tOSo=
github.com/openstack-k8s-operators/lib-common/modules/users v0.0.0-20261113070913-5152d1d626f9 h1:jnyHfNDI76L31tZqsCO8DyfcB8AdAL8RQsq4UnZeZKE=
github.com/openstack-k8s-operators/lib-common/modules/users v0.0.0-20261113070913-5152d1d626f9/go.mod h1:jmVVRfwuFQ3fHLIOAkUrtLgOwEL6j45POzS3PBJuwyM=
github.com/openstack-k8s-operators/manila-operator/api v0.6.1-0.20261114142025-35eaf5975501 h1:o8NXVjmKsfufK53f+hKlTxXy83bJ4csSjX/RFHEiRDM=
Expand Down
28 changes: 28 additions & 0 deletions internal/controller/core/openstackcontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"time"

certmgrv1 "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
configv1 "github.com/openshift/api/config/v1"
routev1 "github.com/openshift/api/route/v1"
barbicanv1 "github.com/openstack-k8s-operators/barbican-operator/api/v1beta1"
cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
Expand All @@ -43,6 +44,7 @@ import (
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
common_helper "github.com/openstack-k8s-operators/lib-common/modules/common/helper"
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
"github.com/openstack-k8s-operators/lib-common/modules/common/webhook"
cyborgv1 "github.com/openstack-k8s-operators/nova-operator/api/cyborg/v1beta1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -130,9 +132,11 @@ func (r *OpenStackControlPlaneReconciler) GetLogger(ctx context.Context) logr.Lo
// +kubebuilder:rbac:groups=route.openshift.io,resources=routes/custom-host,verbs=create;update;patch
// +kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch
// +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch;create;update;patch;delete;
// +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete;
// +kubebuilder:rbac:groups=cert-manager.io,resources=issuers,verbs=get;list;watch;create;update;patch;delete;
// +kubebuilder:rbac:groups=cert-manager.io,resources=certificates,verbs=get;list;watch;create;update;patch;delete;
// +kubebuilder:rbac:groups=config.openshift.io,resources=networks,verbs=get;list;watch;
// +kubebuilder:rbac:groups=config.openshift.io,resources=apiservers,verbs=get;list;watch;
// +kubebuilder:rbac:groups=topology.openstack.org,resources=topologies,verbs=get;list;watch;update
// +kubebuilder:rbac:groups=watcher.openstack.org,resources=watchers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cyborg.openstack.org,resources=cyborgs,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -546,6 +550,13 @@ func (r *OpenStackControlPlaneReconciler) reconcileNormal(ctx context.Context, i
return ctrlResult, nil
}

ctrlResult, err = openstack.ReconcileTLSProfile(ctx, instance, helper)
if err != nil {
return ctrl.Result{}, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

ctrlResult, err = openstack.ReconcileDNSMasqs(ctx, instance, version, helper)
if err != nil {
return ctrl.Result{}, err
Expand Down Expand Up @@ -933,6 +944,23 @@ func (r *OpenStackControlPlaneReconciler) SetupWithManager(
handler.EnqueueRequestsFromMapFunc(r.findControlPlaneForSrc),
builder.WithPredicates(openstack.ServicePortOrTypeChangedPredicate()),
).
Watches(
&configv1.APIServer{},
handler.EnqueueRequestsFromMapFunc(r.findControlPlaneForSrc),
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}),
).
// The operator owns the full lifecycle of the TLS profile ConfigMap:
// if it is deleted or edited out from under it, a reconcile has to
// put it back. Without this watch, a removed ConfigMap would stay
// gone until some unrelated event happened to reconcile the
// control plane again.
Watches(
&corev1.ConfigMap{},
handler.EnqueueRequestsFromMapFunc(r.findControlPlaneForSrc),
builder.WithPredicates(predicate.NewPredicateFuncs(func(obj client.Object) bool {
return obj.GetName() == util.TLSProfileConfigMap
})),
).
Complete(r)
}

Expand Down
Loading
Loading