Skip to content

Commit

Permalink
Index the customServiceConfigSecrets for use in the Secret lookup
Browse files Browse the repository at this point in the history
This change ensures the customServiceConfigSecrets value is indexed for
when we need to use it in the FindObjectsForSrc function

Signed-off-by: Brendan Shephard <[email protected]>
  • Loading branch information
bshephar committed Oct 28, 2024
1 parent 6e17ef7 commit bd75dfd
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions controllers/heat_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ func (r *HeatReconciler) SetupWithManager(mgr ctrl.Manager) error {
return err
}

// index customServiceConfigSecrets
if err := mgr.GetFieldIndexer().IndexField(context.Background(), &heatv1beta1.Heat{}, customServiceConfigField, func(rawObj client.Object) []string {
// Extract the secret name from the spec, if one is provided
cr := rawObj.(*heatv1beta1.Heat)
if cr.Spec.CustomServiceConfigSecrets == nil {
return nil
}
return cr.Spec.CustomServiceConfigSecrets
}); err != nil {
return err
}

memcachedFn := func(_ context.Context, o client.Object) []reconcile.Request {
result := []reconcile.Request{}

Expand Down
12 changes: 12 additions & 0 deletions controllers/heatapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ func (r *HeatAPIReconciler) SetupWithManager(mgr ctrl.Manager) error {
return err
}

// index customServiceConfigSecrets
if err := mgr.GetFieldIndexer().IndexField(context.Background(), &heatv1beta1.HeatAPI{}, customServiceConfigField, func(rawObj client.Object) []string {
// Extract the secret name from the spec, if one is provided
cr := rawObj.(*heatv1beta1.HeatAPI)
if cr.Spec.CustomServiceConfigSecrets == nil {
return nil
}
return cr.Spec.CustomServiceConfigSecrets
}); err != nil {
return err
}

configMapFn := func(_ context.Context, o client.Object) []reconcile.Request {
result := []reconcile.Request{}

Expand Down
12 changes: 12 additions & 0 deletions controllers/heatcfnapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ func (r *HeatCfnAPIReconciler) SetupWithManager(mgr ctrl.Manager) error {
return err
}

// index customServiceConfigSecrets
if err := mgr.GetFieldIndexer().IndexField(context.Background(), &heatv1beta1.HeatCfnAPI{}, customServiceConfigField, func(rawObj client.Object) []string {
// Extract the secret name from the spec, if one is provided
cr := rawObj.(*heatv1beta1.HeatCfnAPI)
if cr.Spec.CustomServiceConfigSecrets == nil {
return nil
}
return cr.Spec.CustomServiceConfigSecrets
}); err != nil {
return err
}

configMapFn := func(_ context.Context, o client.Object) []reconcile.Request {
result := []reconcile.Request{}

Expand Down
12 changes: 12 additions & 0 deletions controllers/heatengine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ func (r *HeatEngineReconciler) SetupWithManager(mgr ctrl.Manager) error {
return err
}

// index customServiceConfigSecrets
if err := mgr.GetFieldIndexer().IndexField(context.Background(), &heatv1beta1.HeatEngine{}, customServiceConfigField, func(rawObj client.Object) []string {
// Extract the secret name from the spec, if one is provided
cr := rawObj.(*heatv1beta1.HeatEngine)
if cr.Spec.CustomServiceConfigSecrets == nil {
return nil
}
return cr.Spec.CustomServiceConfigSecrets
}); err != nil {
return err
}

configMapFn := func(_ context.Context, o client.Object) []reconcile.Request {
result := []reconcile.Request{}

Expand Down

0 comments on commit bd75dfd

Please sign in to comment.