Skip to content

Commit 47da5ea

Browse files
committed
USHIFT-6951: narrow kubelet serving CA bundle for metrics-server
add KubeletServingCAPath containing only kubelet-signer and kube-csr-signer; use it instead of the broader KubeletClientCAPath Signed-off-by: Jonathan H. Cope <jcope@redhat.com>
1 parent 42996d6 commit 47da5ea

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

pkg/cmd/init.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ func certSetup(cfg *config.Config) (*certchains.CertificateChains, error) {
371371
[]string{"admin-kubeconfig-signer"},
372372
[]string{"kubelet-signer"},
373373
[]string{"kubelet-signer", "kube-csr-signer"},
374+
).WithCABundle(
375+
cryptomaterial.KubeletServingCAPath(certsDir),
376+
[]string{"kubelet-signer"},
377+
[]string{"kubelet-signer", "kube-csr-signer"},
374378
).WithCABundle(
375379
cryptomaterial.ServiceAccountTokenCABundlePath(certsDir),
376380
[]string{"kube-apiserver-localhost-signer"},

pkg/components/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func ProvisionMetricsServerCerts(ctx context.Context, cfg *config.Config) error
9898
return fmt.Errorf("applying metrics-server client cert secret: %w", err)
9999
}
100100

101-
caPEM, err := os.ReadFile(cryptomaterial.KubeletClientCAPath(certsDir))
101+
caPEM, err := os.ReadFile(cryptomaterial.KubeletServingCAPath(certsDir))
102102
if err != nil {
103103
return err
104104
}

pkg/util/cryptomaterial/certinfo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ func KubeletClientCAPath(certsDir string) string {
171171
return filepath.Join(certsDir, "ca-bundle", "kubelet-ca.crt")
172172
}
173173

174+
func KubeletServingCAPath(certsDir string) string {
175+
return filepath.Join(certsDir, "ca-bundle", "kubelet-serving-ca.crt")
176+
}
177+
174178
func ServiceAccountTokenCABundlePath(certsDir string) string {
175179
return filepath.Join(certsDir, "ca-bundle", "service-account-token-ca.crt")
176180
}

0 commit comments

Comments
 (0)