@@ -54,7 +54,7 @@ func (c *ControlPlaneInitMutex) Lock(ctx context.Context, cluster *clusterv1.Clu
54
54
err := c .client .Get (ctx , client.ObjectKey {
55
55
Namespace : cluster .Namespace ,
56
56
Name : cmName ,
57
- }, & sema .ConfigMap )
57
+ }, sema .ConfigMap )
58
58
switch {
59
59
case apierrors .IsNotFound (err ):
60
60
break
@@ -82,9 +82,8 @@ func (c *ControlPlaneInitMutex) Lock(ctx context.Context, cluster *clusterv1.Clu
82
82
log .Error (err , "Failed to acquire lock while setting semaphore information" )
83
83
return false
84
84
}
85
-
86
85
log .Info ("Attempting to acquire the lock" )
87
- err = c .client .Create (ctx , & sema .ConfigMap )
86
+ err = c .client .Create (ctx , sema .ConfigMap )
88
87
switch {
89
88
case apierrors .IsAlreadyExists (err ):
90
89
log .Info ("Cannot acquire the lock. The lock has been acquired by someone else" )
@@ -106,7 +105,7 @@ func (c *ControlPlaneInitMutex) Unlock(ctx context.Context, cluster *clusterv1.C
106
105
err := c .client .Get (ctx , client.ObjectKey {
107
106
Namespace : cluster .Namespace ,
108
107
Name : cmName ,
109
- }, & sema .ConfigMap )
108
+ }, sema .ConfigMap )
110
109
switch {
111
110
case apierrors .IsNotFound (err ):
112
111
log .Info ("Control plane init lock not found, it may have been released already" )
@@ -116,7 +115,7 @@ func (c *ControlPlaneInitMutex) Unlock(ctx context.Context, cluster *clusterv1.C
116
115
return false
117
116
default :
118
117
// Delete the config map semaphore if there is no error fetching it
119
- if err := c .client .Delete (ctx , & sema .ConfigMap ); err != nil {
118
+ if err := c .client .Delete (ctx , sema .ConfigMap ); err != nil {
120
119
// TODO: return true on apierrors.IsNotFound
121
120
log .Error (err , "Error deleting the config map underlying the control plane init lock" )
122
121
return false
@@ -130,11 +129,11 @@ type information struct {
130
129
}
131
130
132
131
type semaphore struct {
133
- apicorev1.ConfigMap
132
+ * apicorev1.ConfigMap
134
133
}
135
134
136
135
func newSemaphore () * semaphore {
137
- return & semaphore {apicorev1.ConfigMap {}}
136
+ return & semaphore {& apicorev1.ConfigMap {}}
138
137
}
139
138
140
139
func configMapName (clusterName string ) string {
0 commit comments