@@ -11,6 +11,7 @@ See the License for the specific language governing permissions and
1111limitations under the License.
1212*/
1313
14+ // Package client contains the OpenStackClient controller implementation
1415package client
1516
1617import (
@@ -87,7 +88,7 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
8788 Log := r .GetLogger (ctx )
8889
8990 instance := & clientv1.OpenStackClient {}
90- err := r .Client . Get (context .TODO (), req .NamespacedName , instance )
91+ err := r .Get (context .TODO (), req .NamespacedName , instance )
9192 if err != nil {
9293 if k8s_errors .IsNotFound (err ) {
9394 Log .Info ("OpenStackClient CR not found" )
@@ -271,7 +272,8 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
271272 condition .TLSInputReadyCondition ,
272273 condition .RequestedReason ,
273274 condition .SeverityInfo ,
274- fmt .Sprintf (condition .TLSInputReadyWaitingMessage , instance .Spec .CaBundleSecretName )))
275+ condition .TLSInputReadyWaitingMessage ,
276+ instance .Spec .CaBundleSecretName ))
275277 return ctrl.Result {}, nil
276278 }
277279 instance .Status .Conditions .Set (condition .FalseCondition (
@@ -320,7 +322,7 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
320322 podSpecHashName := "podSpec"
321323
322324 op , err := controllerutil .CreateOrPatch (ctx , r .Client , osclient , func () error {
323- isPodUpdate := ! osclient .ObjectMeta . CreationTimestamp .IsZero ()
325+ isPodUpdate := ! osclient .CreationTimestamp .IsZero ()
324326 currentPodSpecHash := instance .Status .Hash [podSpecHashName ]
325327 if ! isPodUpdate || currentPodSpecHash != podSpecHash {
326328 osclient .Spec = spec
@@ -348,14 +350,14 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
348350 // openstackclient pod
349351 if err := r .Delete (ctx , osclient ); err != nil && ! k8s_errors .IsNotFound (err ) {
350352 // Error deleting the object
351- return ctrl.Result {}, fmt .Errorf ("Error deleting OpenStackClient pod %s: %w" , osclient .Name , err )
353+ return ctrl.Result {}, fmt .Errorf ("error deleting OpenStackClient pod %s: %w" , osclient .Name , err )
352354 }
353355 Log .Info (fmt .Sprintf ("OpenStackClient pod deleted due to change %s" , err .Error ()))
354356
355357 return ctrl.Result {Requeue : true }, nil
356358 }
357359
358- return ctrl.Result {}, fmt .Errorf ("Failed to create or update pod %s: %w" , osclient .Name , err )
360+ return ctrl.Result {}, fmt .Errorf ("failed to create or update pod %s: %w" , osclient .Name , err )
359361 }
360362
361363 if err != nil {
@@ -383,9 +385,9 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
383385 terminatingDuration := time .Since (osclient .DeletionTimestamp .Time )
384386 if terminatingDuration > time .Minute * 3 {
385387 // Force delete only truly stuck pods
386- err := r .Client . Delete (ctx , osclient , client .GracePeriodSeconds (0 ))
388+ err := r .Delete (ctx , osclient , client .GracePeriodSeconds (0 ))
387389 if err != nil {
388- return ctrl.Result {}, fmt .Errorf ("Failed to force delete pod: %w" , err )
390+ return ctrl.Result {}, fmt .Errorf ("failed to force delete pod: %w" , err )
389391 }
390392 }
391393 }
@@ -480,7 +482,7 @@ func (r *OpenStackClientReconciler) SetupWithManager(
480482 listOpts := []client.ListOption {
481483 client .InNamespace (o .GetNamespace ()),
482484 }
483- if err := r .Client . List (ctx , openstackclients , listOpts ... ); err != nil {
485+ if err := r .List (ctx , openstackclients , listOpts ... ); err != nil {
484486 Log .Error (err , "Unable to retrieve OpenstackClient CRs %v" )
485487 return nil
486488 }
0 commit comments