Skip to content

Commit

Permalink
[TLS] Fix enable/disable of tls configuration
Browse files Browse the repository at this point in the history
The following is the current expected behavior:
* When TLS was enable and gets disabled previous created certificates
won't get deleted.

* adding additional custom CA certs can only be passed to the
services if tls is enabled, otherwise CA bundle creation will be
skipped and no bundle will be passed to the service CAs. Right now
the default is to have TLS enabled for at least routes.

Jira: OSPRH-3268
  • Loading branch information
stuggi committed Jan 31, 2024
1 parent 17221c0 commit 10a03d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ func SetupDefaults() {
// Enabled - returns status of tls configuration for the passed in endpoint type
func (t *TLSSection) Enabled(endpt service.Endpoint) bool {
if t != nil {
if cfg, ok := t.Endpoint[service.EndpointInternal]; ok && cfg.Enabled {
if cfg, ok := t.Endpoint[endpt]; ok && cfg.Enabled {
return true
}
}
Expand Down
19 changes: 9 additions & 10 deletions pkg/openstack/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@ func ReconcileCAs(ctx context.Context, instance *corev1.OpenStackControlPlane, h
instance.GetNamespace(),
map[string]string{},
)
/*
// Cleanuo?
if !instance.Spec.TLS.Enabled {
if err := cert.Delete(ctx, helper); err != nil {
return ctrl.Result{}, err
}
instance.Status.Conditions.Remove(corev1beta1.OpenStackControlPlaneCAsReadyCondition)

return ctrl.Result{}, nil
}
*/
// Note (mschuppert) - right now additional custom CA certs can only be passed to the services if
// tls is enabled, otherwise CA bundle creation will be skipped and no bundle will be passed to the
// service CAs.
if !instance.Spec.TLS.Enabled(service.EndpointInternal) && !instance.Spec.TLS.Enabled(service.EndpointPublic) {
// we are not deleting certificates if tls gets disabled
instance.Status.Conditions.Remove(corev1.OpenStackControlPlaneCAReadyCondition)

return ctrl.Result{}, nil
}

helper.GetLogger().Info("Reconciling CAs", "Namespace", instance.Namespace, "Name", issuerReq.Name)

Expand Down

0 comments on commit 10a03d9

Please sign in to comment.