Skip to content

Commit

Permalink
Ignores terminating namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaize Kaye committed Aug 13, 2024
1 parent bbf942f commit d919d88
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/namespace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ func (r *NamespaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
return ctrl.Result{}, client.IgnoreNotFound(err)
}

// if the namespace state is terminating, we do nothing
if ns.Status.Phase == corev1.NamespaceTerminating {
return ctrl.Result{}, nil
}

secretList := &corev1.SecretList{}

labelSelectorParameters, err := labels.NewRequirement(insightsTokenLabel, selection.Exists, []string{})
Expand Down Expand Up @@ -204,6 +209,7 @@ func activeNamespacePredicate(tokenTargetLabel string) predicate.Predicate {
},
UpdateFunc: func(updateEvent event.UpdateEvent) bool {
labels := updateEvent.ObjectNew.GetLabels()

_, err := getValueFromMap(labels, "lagoon.sh/environmentId")
if err != nil {
return false
Expand Down

0 comments on commit d919d88

Please sign in to comment.