Skip to content

Commit ef3e716

Browse files
committed
tls: wire signer certs to read PKI config via SignerKeyParams
Introduce SignerKeyParams, a WritableAsset with zero dependencies that reads install-config.yaml via AssetBase.LoadFromFile (strict YAML, deprecated field conversion, defaults) and extracts the effective PKI configuration via EffectiveSignerPKIConfig(). When no install-config is present, Load() returns (false, nil) so the asset store falls back to the state file between multi-step invocations (e.g. create manifests followed by create cluster, where install-config.yaml is consumed after the first step). In the agent flow where neither file nor state exists, Generate() leaves PKIConfig nil (RSA-2048). SignerKeyParams is explicitly added to the Manifests and agent target asset lists so that its PKIConfig is persisted to the state file, ensuring correct key algorithms in multi-step flows where install-config.yaml is consumed between commands. Signers that previously had zero dependencies now depend on SignerKeyParams instead of InstallConfig, avoiding validation that would reject configs valid in the agent flow. Signers that already depended on InstallConfig use EffectiveSignerPKIConfig() to resolve the effective PKI config including feature gate defaults. With TechPreview enabled and no explicit pki config, all signer certs are generated with RSA-4096 (the current DefaultPKIProfile default). Assisted-by: Claude Code (Opus 4.6)
1 parent 36d3074 commit ef3e716

18 files changed

Lines changed: 273 additions & 29 deletions

cmd/openshift-install/agent.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ var (
5757
&manifests.AgentManifests{},
5858
&mirror.RegistriesConf{},
5959
&mirror.CaBundle{},
60+
&tls.SignerKeyParams{},
6061
},
6162
}
6263

pkg/asset/ignition/machine/arbiter_ignition_customizations_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ func TestArbiterIgnitionCustomizationsGenerate(t *testing.T) {
8585

8686
for _, tc := range cases {
8787
t.Run(tc.name, func(t *testing.T) {
88+
rootCAParents := asset.Parents{}
89+
rootCAParents.Add(&tls.SignerKeyParams{})
8890
rootCA := &tls.RootCA{}
89-
err := rootCA.Generate(context.Background(), nil)
91+
err := rootCA.Generate(context.Background(), rootCAParents)
9092
assert.NoError(t, err, "unexpected error generating root CA")
9193

9294
parents := asset.Parents{}

pkg/asset/ignition/machine/arbiter_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ func TestArbiterGenerate(t *testing.T) {
7070
}
7171
for _, tc := range testCases {
7272
t.Run(tc.description, func(t *testing.T) {
73+
rootCAParents := asset.Parents{}
74+
rootCAParents.Add(&tls.SignerKeyParams{})
7375
rootCA := &tls.RootCA{}
74-
err := rootCA.Generate(context.Background(), nil)
76+
err := rootCA.Generate(context.Background(), rootCAParents)
7577
assert.NoError(t, err, "unexpected error generating root CA")
7678

7779
parents := asset.Parents{}

pkg/asset/ignition/machine/master_ignition_customizations_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ func TestMasterIgnitionCustomizationsGenerate(t *testing.T) {
4848
},
4949
})
5050

51+
rootCAParents := asset.Parents{}
52+
rootCAParents.Add(&tls.SignerKeyParams{})
5153
rootCA := &tls.RootCA{}
52-
err := rootCA.Generate(context.Background(), nil)
54+
err := rootCA.Generate(context.Background(), rootCAParents)
5355
assert.NoError(t, err, "unexpected error generating root CA")
5456

5557
parents := asset.Parents{}

pkg/asset/ignition/machine/master_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ func TestMasterGenerate(t *testing.T) {
3838
},
3939
})
4040

41+
rootCAParents := asset.Parents{}
42+
rootCAParents.Add(&tls.SignerKeyParams{})
4143
rootCA := &tls.RootCA{}
42-
err := rootCA.Generate(context.Background(), nil)
44+
err := rootCA.Generate(context.Background(), rootCAParents)
4345
assert.NoError(t, err, "unexpected error generating root CA")
4446

4547
parents := asset.Parents{}

pkg/asset/ignition/machine/worker_ignition_customizations_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ func TestWorkerIgnitionCustomizationsGenerate(t *testing.T) {
4848
},
4949
})
5050

51+
rootCAParents := asset.Parents{}
52+
rootCAParents.Add(&tls.SignerKeyParams{})
5153
rootCA := &tls.RootCA{}
52-
err := rootCA.Generate(context.Background(), nil)
54+
err := rootCA.Generate(context.Background(), rootCAParents)
5355
assert.NoError(t, err, "unexpected error generating root CA")
5456

5557
parents := asset.Parents{}

pkg/asset/ignition/machine/worker_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ func TestWorkerGenerate(t *testing.T) {
2828
},
2929
})
3030

31+
rootCAParents := asset.Parents{}
32+
rootCAParents.Add(&tls.SignerKeyParams{})
3133
rootCA := &tls.RootCA{}
32-
err := rootCA.Generate(context.Background(), nil)
34+
err := rootCA.Generate(context.Background(), rootCAParents)
3335
assert.NoError(t, err, "unexpected error generating root CA")
3436

3537
parents := asset.Parents{}

pkg/asset/store/assetcreate_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ func TestCreatedAssetsAreNotDirty(t *testing.T) {
126126
"Kubeadmin Password": true, // read-only
127127
"InternalReleaseImageTLSSecret": true, // no files when NoRegistryClusterInstall feature gate is not set
128128
"InternalReleaseImageRegistryAuthSecret": true, // no files when NoRegistryClusterInstall feature gate is not set
129+
"Signer Key Parameters": true, // no on-disk files; persisted via state file only
129130
}
130131
for _, a := range tc.targets {
131132
name := a.Name()

pkg/asset/targets/targets.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var (
3333
&manifests.Manifests{},
3434
&manifests.Openshift{},
3535
&clusterapi.Cluster{},
36+
&tls.SignerKeyParams{},
3637
}
3738

3839
// ManifestTemplates are the manifest-templates targeted assets.

pkg/asset/tls/adminkubeconfig.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,28 @@ type AdminKubeConfigSignerCertKey struct {
1515

1616
var _ asset.WritableAsset = (*AdminKubeConfigSignerCertKey)(nil)
1717

18-
// Dependencies returns the dependency of the root-ca, which is empty.
18+
// Dependencies returns SignerKeyParams. Configurable PKI requires
19+
// reading the PKI config from InstallConfig, but adding InstallConfig
20+
// as a dependency here would break codepaths that generate signer certs
21+
// without an install-config on disk (e.g. agent create certificates,
22+
// node-joiner). SignerKeyParams reads the config directly from disk
23+
// without triggering InstallConfig validation.
1924
func (c *AdminKubeConfigSignerCertKey) Dependencies() []asset.Asset {
20-
return []asset.Asset{}
25+
return []asset.Asset{&SignerKeyParams{}}
2126
}
2227

2328
// Generate generates the root-ca key and cert pair.
2429
func (c *AdminKubeConfigSignerCertKey) Generate(ctx context.Context, parents asset.Parents) error {
30+
signerKeyParams := &SignerKeyParams{}
31+
parents.Get(signerKeyParams)
2532
cfg := &CertCfg{
2633
Subject: pkix.Name{CommonName: "admin-kubeconfig-signer", OrganizationalUnit: []string{"openshift"}},
2734
// KeyUsages is set by GenerateSelfSignedCertificate based on the key algorithm.
2835
Validity: ValidityTenYears(),
2936
IsCA: true,
3037
}
3138

32-
return c.SelfSignedCertKey.Generate(ctx, cfg, "admin-kubeconfig-signer", nil)
39+
return c.SelfSignedCertKey.Generate(ctx, cfg, "admin-kubeconfig-signer", signerKeyParams.PKIConfig)
3340
}
3441

3542
// Load reads the asset files from disk.

0 commit comments

Comments
 (0)