@@ -123,7 +123,7 @@ func (r *OctaviaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
123123
124124 // Fetch the Octavia instance
125125 instance := & octaviav1.Octavia {}
126- err := r .Client . Get (ctx , req .NamespacedName , instance )
126+ err := r .Get (ctx , req .NamespacedName , instance )
127127 if err != nil {
128128 if k8s_errors .IsNotFound (err ) {
129129 // Request object not found, could have been deleted after reconcile request.
@@ -236,7 +236,7 @@ func (r *OctaviaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
236236// fields to index to reconcile when change
237237const (
238238 passwordSecretField = ".spec.secret"
239- caBundleSecretNameField = ".spec.tls.caBundleSecretName"
239+ caBundleSecretNameField = ".spec.tls.caBundleSecretName" // #nosec G101 -- Field path, not a credential
240240 tlsAPIInternalField = ".spec.tls.api.internal.secretName"
241241 tlsAPIPublicField = ".spec.tls.api.public.secretName"
242242 tlsOvnField = ".spec.tls.ovn.secretName"
@@ -787,7 +787,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
787787 ObjectMeta : metav1.ObjectMeta {
788788 Name : octavia .HmConfigMap ,
789789 Namespace : instance .GetNamespace (),
790- Labels : labels .GetLabels (instance , labels .GetGroupLabel (instance .ObjectMeta . Name ), map [string ]string {}),
790+ Labels : labels .GetLabels (instance , labels .GetGroupLabel (instance .Name ), map [string ]string {}),
791791 },
792792 Data : make (map [string ]string ),
793793 }
@@ -877,7 +877,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
877877 updatedMap [portName ] = hmPort
878878 }
879879
880- mapLabels := labels .GetLabels (instance , labels .GetGroupLabel (instance .ObjectMeta . Name ), map [string ]string {})
880+ mapLabels := labels .GetLabels (instance , labels .GetGroupLabel (instance .Name ), map [string ]string {})
881881 _ , err = controllerutil .CreateOrPatch (ctx , helper .GetClient (), nodeConfigMap , func () error {
882882 nodeConfigMap .Labels = util .MergeStringMaps (nodeConfigMap .Labels , mapLabels )
883883 nodeConfigMap .Data = updatedMap
@@ -920,7 +920,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
920920 instance .Status .Conditions .Set (condition .UnknownCondition (
921921 amphoraControllerReadyCondition (octaviav1 .HealthManager ),
922922 condition .InitReason ,
923- amphoraControllerErrorMessage (octaviav1 .HealthManager ),
923+ "%s" , amphoraControllerErrorMessage (octaviav1 .HealthManager ),
924924 ))
925925 } else {
926926 instance .Status .OctaviaHealthManagerReadyCount = octaviaHealthManager .Status .ReadyCount
@@ -956,7 +956,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
956956 instance .Status .Conditions .Set (condition .UnknownCondition (
957957 amphoraControllerReadyCondition (octaviav1 .Worker ),
958958 condition .InitReason ,
959- amphoraControllerErrorMessage (octaviav1 .Worker ),
959+ "%s" , amphoraControllerErrorMessage (octaviav1 .Worker ),
960960 ))
961961 } else {
962962 instance .Status .OctaviaRsyslogReadyCount = octaviaRsyslog .Status .ReadyCount
@@ -985,7 +985,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
985985 instance .Status .Conditions .Set (condition .UnknownCondition (
986986 amphoraControllerReadyCondition (octaviav1 .Housekeeping ),
987987 condition .InitReason ,
988- amphoraControllerErrorMessage (octaviav1 .Housekeeping ),
988+ "%s" , amphoraControllerErrorMessage (octaviav1 .Housekeeping ),
989989 ))
990990 } else {
991991 instance .Status .OctaviaHousekeepingReadyCount = octaviaHousekeeping .Status .ReadyCount
@@ -1014,7 +1014,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
10141014 instance .Status .Conditions .Set (condition .UnknownCondition (
10151015 amphoraControllerReadyCondition (octaviav1 .Worker ),
10161016 condition .InitReason ,
1017- amphoraControllerErrorMessage (octaviav1 .Worker ),
1017+ "%s" , amphoraControllerErrorMessage (octaviav1 .Worker ),
10181018 ))
10191019 } else {
10201020 instance .Status .OctaviaWorkerReadyCount = octaviaWorker .Status .ReadyCount
@@ -1380,11 +1380,11 @@ func (r *OctaviaReconciler) getLocalImageURLs(
13801380 // Get the list of images and their hashes
13811381 listURL := fmt .Sprintf ("%s/octavia-amphora-image.sha256sum" , endpoint )
13821382
1383- resp , err := http .Get (listURL )
1383+ resp , err := http .Get (listURL ) // #nosec G107 -- URL is constructed from trusted configuration parameter
13841384 if err != nil {
13851385 return nil , err
13861386 }
1387- defer resp .Body .Close ()
1387+ defer func () { _ = resp .Body .Close () } ()
13881388 scanner := bufio .NewScanner (resp .Body )
13891389 ret := []octavia.AmphoraImage {}
13901390 for scanner .Scan () {
@@ -1421,7 +1421,7 @@ func (r *OctaviaReconciler) generateServiceSecrets(
14211421 cmLabels := labels .GetLabels (instance , labels .GetGroupLabel (octavia .ServiceName ), map [string ]string {})
14221422
14231423 var tlsCfg * tls.Service
1424- if instance .Spec .OctaviaAPI .TLS .Ca . CaBundleSecretName != "" {
1424+ if instance .Spec .OctaviaAPI .TLS .CaBundleSecretName != "" {
14251425 tlsCfg = & tls.Service {}
14261426 }
14271427
@@ -1743,7 +1743,7 @@ func (r *OctaviaReconciler) checkOctaviaAPIGeneration(
17431743 listOpts := []client.ListOption {
17441744 client .InNamespace (instance .Namespace ),
17451745 }
1746- if err := r .Client . List (context .Background (), api , listOpts ... ); err != nil {
1746+ if err := r .List (context .Background (), api , listOpts ... ); err != nil {
17471747 Log .Error (err , "Unable to retrieve OctaviaAPI %w" )
17481748 return false , err
17491749 }
@@ -1765,7 +1765,7 @@ func (r *OctaviaReconciler) checkAmphoraGeneration(
17651765 listOpts := []client.ListOption {
17661766 client .InNamespace (instance .Namespace ),
17671767 }
1768- if err := r .Client . List (context .Background (), amph , listOpts ... ); err != nil {
1768+ if err := r .List (context .Background (), amph , listOpts ... ); err != nil {
17691769 Log .Error (err , "Unable to retrieve OctaviaAPI %w" )
17701770 return false , err
17711771 }
0 commit comments