@@ -59,7 +59,7 @@ func (r *ZoneK8sVersionReconciler) Reconcile(ctx context.Context, req ctrl.Reque
5959 return ctrl.Result {}, err
6060 }
6161
62- l .Info ("OCP current version" , "version" , ocpVersion )
62+ l .Info ("OCP current version" , "version" , formatVersion ( ocpVersion ) )
6363
6464 // We don't use client-go's ServerVersion() so we get context support
6565 body , err := r .RESTClient .Get ().AbsPath ("/version" ).Do (ctx ).Raw ()
@@ -71,7 +71,7 @@ func (r *ZoneK8sVersionReconciler) Reconcile(ctx context.Context, req ctrl.Reque
7171 if err != nil {
7272 return ctrl.Result {}, err
7373 }
74- l .Info ("K8s current version" , "version" , k8sVersion )
74+ l .Info ("K8s current version" , "version" , formatVersion ( & k8sVersion ) )
7575
7676 // List zones by label because we don't enforce any naming conventions
7777 // for the Zone objects on the control-api cluster.
@@ -91,10 +91,8 @@ func (r *ZoneK8sVersionReconciler) Reconcile(ctx context.Context, req ctrl.Reque
9191
9292 var errs []error
9393 for _ , z := range zones .Items {
94- z .Data .Features [kubernetesVersionFeatureKey ] =
95- fmt .Sprintf ("%s.%s" , k8sVersion .Major , k8sVersion .Minor )
96- z .Data .Features [openshiftVersionFeatureKey ] =
97- fmt .Sprintf ("%s.%s" , ocpVersion .Major , ocpVersion .Minor )
94+ z .Data .Features [kubernetesVersionFeatureKey ] = formatVersion (& k8sVersion )
95+ z .Data .Features [openshiftVersionFeatureKey ] = formatVersion (ocpVersion )
9896 if err := r .ForeignClient .Update (ctx , & z ); err != nil {
9997 errs = append (errs , err )
10098 }
@@ -136,3 +134,7 @@ func extractOpenShiftVersion(cv *configv1.ClusterVersion) (*version.Info, error)
136134 }
137135 return & version , nil
138136}
137+
138+ func formatVersion (v * version.Info ) string {
139+ return fmt .Sprintf ("%s.%s" , v .Major , v .Minor )
140+ }
0 commit comments