@@ -10,6 +10,7 @@ import (
1010
1111 "github.com/openshift/installer/pkg/asset"
1212 "github.com/openshift/installer/pkg/asset/installconfig"
13+ pkidefaults "github.com/openshift/installer/pkg/types/pki"
1314)
1415
1516// KubeAPIServerToKubeletSignerCertKey is a key/cert pair that signs the kube-apiserver to kubelet client certs.
@@ -35,7 +36,7 @@ func (c *KubeAPIServerToKubeletSignerCertKey) Generate(ctx context.Context, pare
3536 IsCA : true ,
3637 }
3738
38- return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-to-kubelet-signer" , nil )
39+ return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-to-kubelet-signer" , pkidefaults . EffectiveSignerPKIConfig ( installConfig . Config ) )
3940}
4041
4142// Name returns the human-friendly name of the asset.
@@ -116,27 +117,28 @@ type KubeAPIServerLocalhostSignerCertKey struct {
116117
117118var _ asset.WritableAsset = (* KubeAPIServerLocalhostSignerCertKey )(nil )
118119
119- // Dependencies returns no dependencies . Configurable PKI requires
120+ // Dependencies returns SignerKeyParams . Configurable PKI requires
120121// reading the PKI config from InstallConfig, but adding InstallConfig
121122// as a dependency here would break codepaths that generate signer certs
122123// without an install-config on disk (e.g. agent create certificates,
123- // node-joiner). A follow-up commit introduces an intermediate asset
124- // that reads the config directly from disk without triggering
125- // InstallConfig validation.
124+ // node-joiner). SignerKeyParams reads the config directly from disk
125+ // without triggering InstallConfig validation.
126126func (c * KubeAPIServerLocalhostSignerCertKey ) Dependencies () []asset.Asset {
127- return []asset.Asset {}
127+ return []asset.Asset {& SignerKeyParams {} }
128128}
129129
130130// Generate generates the root-ca key and cert pair.
131131func (c * KubeAPIServerLocalhostSignerCertKey ) Generate (ctx context.Context , parents asset.Parents ) error {
132+ signerKeyParams := & SignerKeyParams {}
133+ parents .Get (signerKeyParams )
132134 cfg := & CertCfg {
133135 Subject : pkix.Name {CommonName : "kube-apiserver-localhost-signer" , OrganizationalUnit : []string {"openshift" }},
134136 // KeyUsages is set by GenerateSelfSignedCertificate based on the key algorithm.
135137 Validity : ValidityTenYears (),
136138 IsCA : true ,
137139 }
138140
139- return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-localhost-signer" , nil )
141+ return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-localhost-signer" , signerKeyParams . PKIConfig )
140142}
141143
142144// Load reads the asset files from disk.
@@ -226,27 +228,28 @@ type KubeAPIServerServiceNetworkSignerCertKey struct {
226228
227229var _ asset.WritableAsset = (* KubeAPIServerServiceNetworkSignerCertKey )(nil )
228230
229- // Dependencies returns no dependencies . Configurable PKI requires
231+ // Dependencies returns SignerKeyParams . Configurable PKI requires
230232// reading the PKI config from InstallConfig, but adding InstallConfig
231233// as a dependency here would break codepaths that generate signer certs
232234// without an install-config on disk (e.g. agent create certificates,
233- // node-joiner). A follow-up commit introduces an intermediate asset
234- // that reads the config directly from disk without triggering
235- // InstallConfig validation.
235+ // node-joiner). SignerKeyParams reads the config directly from disk
236+ // without triggering InstallConfig validation.
236237func (c * KubeAPIServerServiceNetworkSignerCertKey ) Dependencies () []asset.Asset {
237- return []asset.Asset {}
238+ return []asset.Asset {& SignerKeyParams {} }
238239}
239240
240241// Generate generates the root-ca key and cert pair.
241242func (c * KubeAPIServerServiceNetworkSignerCertKey ) Generate (ctx context.Context , parents asset.Parents ) error {
243+ signerKeyParams := & SignerKeyParams {}
244+ parents .Get (signerKeyParams )
242245 cfg := & CertCfg {
243246 Subject : pkix.Name {CommonName : "kube-apiserver-service-network-signer" , OrganizationalUnit : []string {"openshift" }},
244247 // KeyUsages is set by GenerateSelfSignedCertificate based on the key algorithm.
245248 Validity : ValidityTenYears (),
246249 IsCA : true ,
247250 }
248251
249- return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-service-network-signer" , nil )
252+ return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-service-network-signer" , signerKeyParams . PKIConfig )
250253}
251254
252255// Load reads the asset files from disk.
@@ -345,27 +348,28 @@ type KubeAPIServerLBSignerCertKey struct {
345348
346349var _ asset.WritableAsset = (* KubeAPIServerLBSignerCertKey )(nil )
347350
348- // Dependencies returns no dependencies . Configurable PKI requires
351+ // Dependencies returns SignerKeyParams . Configurable PKI requires
349352// reading the PKI config from InstallConfig, but adding InstallConfig
350353// as a dependency here would break codepaths that generate signer certs
351354// without an install-config on disk (e.g. agent create certificates,
352- // node-joiner). A follow-up commit introduces an intermediate asset
353- // that reads the config directly from disk without triggering
354- // InstallConfig validation.
355+ // node-joiner). SignerKeyParams reads the config directly from disk
356+ // without triggering InstallConfig validation.
355357func (c * KubeAPIServerLBSignerCertKey ) Dependencies () []asset.Asset {
356- return []asset.Asset {}
358+ return []asset.Asset {& SignerKeyParams {} }
357359}
358360
359361// Generate generates the root-ca key and cert pair.
360362func (c * KubeAPIServerLBSignerCertKey ) Generate (ctx context.Context , parents asset.Parents ) error {
363+ signerKeyParams := & SignerKeyParams {}
364+ parents .Get (signerKeyParams )
361365 cfg := & CertCfg {
362366 Subject : pkix.Name {CommonName : "kube-apiserver-lb-signer" , OrganizationalUnit : []string {"openshift" }},
363367 // KeyUsages is set by GenerateSelfSignedCertificate based on the key algorithm.
364368 Validity : ValidityTenYears (),
365369 IsCA : true ,
366370 }
367371
368- return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-lb-signer" , nil )
372+ return c .SelfSignedCertKey .Generate (ctx , cfg , "kube-apiserver-lb-signer" , signerKeyParams . PKIConfig )
369373}
370374
371375// Load reads the asset files from disk.
0 commit comments