m/node/kubernetes/pki: refactor out CA functionality
This factors out all non-k8s-specific CA functionality from
metropolis/node/kubernetes/pki into metropolis/pkg/pki.
This will allow us to re-use the same PKI-in-CA system to issue
certificates for the Metropolis cluster and nodes.
We also drive-by change some Kubernetes/PKI interactions to make things
cleaner. Notably, this implements Certificate.Mount to return a
fileargs.FileArgs containing all the files neede to use this
Certificate.
Test Plan: covered by current e2e tests. An etcd harness to test this independently would be nice, though.
X-Origin-Diff: phab/D709
GitOrigin-RevId: bdc9ff215b94c9192f65c6da8935fe2818fd14ad
diff --git a/metropolis/node/core/main.go b/metropolis/node/core/main.go
index 3cf75ce..0f6ebd1 100644
--- a/metropolis/node/core/main.go
+++ b/metropolis/node/core/main.go
@@ -197,7 +197,7 @@
// Ensure Kubernetes PKI objects exist in etcd.
kpkiKV := m.ConsensusKV("cluster", "kpki")
- kpki := pki.NewKubernetes(lt.MustLeveledFor("pki.kubernetes"), kpkiKV)
+ kpki := pki.New(lt.MustLeveledFor("pki.kubernetes"), kpkiKV)
if err := kpki.EnsureAll(ctx); err != nil {
return fmt.Errorf("failed to ensure kubernetes PKI present: %w", err)
}