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

Bump go-containerregistry, remove k8s-pkg-credentialprovider #409

Closed
wants to merge 4 commits into from

Conversation

benmoss
Copy link
Contributor

@benmoss benmoss commented Jun 29, 2022

Move to cloud credential helpers recommended by GGCR:
https://github.com/google/go-containerregistry/tree/main/pkg/authn#emulating-cloud-provider-credential-helpers

We had to fix our test registry to reject mount requests properly with a 202 due to the changes in google/go-containerregistry#1388

Manually validated against GCP and Azure ambient credentials, both of them work and fail gracefully when access to the metadata server is blocked.

@@ -1,760 +0,0 @@
// Copyright 2021 VMware, Inc.
Copy link
Contributor Author

@benmoss benmoss Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is basically just testing the libraries and the ordering of the keychain. It'd be nice to have some automated tests around the libraries behavior but this is the wrong level to test at. Testing the ordering of the keychain doesn't seem valuable.

@benmoss benmoss temporarily deployed to GCR e2e June 29, 2022 17:11 Inactive
@benmoss benmoss temporarily deployed to TanzuNet Registry Dev e2e June 29, 2022 17:11 Inactive
Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -40,29 +39,6 @@ func (r *RegistryFlags) Set(cmd *cobra.Command) {

cmd.Flags().DurationVar(&r.ResponseHeaderTimeout, "registry-response-header-timeout", 30*time.Second, "Maximum time to allow a request to wait for a server's response headers from the registry (ms|s|m|h)")
cmd.Flags().IntVar(&r.RetryCount, "registry-retry-count", 5, "Set the number of times imgpkg retries to send requests to the registry in case of an error")

cmd.Flags().String("registry-azure-cr-config", "", "Path to the file containing Azure container registry configuration information. ($IMGPKG_REGISTRY_AZURE_CR_CONFIG)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the docs we should make sure that we remove the existence of this flag as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to figure out the implications for the other auth providers as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that somehow magically derived in ggcr or we just no longer support azure configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ACR library we're switching to (https://github.com/chrismellard/docker-credential-acr-env/) supports pulling authentication from the environment via AZURE_CLIENT_ID/AZURE_CLIENT_SECRET/AZURE_TENANT_ID. It's what's being used by ko and cosign so it seems like an acceptable choice

@benmoss benmoss temporarily deployed to GCR e2e June 30, 2022 17:45 Inactive
@benmoss benmoss temporarily deployed to TanzuNet Registry Dev e2e June 30, 2022 17:45 Inactive
@@ -70,6 +70,9 @@ func (r *RegistryFlags) AsRegistryOpts() registry.Opts {
if os.Getenv("IMGPKG_ANON") == "true" {
opts.Anon = true
}
if os.Getenv("IMGPKG_ENABLE_IAAS_AUTH") != "false" {
opts.EnableIaasAuthProviders = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really still need this feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cppforlife thinks so, apparently users run into problems and want to be able to fallback to ignoring ambient credentials sometimes? I think especially since they are higher priority than the Docker config now, another piece of feedback

@benmoss benmoss closed this Jun 30, 2022
@benmoss benmoss reopened this Jun 30, 2022
@benmoss benmoss temporarily deployed to GCR e2e June 30, 2022 20:13 Inactive
@benmoss benmoss temporarily deployed to TanzuNet Registry Dev e2e June 30, 2022 20:13 Inactive
@benmoss benmoss marked this pull request as draft June 30, 2022 20:13
benmoss pushed a commit to benmoss/carvel-imgpkg that referenced this pull request Jul 6, 2022
@benmoss benmoss had a problem deploying to TanzuNet Registry Dev e2e July 6, 2022 16:54 Failure
benmoss pushed a commit to benmoss/carvel-imgpkg that referenced this pull request Jul 6, 2022
@benmoss benmoss had a problem deploying to TanzuNet Registry Dev e2e July 6, 2022 17:46 Failure
@benmoss benmoss temporarily deployed to TanzuNet Registry Dev e2e July 6, 2022 19:35 Inactive
@benmoss benmoss temporarily deployed to GCR e2e July 6, 2022 19:35 Inactive
@benmoss
Copy link
Contributor Author

benmoss commented Jul 7, 2022

Maybe we should consider only using the Docker/env keychains by default, and enabling workload identity/ambient credentials via a flag

@joaopapereira
Copy link
Member

joaopapereira commented Aug 24, 2022

The main change that we are currently missing is:

  • By default do not include all the keychains
  • Create a new flag --activate-keychain="gke" with possible values [gke, azure, aws, github]
  • rebase on top of develop branch

To keep backward compatibility kapp-controller would have to enable the IAAS keychains that are needed for the current installation.

@joaopapereira
Copy link
Member

going to close this PR since we merged #431 with the same commits. Thanks for the good work here @benmoss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants