Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix get csrSignerName from env MINIO_OPERATOR_CSR_SIGNER_NAME #2005

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pkg/controller/certificates/csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ var (

func getDefaultCsrSignerName() string {
defaultCsrSignerNameOnce.Do(func() {
if os.Getenv(CSRSignerName) != "" {
defaultCsrSignerName = os.Getenv(CSRSignerName)
return
}
defaultCsrSignerName = certificatesV1.KubeletServingSignerName
defaultCsrSignerName = os.Getenv(CSRSignerName)
})
return defaultCsrSignerName
}
Expand Down Expand Up @@ -108,8 +104,10 @@ func GetCertificatesAPIVersion(clientSet kubernetes.Interface) CSRVersion {
// GetCSRSignerName returns the signer to be used
func GetCSRSignerName(clientSet kubernetes.Interface) string {
csrSignerNameOnce.Do(func() {
// At the moment we will use kubernetes.io/kubelet-serving as the default
csrSignerName = getDefaultCsrSignerName()
if csrSignerName != "" {
return
}
// only for csr api v1 we will try to detect if we are running inside an EKS cluster and switch to AWS's way to
// get certificates using their CSRSignerName https://docs.aws.amazon.com/eks/latest/userguide/cert-signing.html
if GetCertificatesAPIVersion(clientSet) == CSRV1 {
Expand All @@ -136,6 +134,10 @@ func GetCSRSignerName(clientSet kubernetes.Interface) string {
}
}
}
if csrSignerName == "" {
// At the moment we will use kubernetes.io/kubelet-serving as the default
csrSignerName = certificatesV1.KubeletServingSignerName
}
})
return csrSignerName
}
Loading