Skip to content

Commit

Permalink
Merge pull request #968 from rabi/loop
Browse files Browse the repository at this point in the history
Don't reconcile for status updates
  • Loading branch information
openshift-merge-bot[bot] authored Jul 26, 2024
2 parents 1194ae8 + babc83b commit 0ffab07
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"

"github.com/go-logr/logr"
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
Expand Down Expand Up @@ -435,7 +437,11 @@ func (r *OpenStackDataPlaneDeploymentReconciler) setHashes(
// SetupWithManager sets up the controller with the Manager.
func (r *OpenStackDataPlaneDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&dataplanev1.OpenStackDataPlaneDeployment{}).
For(&dataplanev1.OpenStackDataPlaneDeployment{},
builder.WithPredicates(predicate.Or(
predicate.GenerationChangedPredicate{},
predicate.AnnotationChangedPredicate{},
predicate.LabelChangedPredicate{}))).
Owns(&ansibleeev1.OpenStackAnsibleEE{}).
Complete(r)
}
8 changes: 5 additions & 3 deletions controllers/dataplane/openstackdataplanenodeset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,11 @@ func (r *OpenStackDataPlaneNodeSetReconciler) SetupWithManager(
return err
}
return ctrl.NewControllerManagedBy(mgr).
For(&dataplanev1.OpenStackDataPlaneNodeSet{}).
For(&dataplanev1.OpenStackDataPlaneNodeSet{},
builder.WithPredicates(predicate.Or(
predicate.GenerationChangedPredicate{},
predicate.AnnotationChangedPredicate{},
predicate.LabelChangedPredicate{}))).
Owns(&ansibleeev1.OpenStackAnsibleEE{}).
Owns(&baremetalv1.OpenStackBaremetalSet{}).
Owns(&infranetworkv1.IPSet{}).
Expand All @@ -655,7 +659,6 @@ func (r *OpenStackDataPlaneNodeSetReconciler) secretWatcherFn(
Log := r.GetLogger(ctx)
nodeSets := &dataplanev1.OpenStackDataPlaneNodeSetList{}
kind := strings.ToLower(obj.GetObjectKind().GroupVersionKind().Kind)

selector := "spec.ansibleVarsFrom.ansible.configMaps"
if kind == "secret" {
selector = "spec.ansibleVarsFrom.ansible.secrets"
Expand Down Expand Up @@ -690,7 +693,6 @@ func (r *OpenStackDataPlaneNodeSetReconciler) genericWatcherFn(
) []reconcile.Request {
Log := r.GetLogger(ctx)
nodeSets := &dataplanev1.OpenStackDataPlaneNodeSetList{}

listOpts := []client.ListOption{
client.InNamespace(obj.GetNamespace()),
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/dataplane/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ func EnsureServices(ctx context.Context, helper *helper.Helper, instance *datapl
}
_, err = controllerutil.CreateOrPatch(ctx, helper.GetClient(), ensureService, func() error {
serviceObjSpec.DeepCopyInto(&ensureService.Spec)
ensureService.DefaultLabels()
if ensureService.Spec.EDPMServiceType == "" {
ensureService.Spec.EDPMServiceType = serviceObjMeta.Name
}
return nil
})
if err != nil {
Expand Down

0 comments on commit 0ffab07

Please sign in to comment.