Skip to content

Commit edabd43

Browse files
committed
Trust OpenShift service CA via combined-ca-bundle, not a per-assistant copy
The assistant must trust its Lightspeed backend, whose in-cluster service is secured by an OpenShift service-serving certificate signed by the OpenShift service CA. Previously the assistant controller built its own combined bundle (source CA plus the injected service CA) in a dedicated Secret and watched the service-CA ConfigMap to keep it fresh. Fold the OpenShift service CA into the control plane's shared combined-ca-bundle in ReconcileCAs instead. Consumers that already mount combined-ca-bundle, including the assistant, then trust service-serving endpoints with no per-assistant bundle. The ConfigMap is namespace-injected by OpenShift and absent on plain Kubernetes, so a NotFound is a no-op, and it is added to the full bundle only, not the internal-issuer-only bundle. Remove the now-unused assistant-owned bundle: delete ca_bundle.go and its test, and drop reconcileCABundle and the service-CA ConfigMap watch from the assistant controller.
1 parent dbd14aa commit edabd43

4 files changed

Lines changed: 40 additions & 358 deletions

File tree

‎internal/controller/assistant/ca_bundle.go‎

Lines changed: 0 additions & 153 deletions
This file was deleted.

‎internal/controller/assistant/ca_bundle_test.go‎

Lines changed: 0 additions & 179 deletions
This file was deleted.

‎internal/controller/assistant/openstackassistant_controller.go‎

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ func (r *OpenStackAssistantReconciler) Reconcile(ctx context.Context, req ctrl.R
222222
configVars := make(map[string]env.Setter)
223223
effectiveCABundleSecretName := ""
224224

225-
// Validate the user-provided CA bundle, then reconcile an assistant-owned
226-
// bundle that also trusts OpenShift service-serving certificates. The
227-
// generated bundle is mounted instead of modifying the shared source Secret.
225+
// Validate and mount the CA bundle directly. The bundle (by default the
226+
// control plane's combined-ca-bundle) already trusts OpenShift
227+
// service-serving certificates, so no assistant-owned copy is needed.
228228
if instance.Spec.CaBundleSecretName != "" {
229-
_, err := tls.ValidateCACertSecret(
229+
caBundleHash, err := tls.ValidateCACertSecret(
230230
ctx,
231231
r.Client,
232232
types.NamespacedName{Name: instance.Spec.CaBundleSecretName, Namespace: instance.Namespace},
@@ -244,11 +244,7 @@ func (r *OpenStackAssistantReconciler) Reconcile(ctx context.Context, req ctrl.R
244244
return ctrl.Result{}, err
245245
}
246246

247-
var caBundleHash string
248-
effectiveCABundleSecretName, caBundleHash, err = r.reconcileCABundle(ctx, instance)
249-
if err != nil {
250-
return ctrl.Result{}, err
251-
}
247+
effectiveCABundleSecretName = instance.Spec.CaBundleSecretName
252248
configVars[effectiveCABundleSecretName] = env.SetValue(caBundleHash)
253249
}
254250

@@ -849,23 +845,6 @@ func (r *OpenStackAssistantReconciler) findObjectsForSrc(ctx context.Context, sr
849845
requests := []reconcile.Request{}
850846

851847
Log := r.GetLogger(ctx)
852-
if _, ok := src.(*corev1.ConfigMap); ok && src.GetName() == openShiftServiceCAConfigMapName {
853-
crList := &assistantv1.OpenStackAssistantList{}
854-
if err := r.List(ctx, crList, client.InNamespace(src.GetNamespace())); err != nil {
855-
Log.Error(err, "listing OpenStackAssistants for service CA change")
856-
return requests
857-
}
858-
for _, item := range crList.Items {
859-
requests = append(requests, reconcile.Request{
860-
NamespacedName: types.NamespacedName{
861-
Name: item.GetName(),
862-
Namespace: item.GetNamespace(),
863-
},
864-
})
865-
}
866-
return requests
867-
}
868-
869848
for _, field := range allWatchFields {
870849
crList := &assistantv1.OpenStackAssistantList{}
871850
listOps := &client.ListOptions{

0 commit comments

Comments
 (0)