@@ -130,7 +130,7 @@ func (r *CinderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
130130
131131 // Fetch the Cinder instance
132132 instance := & cinderv1beta1.Cinder {}
133- err := r .Client . Get (ctx , req .NamespacedName , instance )
133+ err := r .Get (ctx , req .NamespacedName , instance )
134134 if err != nil {
135135 if k8s_errors .IsNotFound (err ) {
136136 // Request object not found, could have been deleted after reconcile request.
@@ -247,7 +247,7 @@ func (r *CinderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
247247// fields to index to reconcile when change
248248const (
249249 passwordSecretField = ".spec.secret"
250- caBundleSecretNameField = ".spec.tls.caBundleSecretName"
250+ caBundleSecretNameField = ".spec.tls.caBundleSecretName" // #nosec G101
251251 tlsAPIInternalField = ".spec.tls.api.internal.secretName"
252252 tlsAPIPublicField = ".spec.tls.api.public.secretName"
253253 topologyField = ".spec.topologyRef.Name"
@@ -291,7 +291,7 @@ func (r *CinderReconciler) SetupWithManager(mgr ctrl.Manager) error {
291291 listOpts := []client.ListOption {
292292 client .InNamespace (o .GetNamespace ()),
293293 }
294- if err := r .Client . List (ctx , cinders , listOpts ... ); err != nil {
294+ if err := r .List (ctx , cinders , listOpts ... ); err != nil {
295295 Log .Error (err , "Unable to retrieve Cinder CRs %v" )
296296 return nil
297297 }
@@ -327,7 +327,7 @@ func (r *CinderReconciler) SetupWithManager(mgr ctrl.Manager) error {
327327 listOpts := []client.ListOption {
328328 client .InNamespace (o .GetNamespace ()),
329329 }
330- if err := r .Client . List (ctx , cinders , listOpts ... ); err != nil {
330+ if err := r .List (ctx , cinders , listOpts ... ); err != nil {
331331 Log .Error (err , "Unable to retrieve Cinder CRs %w" )
332332 return nil
333333 }
@@ -383,7 +383,7 @@ func (r *CinderReconciler) findObjectForSrc(ctx context.Context, src client.Obje
383383 listOps := & client.ListOptions {
384384 Namespace : src .GetNamespace (),
385385 }
386- err := r .Client . List (ctx , crList , listOps )
386+ err := r .List (ctx , crList , listOps )
387387 if err != nil {
388388 Log .Error (err , fmt .Sprintf ("listing %s for namespace: %s" , crList .GroupVersionKind ().Kind , src .GetNamespace ()))
389389 return requests
@@ -736,7 +736,7 @@ func (r *CinderReconciler) reconcileNormal(ctx context.Context, instance *cinder
736736 condition .SeverityInfo ,
737737 condition .NetworkAttachmentsReadyWaitingMessage ,
738738 netAtt ))
739- return cinder .ResultRequeue , fmt .Errorf (condition . NetworkAttachmentsReadyWaitingMessage , netAtt )
739+ return cinder .ResultRequeue , fmt .Errorf ("%w: %s" , ErrNetworkAttachmentWaiting , netAtt )
740740 }
741741 instance .Status .Conditions .Set (condition .FalseCondition (
742742 condition .NetworkAttachmentsReadyCondition ,
@@ -981,7 +981,7 @@ func (r *CinderReconciler) generateServiceConfigs(
981981 labels := labels .GetLabels (instance , labels .GetGroupLabel (cinder .ServiceName ), serviceLabels )
982982
983983 var tlsCfg * tls.Service
984- if instance .Spec .CinderAPI .TLS .Ca . CaBundleSecretName != "" {
984+ if instance .Spec .CinderAPI .TLS .CaBundleSecretName != "" {
985985 tlsCfg = & tls.Service {}
986986 }
987987
@@ -1295,20 +1295,20 @@ func (r *CinderReconciler) backupCleanupDeployment(ctx context.Context, instance
12951295 },
12961296 }
12971297 key := client .ObjectKeyFromObject (deployment )
1298- err := r .Client . Get (ctx , key , deployment )
1298+ err := r .Get (ctx , key , deployment )
12991299
13001300 if k8s_errors .IsNotFound (err ) {
13011301 // Nothing to clean up
13021302 return nil
13031303 }
13041304
13051305 if err != nil {
1306- return fmt .Errorf ("Error looking for '%s' deployment in '%s' namespace: %w" , deployment .Name , instance .Namespace , err )
1306+ return fmt .Errorf ("error looking for '%s' deployment in '%s' namespace: %w" , deployment .Name , instance .Namespace , err )
13071307 }
13081308
1309- err = r .Client . Delete (ctx , deployment )
1309+ err = r .Delete (ctx , deployment )
13101310 if err != nil && ! k8s_errors .IsNotFound (err ) {
1311- return fmt .Errorf ("Error cleaning up %s: %w" , deployment .Name , err )
1311+ return fmt .Errorf ("error cleaning up %s: %w" , deployment .Name , err )
13121312 }
13131313
13141314 return nil
@@ -1326,12 +1326,12 @@ func (r *CinderReconciler) volumeDeploymentCreateOrUpdate(ctx context.Context, i
13261326 MemcachedInstance : & instance .Spec .MemcachedInstance ,
13271327 }
13281328
1329- if cinderVolumeSpec .CinderVolumeTemplate . NodeSelector == nil {
1330- cinderVolumeSpec .CinderVolumeTemplate . NodeSelector = instance .Spec .NodeSelector
1329+ if cinderVolumeSpec .NodeSelector == nil {
1330+ cinderVolumeSpec .NodeSelector = instance .Spec .NodeSelector
13311331 }
13321332
1333- if cinderVolumeSpec .CinderVolumeTemplate . TopologyRef == nil {
1334- cinderVolumeSpec .CinderVolumeTemplate . TopologyRef = instance .Spec .TopologyRef
1333+ if cinderVolumeSpec .TopologyRef == nil {
1334+ cinderVolumeSpec .TopologyRef = instance .Spec .TopologyRef
13351335 }
13361336
13371337 deployment := & cinderv1beta1.CinderVolume {
@@ -1371,7 +1371,7 @@ func (r *CinderReconciler) volumeCleanupDeployments(ctx context.Context, instanc
13711371 listOpts := []client.ListOption {
13721372 client .InNamespace (instance .Namespace ),
13731373 }
1374- if err := r .Client . List (ctx , volumes , listOpts ... ); err != nil {
1374+ if err := r .List (ctx , volumes , listOpts ... ); err != nil {
13751375 Log .Error (err , "Unable to retrieve volume CRs %v" )
13761376 return nil
13771377 }
@@ -1385,9 +1385,9 @@ func (r *CinderReconciler) volumeCleanupDeployments(ctx context.Context, instanc
13851385 // Delete the volume if it's no longer in the spec
13861386 _ , exists := instance .Spec .CinderVolumes [volume .BackendName ()]
13871387 if ! exists && volume .DeletionTimestamp .IsZero () {
1388- err := r .Client . Delete (ctx , & volume )
1388+ err := r .Delete (ctx , & volume )
13891389 if err != nil && ! k8s_errors .IsNotFound (err ) {
1390- err = fmt .Errorf ("Error cleaning up %s: %w" , volume .Name , err )
1390+ err = fmt .Errorf ("error cleaning up %s: %w" , volume .Name , err )
13911391 return err
13921392 }
13931393 }
0 commit comments