-
Notifications
You must be signed in to change notification settings - Fork 19
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
support private Aws Ecr helm repositories for chart dependencies #200
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: github-automations <[email protected]>
s := os.Getenv("ECR_LOGIN_ENABLED") | ||
ecr_login_enabled, err := strconv.ParseBool(s) | ||
if err != nil { | ||
log.Fatal() | ||
} | ||
|
||
if ecr_login_enabled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you modify the args to include something like cfg config.ServerConfig
, then you can clean up some of this:
s := os.Getenv("ECR_LOGIN_ENABLED") | |
ecr_login_enabled, err := strconv.ParseBool(s) | |
if err != nil { | |
log.Fatal() | |
} | |
if ecr_login_enabled { | |
if cfg.EcrLoginEnabled { |
You can pass it into the call to GetManifestsLocal
in worker.go, roughly like 110, by passing w.ctr.Config
|`KUBECHECKS_ARGOCD_API_SERVER_ADDR`|ArgoCD API Server Address.|`argocd-server`| | ||
|`KUBECHECKS_ARGOCD_API_TOKEN`|ArgoCD API token.|| | ||
|`KUBECHECKS_AWS_ECR_HOST`|The Aws ecr host. i.e: <account-id>.dkr.ecr.<region>.amazonaws.com.|| | ||
|`KUBECHECKS_ECR_LOGIN_ENABLED`|Enable Aws Ecr login and helm dependency build for chart dependencies that are hosted on Aws private Ecr repositories.|`false`| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this, or is it enough to have KUBECHECKS_AWS_ECR_HOST
be set to a non-empty string?
) | ||
|
||
// Retrieve token for authentication against ECR registries. | ||
func getToken(aws_ecr_host string) (string, error) { | ||
os.Setenv("AWS_SDK_LOAD_CONFIG", "1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to set this here, we'd rather allow the user to set this when running the application
// Retrieve token for authentication against ECR registries. | ||
func getToken(aws_ecr_host string) (string, error) { | ||
os.Setenv("AWS_SDK_LOAD_CONFIG", "1") | ||
var region = strings.SplitN(string(aws_ecr_host), ".", 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var region = strings.SplitN(string(aws_ecr_host), ".", 6) | |
var region = strings.SplitN(aws_ecr_host, ".", 6) |
) | ||
|
||
// Retrieve token for authentication against ECR registries. | ||
func getToken(aws_ecr_host string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more nitpicking:
func getToken(aws_ecr_host string) (string, error) { | |
func getToken(awsECRHost string) (string, error) { |
var aws_ecr_host = os.Getenv("AWS_ECR_HOST") | ||
var currToken = "" | ||
if token, err := getToken(aws_ecr_host); err != nil { | ||
fmt.Println(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll want to return this error, as we won't want to login to the registry if we can't get a token
return parts[1], nil | ||
} | ||
|
||
func helmLogin(tempRepoDir string, changedAppFilePath string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nitpicky:
func helmLogin(tempRepoDir string, changedAppFilePath string) error { | |
func helmLogin(tempRepoDir, changedAppFilePath string) error { |
can this be applicable to also Google artifact Registry/GCR repos? |
u will need to re implement the get token function using google gcp library:
} and u will need to change the hardcoded username: "AWS" from the helmLogin function, that's all. |
i take diffrent approach for gcp gar: #308 |
No description provided.