Skip to content

Commit

Permalink
Corrected certificate managment for OCI helm charts (#16656) (#17321)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Block <[email protected]>
Co-authored-by: Andrew Block <[email protected]>
Co-authored-by: Soumya Ghosh Dastidar <[email protected]>
  • Loading branch information
3 people authored Feb 27, 2024
1 parent 7cac5a8 commit 7aac4ba
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions util/helm/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,28 @@ func (c *Cmd) RegistryLogin(repo string, creds Creds) (string, error) {
args = append(args, "--password", creds.Password)
}

if creds.CAPath != "" {
args = append(args, "--ca-file", creds.CAPath)
}

if len(creds.CertData) > 0 {
filePath, closer, err := writeToTmp(creds.CertData)
if err != nil {
return "", err
}
defer argoio.Close(closer)
args = append(args, "--cert-file", filePath)
}

if len(creds.KeyData) > 0 {
filePath, closer, err := writeToTmp(creds.KeyData)
if err != nil {
return "", err
}
defer argoio.Close(closer)
args = append(args, "--key-file", filePath)
}

if creds.InsecureSkipVerify {
args = append(args, "--insecure")
}
Expand Down Expand Up @@ -238,6 +260,25 @@ func (c *Cmd) PullOCI(repo string, chart string, version string, destination str
if creds.CAPath != "" {
args = append(args, "--ca-file", creds.CAPath)
}

if len(creds.CertData) > 0 {
filePath, closer, err := writeToTmp(creds.CertData)
if err != nil {
return "", err
}
defer argoio.Close(closer)
args = append(args, "--cert-file", filePath)
}

if len(creds.KeyData) > 0 {
filePath, closer, err := writeToTmp(creds.KeyData)
if err != nil {
return "", err
}
defer argoio.Close(closer)
args = append(args, "--key-file", filePath)
}

if creds.InsecureSkipVerify && c.insecureSkipVerifySupported {
args = append(args, "--insecure-skip-tls-verify")
}
Expand Down

0 comments on commit 7aac4ba

Please sign in to comment.