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

rad credential show - support for IRSA #7757

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

nithyatsu
Copy link
Contributor

Description

rad credential show should work with the new datamodel that supports 2 aws credential types - accesskey and irsa

Type of change

Copy link

codecov bot commented Jul 23, 2024

Codecov Report

Attention: Patch coverage is 38.70968% with 38 lines in your changes missing coverage. Please review.

Project coverage is 61.03%. Comparing base (c9b6581) to head (e5a88a0).

Files Patch % Lines
pkg/cli/credential/aws_credential_management.go 0.00% 34 Missing ⚠️
pkg/cli/cmd/credential/show/show.go 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7757      +/-   ##
==========================================
- Coverage   61.07%   61.03%   -0.04%     
==========================================
  Files         521      521              
  Lines       27229    27276      +47     
==========================================
+ Hits        16630    16648      +18     
- Misses       9133     9161      +28     
- Partials     1466     1467       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nithyatsu nithyatsu temporarily deployed to functional-tests July 23, 2024 20:26 — with GitHub Actions Inactive
@radius-functional-tests
Copy link

radius-functional-tests bot commented Jul 23, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository nithyatsu/radius
Commit ref 6fda0fe
Unique ID func71d211d893
Image tag pr-func71d211d893
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func71d211d893
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func71d211d893
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func71d211d893
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func71d211d893
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting datastoresrp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ datastoresrp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@nithyatsu nithyatsu marked this pull request as ready for review July 23, 2024 20:49
@nithyatsu nithyatsu requested review from a team as code owners July 23, 2024 20:49
@@ -76,23 +76,52 @@ func Test_credentialFormat_Azure_WorkloadIdentity(t *testing.T) {
require.Equal(t, expected, buffer.String())
}

func Test_credentialFormat_AWS(t *testing.T) {
func Test_credentialFormat_AWS_AcessKey(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should write the whole name of the function.

Suggested change
func Test_credentialFormat_AWS_AcessKey(t *testing.T) {
func Test_ credentialFormatAWSAccessKey(t *testing.T) {


err := output.Write(output.FormatTable, obj, buffer, credentialFormatOutput)
require.NoError(t, err)

expected := "NAME REGISTERED ACCESSKEYID\ntest true test-access-key-id\n"
require.Equal(t, expected, buffer.String())
}

func Test_credentialFormat_AWS_IRSA(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

}

type AWSAccessKeyCredentialProperties struct {
// Kind is the credential kind (Must be AccessKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Kind is the credential kind (Must be AccessKey)
// Kind is the credential kind (must be AccessKey)

AccessKeyID *string
}

type AWSIRSACredentialProperties struct {
// Kind is the credential kind (Must be IRSA)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Kind is the credential kind (Must be IRSA)
// Kind is the credential kind (must be IRSA)

Enabled: true,
},
AWSCredentials: &AWSCredentialProperties{
Kind: (*string)(awsAccessKeyCredentials.Kind),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this ever throw a nil pointer exception or something like that? Should this conversion be done beforehand to make sure there'd be no errors?

Copy link
Contributor Author

@nithyatsu nithyatsu Jul 25, 2024

Choose a reason for hiding this comment

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

we cannot store a credential with out kind, since the data model would not permit it and throw an error saying invalid kind. Therefore upon get, this field cannnot be null.

"code": "HttpRequestPayloadAPISpecValidationFailed",
        "message": "HTTP request payload failed validation against API specification with one or more errors. Please see details for more information.",
        "target": "ucp/openapi",
        "details": [
            {
                "code": "InvalidProperties",
                "message": "$.properties.kind in body should be one of [AccessKey IRSA]"
            }
        ]

Enabled: true,
},
AWSCredentials: &AWSCredentialProperties{
Kind: (*string)(awsIRSACredentials.Kind),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we cannot store a credential with out kind, since the data model would not permit it and throw an error saying invalid kind. Therefore upon get, this field cannnot be null.

"code": "HttpRequestPayloadAPISpecValidationFailed",
"message": "HTTP request payload failed validation against API specification with one or more errors. Please see details for more information.",
"target": "ucp/openapi",
"details": [
{
"code": "InvalidProperties",
"message": "$.properties.kind in body should be one of [AccessKey IRSA]"
}
]

},
{
Heading: "ROLEARN",
JSONPath: "{ .AWSCredentials.IRSA.RoleARN }",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we also want to add HEADING: Kind ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking its a bit evident since the column name changes between rolearn and accesskey. but looks like azure credentials have a kind column. I will implement this. cc @Reshrahim @willtsai

Copy link
Contributor Author

Choose a reason for hiding this comment

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

implemented

@radius-functional-tests
Copy link

radius-functional-tests bot commented Jul 25, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository nithyatsu/radius
Commit ref 77643f7
Unique ID funcde77504be5
Image tag pr-funcde77504be5
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-funcde77504be5
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-funcde77504be5
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcde77504be5
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcde77504be5
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting datastoresrp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ datastoresrp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@nithyatsu nithyatsu force-pushed the irsa_show branch 2 times, most recently from 5d96335 to 2f23e92 Compare July 29, 2024 23:16
@nithyatsu nithyatsu temporarily deployed to functional-tests July 29, 2024 23:37 — with GitHub Actions Inactive
@radius-functional-tests
Copy link

radius-functional-tests bot commented Jul 29, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository nithyatsu/radius
Commit ref 2f23e92
Unique ID func95e7816038
Image tag pr-func95e7816038
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func95e7816038
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func95e7816038
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func95e7816038
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func95e7816038
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
⌛ Starting datastoresrp-cloud functional tests...
✅ datastoresrp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@radius-functional-tests
Copy link

radius-functional-tests bot commented Jul 30, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository nithyatsu/radius
Commit ref e5a88a0
Unique ID func63728150a6
Image tag pr-func63728150a6
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func63728150a6
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func63728150a6
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func63728150a6
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func63728150a6
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
⌛ Starting datastoresrp-cloud functional tests...
✅ corerp-cloud functional tests succeeded
✅ datastoresrp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded

@lakshmimsft lakshmimsft merged commit 9b77737 into radius-project:main Jul 30, 2024
26 checks passed
Reshrahim pushed a commit to Reshrahim/radius that referenced this pull request Aug 27, 2024
# Description

rad credential show should work with the new datamodel that supports 2
aws credential types - accesskey and irsa

## Type of change

- This pull request adds or changes features of Radius and has an
approved issue (issue link required).
Partially Fixes: radius-project#7618

---------

Signed-off-by: nithyatsu <[email protected]>
Signed-off-by: Reshma Abdul Rahim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add IRSA (workload identity) support for AWS cloud provider
4 participants