Skip to content

test: add e2e test for provided credentials #730

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

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

cvvz
Copy link
Member

@cvvz cvvz commented Aug 8, 2022

What type of PR is this?
/kind test

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:
Add e2e test for provided credentials stored in k8s secret, including:

  • storage account key
  • storage account SAS token
  • service principal
  • managed identity

Release note:

Add e2e test for provided credentials stored in k8s secret, including: storage account key, storage account SAS token, service principal and managed identity.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 8, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @cvvz. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 8, 2022
@cvvz cvvz changed the title add e2e test for sas token secret add e2e test for nodeStageSecretRef Aug 8, 2022
@cvvz cvvz changed the title add e2e test for nodeStageSecretRef [WIP] add e2e test for nodeStageSecretRef Aug 8, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 8, 2022
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 8, 2022
@cvvz cvvz changed the title [WIP] add e2e test for nodeStageSecretRef [WIP] add e2e test for sas token secret Aug 8, 2022
@andyzhangx
Copy link
Member

/retest

@cvvz cvvz changed the title [WIP] add e2e test for sas token secret add e2e test for sas token secret Aug 9, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2022
pod.Volumes[n].ContainerName = containerName
var secreteData map[string]string

var run = func() {
Copy link
Member

Choose a reason for hiding this comment

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

run() only provisions different secret, I think we need to add a new e2e test case for sas token stored in k8s secret scanerio

Copy link
Member Author

@cvvz cvvz Aug 9, 2022

Choose a reason for hiding this comment

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

run() will generate different secret, pvc, pv and pod and also create and clean them up in k8s each time. Also per the name of this test case: pre_provisioned_provided_credentials_tester,I think this test case is used to test the scenario of provided credentials, which includes access key, sas token, service principal and managed identity. I think it would be more reasonable and convenient to put them all in this test case.

@cvvz cvvz changed the title add e2e test for sas token secret [WIP]add e2e test for provided credentials Aug 9, 2022
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 9, 2022
@cvvz cvvz changed the title [WIP]add e2e test for provided credentials add e2e test for provided credentials Aug 10, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 10, 2022
@cvvz
Copy link
Member Author

cvvz commented Aug 11, 2022

/retest

1 similar comment
@cvvz
Copy link
Member Author

cvvz commented Aug 11, 2022

/retest

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

pls squash all commits, and also add more details in PR description what e2e tests this PR has added, thanks.

@@ -52,8 +52,7 @@
}
},
"servicePrincipalProfile": {
"clientID": "{clientID}",
"secret": "{secret}"
"clientID": "msi"
Copy link
Member

Choose a reason for hiding this comment

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

let's keep the sp test

Copy link
Member Author

@cvvz cvvz Aug 12, 2022

Choose a reason for hiding this comment

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

This modification is to solve the problem that blobfuse mount failed when authenticate by MSI. The root cause is MSI generated by aks-engine is not assigned to VMSS.
BTW, considering sp is already tested by the most of jobs using the arm template linux.json, which set useManagedIdentity: false and

    "servicePrincipalProfile": {
        "clientID": "{clientID}", 
        "secret": "{secret}"
    }

And only job pull-blob-csi-driver-e2e-vmss uses template linux-vmss.json which set useManagedIdentity: true. Maybe we should have set

    "servicePrincipalProfile": {
        "clientID": "msi", 
    }

to test msi scenario?

Copy link
Member

Choose a reason for hiding this comment

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

per the logs, pull-blob-csi-driver-e2e is using sp

https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_blob-csi-driver/730/pull-blob-csi-driver-e2e/1557924587340042240/build-log.txt

[pod/csi-blob-controller-84cf49dc6d-zs47k/blob] I0812 03:13:38.637448       1 azure.go:104] read cloud config from file: /etc/kubernetes/azure.json successfully
[pod/csi-blob-controller-84cf49dc6d-zs47k/blob] I0812 03:13:38.638028       1 azure_auth.go:245] Using AzurePublicCloud environment
[pod/csi-blob-controller-84cf49dc6d-zs47k/blob] I0812 03:13:38.638061       1 azure_auth.go:130] azure: using client_id+client_secret to retrieve access token

pull-blob-csi-driver-e2e-vmss is using msi:
https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_blob-csi-driver/730/pull-blob-csi-driver-e2e-vmss/1557924587390373888/build-log.txt

[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934107       1 azure_auth.go:245] Using AzurePublicCloud environment
[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934127       1 azure_auth.go:96] azure: using managed identity extension to retrieve access token
[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934131       1 azure_auth.go:102] azure: using User Assigned MSI ID to retrieve access token
[pod/csi-blob-node-8trh8/blob] I0812 03:15:51.934162       1 azure_auth.go:113] azure: User Assigned MSI ID is client ID. Resource ID parsing error: %+vparsing failed for 82e9bd91-c283-4b2d-8708-6d11b07d630d. Invalid resource Id format

Copy link
Member

Choose a reason for hiding this comment

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

looks like you are right.

@cvvz cvvz changed the title add e2e test for provided credentials test: add e2e test for provided credentials Aug 12, 2022
refactor e2e for volumeAttributes

fix volumeAttribute

e2e test for provided credential: msi and sp

fix

fix

add role assignment

print authEnv

use 2020-10-01 api for authorization

use 2018-01-01-preview api for authorization

fix

try to use msi

fix e2e test

remove debug log

delete unnecessary code
@cvvz cvvz force-pushed the e2e-test-for-secret branch from c7409cf to 791d631 Compare August 12, 2022 02:58
@cvvz
Copy link
Member Author

cvvz commented Aug 12, 2022

/retest

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 12, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, cvvz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2022
@k8s-ci-robot k8s-ci-robot merged commit bff8ad5 into kubernetes-sigs:master Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants