Skip to content

Commit

Permalink
Do not ignore err on GetSecret()
Browse files Browse the repository at this point in the history
In CI jobs it was seen that the controller menager restarted due
to a nil ptr when set the transport url in the config. The issue
iss that when the TransportURL secret gets fetched, no check is
perforned if an error happened.

This adds the err checks on the TransportURL and Password secret.

Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
  • Loading branch information
stuggi committed Oct 9, 2024
1 parent a9bf21a commit b392b0a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions controllers/ceilometer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,15 @@ func (r *CeilometerReconciler) generateServiceConfig(
return err
}

transportURLSecret, _, _ := secret.GetSecret(ctx, h, instance.CeilometerStatus.TransportURLSecret, instance.Namespace)
ceilometerPasswordSecret, _, _ := secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace)
transportURLSecret, _, err := secret.GetSecret(ctx, h, instance.CeilometerStatus.TransportURLSecret, instance.Namespace)
if err != nil {
return err
}

ceilometerPasswordSecret, _, err := secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace)
if err != nil {
return err
}

templateParameters := map[string]interface{}{
"KeystoneInternalURL": keystoneInternalURL,
Expand Down Expand Up @@ -891,8 +898,15 @@ func (r *CeilometerReconciler) generateComputeServiceConfig(
return err
}

transportURLSecret, _, _ := secret.GetSecret(ctx, h, instance.CeilometerStatus.TransportURLSecret, instance.Namespace)
ceilometerPasswordSecret, _, _ := secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace)
transportURLSecret, _, err := secret.GetSecret(ctx, h, instance.CeilometerStatus.TransportURLSecret, instance.Namespace)
if err != nil {
return err
}

ceilometerPasswordSecret, _, err := secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace)
if err != nil {
return err
}

templateParameters := map[string]interface{}{
"KeystoneInternalURL": keystoneInternalURL,
Expand Down

0 comments on commit b392b0a

Please sign in to comment.