Skip to content

Commit 69c33b9

Browse files
stuggiolliewalsh
authored andcommitted
[tlse] Allow using custom tlsConfig.API.Public.SecretName when no ingress used
When also using LoadBalancer (MetalLB) for public endpoints this change allows to use the service configs tls.API.Public.SecretName to reference a secret holding a custom TLS cert. The secret must contain at least tls.key and tls.crt. The custom CA should be added to the bundle using the secret reference in the osctlplane crd.
1 parent 6e3dcbb commit 69c33b9

File tree

15 files changed

+35
-4
lines changed

15 files changed

+35
-4
lines changed

pkg/openstack/barbican.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr
8181
instance.Spec.Barbican.APIOverride,
8282
corev1beta1.OpenStackControlPlaneExposeBarbicanReadyCondition,
8383
false, // TODO: (mschuppert) could be removed when all integrated service support TLS
84+
instance.Spec.Barbican.Template.BarbicanAPI.TLS,
8485
)
8586
if err != nil {
8687
return ctrlResult, err

pkg/openstack/cinder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func ReconcileCinder(ctx context.Context, instance *corev1beta1.OpenStackControl
8383
instance.Spec.Cinder.APIOverride,
8484
corev1beta1.OpenStackControlPlaneExposeCinderReadyCondition,
8585
false, // TODO (mschuppert) could be removed when all integrated service support TLS
86+
instance.Spec.Cinder.Template.CinderAPI.TLS,
8687
)
8788
if err != nil {
8889
return ctrlResult, err

pkg/openstack/common.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ func EnsureEndpointConfig(
191191
ingressOverride corev1.Override,
192192
condType condition.Type,
193193
serviceTLSDisabled bool,
194+
tlsConfig tls.API,
194195
) (Endpoints, ctrl.Result, error) {
195196
endpoints := Endpoints{
196197
EndpointDetails: map[service.Endpoint]EndpointDetail{},
@@ -257,10 +258,8 @@ func EnsureEndpointConfig(
257258
// we'll use this for the service, otherwise issue a cert. This is for
258259
// use case where you deploy without ingress/routes and also use
259260
// a LoadBalancer (MetalLB) for the public endpoints.
260-
// TODO: (mschuppert) it should not be the cert secret from ingressOverride
261-
// instead should be the one from template.TLS.API.Public.SecretName.
262-
if !ed.Route.Create && (ingressOverride.TLS != nil && ingressOverride.TLS.SecretName != "") {
263-
ed.Service.TLS.SecretName = ptr.To(ingressOverride.TLS.SecretName)
261+
if !ed.Route.Create && (tlsConfig.API.Public.SecretName != nil && *tlsConfig.API.Public.SecretName != "") {
262+
ed.Service.TLS.SecretName = tlsConfig.API.Public.SecretName
264263
_, ctrlResult, err := ed.Service.TLS.GenericService.ValidateCertSecret(ctx, helper, instance.GetNamespace())
265264
if err != nil {
266265
return endpoints, ctrlResult, err

pkg/openstack/designate.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
88
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
99
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
10+
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
1011

1112
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
1213

@@ -76,6 +77,7 @@ func ReconcileDesignate(ctx context.Context, instance *corev1beta1.OpenStackCont
7677
instance.Spec.Designate.APIOverride,
7778
corev1beta1.OpenStackControlPlaneExposeDesignateReadyCondition,
7879
true, // TODO: (mschuppert) disable TLS for now until implemented
80+
tls.API{},
7981
)
8082
if err != nil {
8183
return ctrlResult, err

pkg/openstack/glance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl
115115
instance.Spec.Glance.APIOverride[name],
116116
corev1beta1.OpenStackControlPlaneExposeGlanceReadyCondition,
117117
false, // TODO (mschuppert) could be removed when all integrated service support TLS
118+
glanceAPI.TLS,
118119
)
119120
if err != nil {
120121
return ctrlResult, err

pkg/openstack/heat.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func ReconcileHeat(ctx context.Context, instance *corev1beta1.OpenStackControlPl
9696
instance.Spec.Heat.APIOverride,
9797
corev1beta1.OpenStackControlPlaneExposeHeatReadyCondition,
9898
false, // TODO (mschuppert) could be removed when all integrated service support TLS
99+
instance.Spec.Heat.Template.HeatAPI.TLS,
99100
)
100101
if err != nil {
101102
return ctrlResult, err
@@ -131,6 +132,7 @@ func ReconcileHeat(ctx context.Context, instance *corev1beta1.OpenStackControlPl
131132
instance.Spec.Heat.CnfAPIOverride,
132133
corev1beta1.OpenStackControlPlaneExposeHeatReadyCondition,
133134
false, // TODO (mschuppert) could be removed when all integrated service support TLS
135+
instance.Spec.Heat.Template.HeatCfnAPI.TLS,
134136
)
135137
if err != nil {
136138
return ctrlResult, err

pkg/openstack/horizon.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
88
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
99
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
10+
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
1011

1112
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
1213

@@ -84,6 +85,13 @@ func ReconcileHorizon(ctx context.Context, instance *corev1beta1.OpenStackContro
8485
instance.Spec.Horizon.APIOverride,
8586
corev1beta1.OpenStackControlPlaneExposeHorizonReadyCondition,
8687
false, // TODO (mschuppert) could be removed when all integrated service support TLS
88+
tls.API{
89+
API: tls.APIService{
90+
Public: tls.GenericService{
91+
SecretName: instance.Spec.Horizon.Template.TLS.SecretName,
92+
},
93+
},
94+
},
8795
)
8896
if err != nil {
8997
return ctrlResult, err

pkg/openstack/ironic.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func ReconcileIronic(ctx context.Context, instance *corev1beta1.OpenStackControl
9494
instance.Spec.Ironic.APIOverride,
9595
corev1beta1.OpenStackControlPlaneExposeIronicReadyCondition,
9696
false, // TODO (mschuppert) could be removed when all integrated service support TLS
97+
instance.Spec.Ironic.Template.IronicAPI.TLS,
9798
)
9899
if err != nil {
99100
return ctrlResult, err
@@ -130,6 +131,7 @@ func ReconcileIronic(ctx context.Context, instance *corev1beta1.OpenStackControl
130131
instance.Spec.Ironic.InspectorOverride,
131132
corev1beta1.OpenStackControlPlaneExposeIronicReadyCondition,
132133
false, // TODO (mschuppert) could be removed when all integrated service support TLS
134+
instance.Spec.Ironic.Template.IronicInspector.TLS,
133135
)
134136
if err != nil {
135137
return ctrlResult, err

pkg/openstack/keystone.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func ReconcileKeystoneAPI(ctx context.Context, instance *corev1beta1.OpenStackCo
8484
instance.Spec.Keystone.APIOverride,
8585
corev1beta1.OpenStackControlPlaneExposeKeystoneAPIReadyCondition,
8686
false, // TODO (mschuppert) could be removed when all integrated service support TLS
87+
instance.Spec.Keystone.Template.TLS,
8788
)
8889
if err != nil {
8990
return ctrlResult, err

pkg/openstack/manila.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func ReconcileManila(ctx context.Context, instance *corev1beta1.OpenStackControl
8484
instance.Spec.Manila.APIOverride,
8585
corev1beta1.OpenStackControlPlaneExposeManilaReadyCondition,
8686
false, // TODO: (mschuppert) could be removed when all integrated service support TLS
87+
instance.Spec.Manila.Template.ManilaAPI.TLS,
8788
)
8889
if err != nil {
8990
return ctrlResult, err

0 commit comments

Comments
 (0)