@@ -212,36 +212,36 @@ func (c Certificates) AsMap() CertificateMap {
212
212
// GetDefaultCertList returns all of the certificates kubeadm requires to function.
213
213
func GetDefaultCertList () Certificates {
214
214
return Certificates {
215
- & KubeadmCertRootCA ,
216
- & KubeadmCertAPIServer ,
217
- & KubeadmCertKubeletClient ,
215
+ KubeadmCertRootCA () ,
216
+ KubeadmCertAPIServer () ,
217
+ KubeadmCertKubeletClient () ,
218
218
// Front Proxy certs
219
- & KubeadmCertFrontProxyCA ,
220
- & KubeadmCertFrontProxyClient ,
219
+ KubeadmCertFrontProxyCA () ,
220
+ KubeadmCertFrontProxyClient () ,
221
221
// etcd certs
222
- & KubeadmCertEtcdCA ,
223
- & KubeadmCertEtcdServer ,
224
- & KubeadmCertEtcdPeer ,
225
- & KubeadmCertEtcdHealthcheck ,
226
- & KubeadmCertEtcdAPIClient ,
222
+ KubeadmCertEtcdCA () ,
223
+ KubeadmCertEtcdServer () ,
224
+ KubeadmCertEtcdPeer () ,
225
+ KubeadmCertEtcdHealthcheck () ,
226
+ KubeadmCertEtcdAPIClient () ,
227
227
}
228
228
}
229
229
230
230
// GetCertsWithoutEtcd returns all of the certificates kubeadm needs when etcd is hosted externally.
231
231
func GetCertsWithoutEtcd () Certificates {
232
232
return Certificates {
233
- & KubeadmCertRootCA ,
234
- & KubeadmCertAPIServer ,
235
- & KubeadmCertKubeletClient ,
233
+ KubeadmCertRootCA () ,
234
+ KubeadmCertAPIServer () ,
235
+ KubeadmCertKubeletClient () ,
236
236
// Front Proxy certs
237
- & KubeadmCertFrontProxyCA ,
238
- & KubeadmCertFrontProxyClient ,
237
+ KubeadmCertFrontProxyCA () ,
238
+ KubeadmCertFrontProxyClient () ,
239
239
}
240
240
}
241
241
242
- var (
243
- // KubeadmCertRootCA is the definition of the Kubernetes Root CA for the API Server and kubelet.
244
- KubeadmCertRootCA = KubeadmCert {
242
+ // KubeadmCertRootCA is the definition of the Kubernetes Root CA for the API Server and kubelet.
243
+ func KubeadmCertRootCA () * KubeadmCert {
244
+ return & KubeadmCert {
245
245
Name : "ca" ,
246
246
LongName : "self-signed Kubernetes CA to provision identities for other Kubernetes components" ,
247
247
BaseName : kubeadmconstants .CACertAndKeyBaseName ,
@@ -251,8 +251,11 @@ var (
251
251
},
252
252
},
253
253
}
254
- // KubeadmCertAPIServer is the definition of the cert used to serve the Kubernetes API.
255
- KubeadmCertAPIServer = KubeadmCert {
254
+ }
255
+
256
+ // KubeadmCertAPIServer is the definition of the cert used to serve the Kubernetes API.
257
+ func KubeadmCertAPIServer () * KubeadmCert {
258
+ return & KubeadmCert {
256
259
Name : "apiserver" ,
257
260
LongName : "certificate for serving the Kubernetes API" ,
258
261
BaseName : kubeadmconstants .APIServerCertAndKeyBaseName ,
@@ -267,8 +270,11 @@ var (
267
270
makeAltNamesMutator (pkiutil .GetAPIServerAltNames ),
268
271
},
269
272
}
270
- // KubeadmCertKubeletClient is the definition of the cert used by the API server to access the kubelet.
271
- KubeadmCertKubeletClient = KubeadmCert {
273
+ }
274
+
275
+ // KubeadmCertKubeletClient is the definition of the cert used by the API server to access the kubelet.
276
+ func KubeadmCertKubeletClient () * KubeadmCert {
277
+ return & KubeadmCert {
272
278
Name : "apiserver-kubelet-client" ,
273
279
LongName : "certificate for the API server to connect to kubelet" ,
274
280
BaseName : kubeadmconstants .APIServerKubeletClientCertAndKeyBaseName ,
@@ -281,9 +287,11 @@ var (
281
287
},
282
288
},
283
289
}
290
+ }
284
291
285
- // KubeadmCertFrontProxyCA is the definition of the CA used for the front end proxy.
286
- KubeadmCertFrontProxyCA = KubeadmCert {
292
+ // KubeadmCertFrontProxyCA is the definition of the CA used for the front end proxy.
293
+ func KubeadmCertFrontProxyCA () * KubeadmCert {
294
+ return & KubeadmCert {
287
295
Name : "front-proxy-ca" ,
288
296
LongName : "self-signed CA to provision identities for front proxy" ,
289
297
BaseName : kubeadmconstants .FrontProxyCACertAndKeyBaseName ,
@@ -293,9 +301,11 @@ var (
293
301
},
294
302
},
295
303
}
304
+ }
296
305
297
- // KubeadmCertFrontProxyClient is the definition of the cert used by the API server to access the front proxy.
298
- KubeadmCertFrontProxyClient = KubeadmCert {
306
+ // KubeadmCertFrontProxyClient is the definition of the cert used by the API server to access the front proxy.
307
+ func KubeadmCertFrontProxyClient () * KubeadmCert {
308
+ return & KubeadmCert {
299
309
Name : "front-proxy-client" ,
300
310
BaseName : kubeadmconstants .FrontProxyClientCertAndKeyBaseName ,
301
311
LongName : "certificate for the front proxy client" ,
@@ -307,9 +317,11 @@ var (
307
317
},
308
318
},
309
319
}
320
+ }
310
321
311
- // KubeadmCertEtcdCA is the definition of the root CA used by the hosted etcd server.
312
- KubeadmCertEtcdCA = KubeadmCert {
322
+ // KubeadmCertEtcdCA is the definition of the root CA used by the hosted etcd server.
323
+ func KubeadmCertEtcdCA () * KubeadmCert {
324
+ return & KubeadmCert {
313
325
Name : "etcd-ca" ,
314
326
LongName : "self-signed CA to provision identities for etcd" ,
315
327
BaseName : kubeadmconstants .EtcdCACertAndKeyBaseName ,
@@ -319,8 +331,11 @@ var (
319
331
},
320
332
},
321
333
}
322
- // KubeadmCertEtcdServer is the definition of the cert used to serve etcd to clients.
323
- KubeadmCertEtcdServer = KubeadmCert {
334
+ }
335
+
336
+ // KubeadmCertEtcdServer is the definition of the cert used to serve etcd to clients.
337
+ func KubeadmCertEtcdServer () * KubeadmCert {
338
+ return & KubeadmCert {
324
339
Name : "etcd-server" ,
325
340
LongName : "certificate for serving etcd" ,
326
341
BaseName : kubeadmconstants .EtcdServerCertAndKeyBaseName ,
@@ -339,8 +354,11 @@ var (
339
354
setCommonNameToNodeName (),
340
355
},
341
356
}
342
- // KubeadmCertEtcdPeer is the definition of the cert used by etcd peers to access each other.
343
- KubeadmCertEtcdPeer = KubeadmCert {
357
+ }
358
+
359
+ // KubeadmCertEtcdPeer is the definition of the cert used by etcd peers to access each other.
360
+ func KubeadmCertEtcdPeer () * KubeadmCert {
361
+ return & KubeadmCert {
344
362
Name : "etcd-peer" ,
345
363
LongName : "certificate for etcd nodes to communicate with each other" ,
346
364
BaseName : kubeadmconstants .EtcdPeerCertAndKeyBaseName ,
@@ -355,8 +373,11 @@ var (
355
373
setCommonNameToNodeName (),
356
374
},
357
375
}
358
- // KubeadmCertEtcdHealthcheck is the definition of the cert used by Kubernetes to check the health of the etcd server.
359
- KubeadmCertEtcdHealthcheck = KubeadmCert {
376
+ }
377
+
378
+ // KubeadmCertEtcdHealthcheck is the definition of the cert used by Kubernetes to check the health of the etcd server.
379
+ func KubeadmCertEtcdHealthcheck () * KubeadmCert {
380
+ return & KubeadmCert {
360
381
Name : "etcd-healthcheck-client" ,
361
382
LongName : "certificate for liveness probes to healthcheck etcd" ,
362
383
BaseName : kubeadmconstants .EtcdHealthcheckClientCertAndKeyBaseName ,
@@ -369,8 +390,11 @@ var (
369
390
},
370
391
},
371
392
}
372
- // KubeadmCertEtcdAPIClient is the definition of the cert used by the API server to access etcd.
373
- KubeadmCertEtcdAPIClient = KubeadmCert {
393
+ }
394
+
395
+ // KubeadmCertEtcdAPIClient is the definition of the cert used by the API server to access etcd.
396
+ func KubeadmCertEtcdAPIClient () * KubeadmCert {
397
+ return & KubeadmCert {
374
398
Name : "apiserver-etcd-client" ,
375
399
LongName : "certificate the apiserver uses to access etcd" ,
376
400
BaseName : kubeadmconstants .APIServerEtcdClientCertAndKeyBaseName ,
@@ -383,7 +407,7 @@ var (
383
407
},
384
408
},
385
409
}
386
- )
410
+ }
387
411
388
412
func makeAltNamesMutator (f func (* kubeadmapi.InitConfiguration ) (* certutil.AltNames , error )) configMutatorsFunc {
389
413
return func (mc * kubeadmapi.InitConfiguration , cc * pkiutil.CertConfig ) error {
0 commit comments