-
Notifications
You must be signed in to change notification settings - Fork 550
feat(auth) - support aws sdk v2 for registry auth #3806
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
Open
ash-thakur-rh
wants to merge
8
commits into
eclipse-jkube:master
Choose a base branch
from
ash-thakur-rh:feat-aws-sdk-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6a81855
feat(auth) - support aws sdk v2 for registry auth
ash-thakur-rh 54fed51
feat(auth) - update changelog
ash-thakur-rh 5aaa6a1
Add more tests
ash-thakur-rh 1e801d1
fix tests
ash-thakur-rh d3fdd73
Merge branch 'master' into feat-aws-sdk-v2
ash-thakur-rh 2b566c9
feat(aws-ecr): ecr error handling
ash-thakur-rh 7bd9f44
feat(aws-ecr): remove unused tests
ash-thakur-rh a3ebde7
feat(aws-ecr): remove unused tests
ash-thakur-rh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...c/main/java/org/eclipse/jkube/kit/build/service/docker/auth/ecr/AbstractAwsSdkHelper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright (c) 2019 Red Hat, Inc. | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at: | ||
| * | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Red Hat, Inc. - initial API and implementation | ||
| */ | ||
| package org.eclipse.jkube.kit.build.service.docker.auth.ecr; | ||
|
|
||
| /** | ||
| * Abstract base class for AWS SDK helpers. | ||
| * Contains common functionality shared between AWS SDK v1 and v2 helpers. | ||
| */ | ||
| abstract class AbstractAwsSdkHelper implements AwsSdkAuthHelper { | ||
| protected static final String ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID"; | ||
| protected static final String SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"; | ||
| protected static final String SESSION_TOKEN = "AWS_SESSION_TOKEN"; | ||
| protected static final String CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; | ||
| protected static final String METADATA_ENDPOINT = "ECS_METADATA_ENDPOINT"; | ||
|
|
||
| @Override | ||
| public String getAwsAccessKeyIdEnvVar() { | ||
| return System.getenv(ACCESS_KEY_ID); | ||
| } | ||
|
|
||
| @Override | ||
| public String getAwsSecretAccessKeyEnvVar() { | ||
| return System.getenv(SECRET_ACCESS_KEY); | ||
| } | ||
|
|
||
| @Override | ||
| public String getAwsSessionTokenEnvVar() { | ||
| return System.getenv(SESSION_TOKEN); | ||
| } | ||
|
|
||
| @Override | ||
| public String getAwsContainerCredentialsRelativeUri() { | ||
| return System.getenv(CONTAINER_CREDENTIALS_RELATIVE_URI); | ||
| } | ||
|
|
||
| @Override | ||
| public String getEcsMetadataEndpoint() { | ||
| return System.getenv(METADATA_ENDPOINT); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...r/src/main/java/org/eclipse/jkube/kit/build/service/docker/auth/ecr/AwsSdkAuthHelper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /* | ||
| * Copyright (c) 2019 Red Hat, Inc. | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at: | ||
| * | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Red Hat, Inc. - initial API and implementation | ||
| */ | ||
| package org.eclipse.jkube.kit.build.service.docker.auth.ecr; | ||
|
|
||
| import org.eclipse.jkube.kit.build.api.auth.AuthConfig; | ||
|
|
||
| /** | ||
| * Interface for AWS SDK authentication helpers. | ||
| * Supports both AWS SDK v1 and v2 through reflection to avoid hard dependencies. | ||
| */ | ||
| public interface AwsSdkAuthHelper { | ||
|
|
||
| /** | ||
| * Check if AWS SDK is present in the classpath. | ||
| * | ||
| * @return true if AWS SDK is available, false otherwise | ||
| */ | ||
| boolean isAwsSdkAvailable(); | ||
|
|
||
| /** | ||
| * Get AWS SDK version. | ||
| * | ||
| * @return version string (e.g., "v1", "v2") | ||
| */ | ||
| String getSdkVersion(); | ||
|
|
||
| /** | ||
| * Get AWS Access Key ID from environment variable. | ||
| * | ||
| * @return AWS Access Key ID or null | ||
| */ | ||
| String getAwsAccessKeyIdEnvVar(); | ||
|
|
||
| /** | ||
| * Get AWS Secret Access Key from environment variable. | ||
| * | ||
| * @return AWS Secret Access Key or null | ||
| */ | ||
| String getAwsSecretAccessKeyEnvVar(); | ||
|
|
||
| /** | ||
| * Get AWS Session Token from environment variable. | ||
| * | ||
| * @return AWS Session Token or null | ||
| */ | ||
| String getAwsSessionTokenEnvVar(); | ||
|
|
||
| /** | ||
| * Get AWS Container Credentials Relative URI from environment variable. | ||
| * | ||
| * @return relative URI or null | ||
| */ | ||
| String getAwsContainerCredentialsRelativeUri(); | ||
|
|
||
| /** | ||
| * Get ECS Metadata Endpoint. | ||
| * | ||
| * @return ECS metadata endpoint URL | ||
| */ | ||
| String getEcsMetadataEndpoint(); | ||
|
|
||
| /** | ||
| * Get AWS credentials using default credentials provider chain. | ||
| * | ||
| * @return AuthConfig with credentials or null if not available | ||
| */ | ||
| AuthConfig getCredentialsFromDefaultCredentialsProvider(); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In the prior version this was falling back to (http://169.254.170.2)
I see this documented here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v2.html
We might want to keep the fallback