Skip to content

Commit aed2c1f

Browse files
stuggiclaude
andcommitted
Improve EDPM-aware AC revocation: dynamic discovery, Watch, simplified API
Three improvements to the EDPM application credential revocation mechanism: 1. Replace hardcoded edpmServices map with dynamic discovery - Remove the static map and isEDPMService() function - Add edpmServiceType parameter to EnsureApplicationCredentialForService and CleanupApplicationCredentialForService — callers pass the EDPM service type ("nova", "telemetry") or "" for ctlplane-only services - getEDPMConfigSecretNames now lists OpenStackDataPlaneService CRs and filters by EDPMServiceType, discovering custom services automatically - New EDPMServiceTypeAnnotation on AC CR enables ReconcilePendingEDPMSyncs to discover service types without the hardcoded map 2. Revert CleanupApplicationCredentialForService to error-only return - Signature reverted from (ctrl.Result, error) to error — all 12 non-EDPM service files return to the simpler calling pattern - When EDPM sync is pending, cleanup defers deletion (returns nil) instead of returning RequeueAfter - EDPM sync progression centralized in ReconcilePendingEDPMSyncs (replaces HasPendingEDPMSync) which runs at end of reconcileNormal - reconcileEDPMSync moved out of EnsureApplicationCredentialForService into the centralized function 3. Replace 5-minute polling with NodeSet Watch - Add Watch on OpenStackDataPlaneNodeSet with ResourceVersionChangedPredicate in SetupWithManager - Controller reacts promptly when SecretHashes change after deployment - Fallback interval increased to 30 minutes (safety net only) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent d34351f commit aed2c1f

17 files changed

Lines changed: 357 additions & 262 deletions

internal/controller/core/openstackcontrolplane_controller.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import (
5050
octaviav1 "github.com/openstack-k8s-operators/octavia-operator/api/v1beta1"
5151
clientv1 "github.com/openstack-k8s-operators/openstack-operator/api/client/v1beta1"
5252
corev1beta1 "github.com/openstack-k8s-operators/openstack-operator/api/core/v1beta1"
53+
dataplanev1 "github.com/openstack-k8s-operators/openstack-operator/api/dataplane/v1beta1"
5354

5455
"github.com/openstack-k8s-operators/openstack-operator/internal/openstack"
5556

@@ -742,7 +743,7 @@ func (r *OpenStackControlPlaneReconciler) reconcileNormal(ctx context.Context, i
742743

743744
instance.Status.Conditions.Remove(corev1beta1.OpenStackControlPlaneCertCleanupReadyCondition)
744745

745-
ctrlResult, err = openstack.HasPendingEDPMSync(ctx, helper, instance.Namespace)
746+
ctrlResult, err = openstack.ReconcilePendingEDPMSyncs(ctx, helper, instance.Namespace)
746747
if err != nil {
747748
return ctrl.Result{}, err
748749
} else if (ctrlResult != ctrl.Result{}) {
@@ -902,6 +903,14 @@ func (r *OpenStackControlPlaneReconciler) SetupWithManager(
902903
handler.EnqueueRequestsFromMapFunc(r.findControlPlaneForSrc),
903904
builder.WithPredicates(backup.AnnotationChangedPredicate(openstack.ServiceCertSelector)),
904905
).
906+
// Watch NodeSet status changes so EDPM AC sync reacts promptly
907+
// when a dataplane deployment completes (SecretHashes update),
908+
// instead of relying on the fallback polling interval.
909+
Watches(
910+
&dataplanev1.OpenStackDataPlaneNodeSet{},
911+
handler.EnqueueRequestsFromMapFunc(r.findControlPlaneForSrc),
912+
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}),
913+
).
905914
Complete(r)
906915
}
907916

0 commit comments

Comments
 (0)