Skip to content

Commit

Permalink
Merge pull request #632 from d34dh0r53/tlse_barbican
Browse files Browse the repository at this point in the history
[tlse] internal TLS support for barbican
  • Loading branch information
openshift-merge-bot[bot] authored Feb 16, 2024
2 parents 9b67a28 + d02e0ea commit 91d2a8a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions pkg/openstack/barbican.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr
if instance.Spec.Barbican.Template.BarbicanAPI.Override.Service == nil {
instance.Spec.Barbican.Template.BarbicanAPI.Override.Service = map[service.Endpoint]service.RoutedOverrideSpec{}
}
instance.Spec.Barbican.Template.BarbicanAPI.Override.Service[endpointType] =
AddServiceComponentLabel(
instance.Spec.Barbican.Template.BarbicanAPI.Override.Service[endpointType],
barbican.Name)
instance.Spec.Barbican.Template.BarbicanAPI.Override.Service[endpointType] = AddServiceComponentLabel(
instance.Spec.Barbican.Template.BarbicanAPI.Override.Service[endpointType],
barbican.Name)
}

// When component services got created check if there is the need to create a route
Expand All @@ -55,6 +54,12 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr
}
}

// preserve any previously set TLS certs, set CA cert
if instance.Spec.TLS.Enabled(service.EndpointInternal) {
instance.Spec.Barbican.Template.BarbicanAPI.TLS = barbican.Spec.BarbicanAPI.TLS
}
instance.Spec.Barbican.Template.BarbicanAPI.TLS.CaBundleSecretName = instance.Status.TLS.CaBundleSecretName

if barbican.Status.Conditions.IsTrue(barbicanv1.BarbicanAPIReadyCondition) {
svcs, err := service.GetServicesListWithLabel(
ctx,
Expand All @@ -75,7 +80,7 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr
instance.Spec.Barbican.Template.BarbicanAPI.Override.Service,
instance.Spec.Barbican.APIOverride,
corev1beta1.OpenStackControlPlaneExposeBarbicanReadyCondition,
true, // TODO: (mschuppert) disable TLS for now until implemented
false, // TODO: (mschuppert) could be removed when all integrated service support TLS
)
if err != nil {
return ctrlResult, err
Expand All @@ -84,6 +89,10 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr
}

instance.Spec.Barbican.Template.BarbicanAPI.Override.Service = endpointDetails.GetEndpointServiceOverrides()

// update TLS settings with cert secret
instance.Spec.Barbican.Template.BarbicanAPI.TLS.API.Public.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointPublic)
instance.Spec.Barbican.Template.BarbicanAPI.TLS.API.Internal.SecretName = endpointDetails.GetEndptCertSecret(service.EndpointInternal)
}

helper.GetLogger().Info("Reconciling Barbican", "Barbican.Namespace", instance.Namespace, "Barbican.Name", "barbican")
Expand All @@ -97,8 +106,8 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr
barbican.Spec.NodeSelector = instance.Spec.NodeSelector
}
if barbican.Spec.DatabaseInstance == "" {
//barbican.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here
barbican.Spec.DatabaseInstance = "openstack" //FIXME: see above
// barbican.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here
barbican.Spec.DatabaseInstance = "openstack" // FIXME: see above
}

err := controllerutil.SetControllerReference(helper.GetBeforeObject(), barbican, helper.GetScheme())
Expand All @@ -107,7 +116,6 @@ func ReconcileBarbican(ctx context.Context, instance *corev1beta1.OpenStackContr
}
return nil
})

if err != nil {
instance.Status.Conditions.Set(condition.FalseCondition(
corev1beta1.OpenStackControlPlaneBarbicanReadyCondition,
Expand Down

0 comments on commit 91d2a8a

Please sign in to comment.