Skip to content

Commit 600d7a8

Browse files
committed
[tls] add OpenStackControlPlaneCustomTLSReadyCondition
Adds OpenStackControlPlaneCustomTLSReadyCondition to be used when custom TLS certificates are used. * If the custom cert secret is not available the condition is set. * If no custom cert secret is used, the condition won't be added to the condition list.
1 parent a729193 commit 600d7a8

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎apis/core/v1beta1/conditions.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ const (
105105
// OpenStackControlPlaneCAReadyCondition Status=True condition which indicates if the CAs are configured and operational
106106
OpenStackControlPlaneCAReadyCondition condition.Type = "OpenStackControlPlaneCAReadyCondition"
107107

108+
// OpenStackControlPlaneCustomTLSReadyCondition Status=True condition which indicates if custom TLS certificate secrets are configured and operational
109+
OpenStackControlPlaneCustomTLSReadyCondition condition.Type = "OpenStackControlPlaneCustomTLSReadyCondition"
110+
108111
// OpenStackControlPlaneTelemetryReadyCondition Status=True condition which indicates if OpenStack Telemetry service is configured and operational
109112
OpenStackControlPlaneTelemetryReadyCondition condition.Type = "OpenStackControlPlaneTelemetryReady"
110113

@@ -420,6 +423,12 @@ const (
420423

421424
// OpenStackControlPlaneCAReadyErrorMessage
422425
OpenStackControlPlaneCAReadyErrorMessage = "OpenStackControlPlane CAs %s %s error occured %s"
426+
427+
// OpenStackControlPlaneCAReadyMessage
428+
OpenStackControlPlaneCustomTLSReadyMessage = "OpenStackControlPlane custom TLS cert secret available"
429+
430+
// OpenStackControlPlaneCAReadyErrorMessage
431+
OpenStackControlPlaneCustomTLSReadyErrorMessage = "OpenStackControlPlane custom TLS cert secret %s error occured %s"
423432
)
424433

425434
// Version Conditions used by API objects.

‎pkg/openstack/common.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,20 @@ func EnsureEndpointConfig(
243243
validateSecret := &tls.GenericService{SecretName: ed.Route.TLS.SecretName}
244244
_, ctrlResult, err := validateSecret.ValidateCertSecret(ctx, helper, instance.GetNamespace())
245245
if err != nil {
246+
instance.Status.Conditions.Set(condition.FalseCondition(
247+
corev1.OpenStackControlPlaneCustomTLSReadyCondition,
248+
condition.ErrorReason,
249+
condition.SeverityWarning,
250+
corev1.OpenStackControlPlaneCustomTLSReadyErrorMessage,
251+
ingressOverride.TLS.SecretName,
252+
err.Error()))
253+
246254
return endpoints, ctrlResult, err
247255
} else if (ctrlResult != ctrl.Result{}) {
248256
return endpoints, ctrlResult, nil
249257
}
258+
instance.Status.Conditions.MarkTrue(corev1.OpenStackControlPlaneCustomTLSReadyCondition,
259+
corev1.OpenStackControlPlaneCustomTLSReadyMessage)
250260
} else {
251261
ed.Route.TLS.IssuerName = instance.GetPublicIssuer()
252262
}

0 commit comments

Comments
 (0)