File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package k8s
33import (
44 "context"
55 "fmt"
6+ "os"
67 "strings"
78
89 "github.com/google/go-containerregistry/pkg/name"
@@ -56,6 +57,23 @@ func GetACRCredentialLoader() []creds.CredentialsCallback {
5657 return oci.Credentials {}, nil
5758 }
5859
60+ // HACK: Override credentials if they were given in environment
61+ if acrToken := os .Getenv ("ACR_TOKEN" ); acrToken != "" {
62+ return oci.Credentials {
63+ Username : "00000000-0000-0000-0000-000000000000" ,
64+ Password : acrToken ,
65+ }, nil
66+ } else {
67+ acrUser := os .Getenv ("ACR_USERNAME" )
68+ acrPassword := os .Getenv ("ACR_PASSWORD" )
69+ if acrUser != "" && acrPassword != "" {
70+ return oci.Credentials {
71+ Username : acrUser ,
72+ Password : acrPassword ,
73+ }, nil
74+ }
75+ }
76+
5977 // TODO: Save token somewhere and check expiration before asking for a new one
6078
6179 azCredential , err := azidentity .NewDefaultAzureCredential (nil )
You can’t perform that action at this time.
0 commit comments