mirror of https://github.com/kubernetes/kops.git
Rename the service account key
This commit is contained in:
parent
d1b51f6e93
commit
92cd47db1f
|
|
@ -283,7 +283,7 @@ func RunGoldenTest(t *testing.T, basedir string, key string, builder func(*Nodeu
|
|||
"kube-controller-manager": mustParsePrivateKey(dummyKey),
|
||||
"kube-proxy": mustParsePrivateKey(dummyKey),
|
||||
"kube-scheduler": mustParsePrivateKey(dummyKey),
|
||||
"master": mustParsePrivateKey(dummyKey),
|
||||
"service-account": mustParsePrivateKey(dummyKey),
|
||||
}
|
||||
keystore.certs = map[string]*pki.Certificate{
|
||||
"ca": mustParseCertificate(dummyCertificate),
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ func (b *SecretBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
}
|
||||
}
|
||||
|
||||
if err := b.BuildPrivateKeyTask(c, "master", "service-account.key", nil); err != nil {
|
||||
if err := b.BuildPrivateKeyTask(c, "service-account", "service-account.key", nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,8 +163,7 @@ func (b *PKIModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
{
|
||||
serviceAccount := &fitasks.Keypair{
|
||||
// We only need the private key, but it's easier to create a certificate as well.
|
||||
// The strange name is because Kops prior to 1.19 used the api-server TLS key for this.
|
||||
Name: fi.String("master"),
|
||||
Name: fi.String("service-account"),
|
||||
Lifecycle: b.Lifecycle,
|
||||
Subject: "cn=service-account",
|
||||
Type: "ca",
|
||||
|
|
|
|||
|
|
@ -256,6 +256,14 @@ func (c *VFSCAStore) loadOneCertificate(p vfs.Path) (*pki.Certificate, error) {
|
|||
|
||||
func (c *VFSCAStore) FindKeypair(id string) (*pki.Certificate, *pki.PrivateKey, bool, error) {
|
||||
cert, legacyFormat, err := c.findCert(id)
|
||||
|
||||
if os.IsNotExist(err) && id == "service-account" {
|
||||
// The strange name is because Kops prior to 1.19 used the api-server TLS key for this.
|
||||
id = "master"
|
||||
cert, _, err = c.findCert(id)
|
||||
legacyFormat = true
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, false, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue