-
Notifications
You must be signed in to change notification settings - Fork 274
ref(certs): use secretRef for Vault token in MRC #4736
Changes from all commits
83f9adb
4dbb8f9
b33a2c8
02ce0c9
138087a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,11 @@ func NewCertificateManager(kubeClient kubernetes.Interface, kubeConfig *rest.Con | |
}, | ||
} | ||
|
||
// TODO(#4745): Remove after deprecating the osm.vault.token option. | ||
if vaultOption, ok := options.(VaultOptions); ok { | ||
mrcClient.MRCProviderGenerator.DefaultVaultToken = vaultOption.VaultToken | ||
} | ||
|
||
jaellio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return certificate.NewManager(mrcClient, cfg.GetServiceCertValidityPeriod(), msgBroker) | ||
} | ||
|
||
|
@@ -99,7 +104,7 @@ func (c *MRCProviderGenerator) getTresorOSMCertificateManager(mrc *v1alpha2.Mesh | |
return nil, errors.New("Root cert does not have a private key") | ||
} | ||
|
||
rootCert, err = k8s.GetCertificateFromSecret(mrc.Namespace, mrc.Spec.Provider.Tresor.SecretName, rootCert, c.kubeClient) | ||
rootCert, err = k8s.GetCertificateFromSecret(mrc.Namespace, mrc.Spec.Provider.Tresor.CA.SecretRef.Name, rootCert, c.kubeClient) | ||
if err != nil { | ||
return nil, fmt.Errorf("Failed to synchronize certificate on Secrets API : %w", err) | ||
} | ||
|
@@ -125,9 +130,10 @@ func (c *MRCProviderGenerator) getHashiVaultOSMCertificateManager(mrc *v1alpha2. | |
|
||
// A Vault address would have the following shape: "http://vault.default.svc.cluster.local:8200" | ||
vaultAddr := fmt.Sprintf("%s://%s:%d", provider.Protocol, provider.Host, provider.Port) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if c.VaultToken is empty, we should query the secret ref There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, I wasn't going to include querying the secret ref as a part of this change. I was focussing on updating the MRC CRD while also supporting the existing requirement to set the Vault token on install. I am happy to include this as a part of the change if you think that would make more sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a TODO |
||
// TODO(#4502): If the DefaultVaultToken is empty, query the mrc.provider.vault.token.secretRef. | ||
vaultClient, err := vault.New( | ||
vaultAddr, | ||
provider.Token, | ||
c.DefaultVaultToken, | ||
provider.Role, | ||
) | ||
if err != nil { | ||
|
Uh oh!
There was an error while loading. Please reload this page.