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

PWX-37884 Refactor px serviceaccount token integration test #1615

Merged
merged 4 commits into from
Jul 29, 2024

Conversation

ssz1997
Copy link
Collaborator

@ssz1997 ssz1997 commented Jul 25, 2024

What this PR does / why we need it:
Move token verification, that the token inside px runc container is the same as in the created secret, to storage cluster verification.

Verify that the token is refreshed stays in the integration test.

Signed-off-by: shsun_pure <shsun@purestorage.com>
err = testutil.ValidateStorageCluster(ci_utils.PxSpecImages, cluster, ci_utils.DefaultValidateDeployTimeout, ci_utils.DefaultValidateDeployRetryInterval, true, "")
pxSaSecret, err = coreops.Instance().GetSecret(pxutil.PortworxServiceAccountTokenSecretName, cluster.Namespace)
require.NoError(t, err)
recreatedToken := string(pxSaSecret.Data[core.ServiceAccountTokenKey])
require.NotEqual(t, refreshedToken, recreatedToken, "the token did not get refreshed")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should also delete cluster after this test

		// Delete and validate the deletion
		ci_utils.UninstallAndValidateStorageCluster(cluster, t)

@ssz1997 ssz1997 merged commit 28cc6a7 into master Jul 29, 2024
9 checks passed
ssz1997 added a commit that referenced this pull request Jul 29, 2024
* refactor test

Signed-off-by: shsun_pure <shsun@purestorage.com>

* uninstall cluster and verify token secret deletion

* address comments

* fix test

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>
ssz1997 added a commit that referenced this pull request Jul 30, 2024
#1617)

* [PWX-37620] Create/Refresh token and secret and mount to oci-mon pod (#1582)

* create and refresh token/secret

Signed-off-by: shsun_pure <shsun@purestorage.com>

* mount self-managed servceaccount secret to oci-mon pod

Signed-off-by: shsun_pure <shsun@purestorage.com>

* always use the refreshing token for px

Signed-off-by: shsun_pure <shsun@purestorage.com>

* fix only modify arr copy

Signed-off-by: shsun_pure <shsun@purestorage.com>

* move token management to basic; fix keep adding secret vol to spec

* merge master

* fix and add tests; fix token refresh duration unit

* update secret mount path

* address comments

* address more comments

* make token refresh interval a parameter

* fix token secret expiration data; address comments

* fix failed UT from master branch

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>

* PWX-37620 Vendor in latest sched ops (#1571)

* vendor in latest sched ops

Signed-off-by: shsun_pure <shsun@purestorage.com>

* fix generated mock

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>

* fix compile due to manually resolving conflicts

* PWX-37982 Use the expiration time returned by k8s api server for px sa token (#1596)

* use the expiration time returned by k8s api server

Signed-off-by: shsun_pure <shsun@purestorage.com>

* add comment for the change

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>

* Fix PX ServiceAccount token audience (#1602)

* fix px sa token audience

Signed-off-by: shsun_pure <shsun@purestorage.com>

* remove token audience

Signed-off-by: shsun_pure <shsun@purestorage.com>

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>

* PWX-38064 Update ca.crt in the PX ServiceAccount Secret if updated (#1606)

* update ca.crt in the secret if updated

Signed-off-by: shsun_pure <shsun@purestorage.com>

* address comments

* fix test, add setter for ca cert

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>

* PWX-37884 Add portworx serviceaccount token refresh integration test (#1598)

* addPxSaTokenIntegrationTest

Signed-off-by: shsun_pure <shsun@purestorage.com>

* try see if k8s enforce token minimum expiration time

* add testrail id

* add manually delete secaret scenario test

* add test log lines

* change token refresh time to 10min

* fix test and address comments

* use the token to make an k8s api call

* address comment

* skip pdb validation for certain versions of operator and px

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>

* PWX-37884 Refactor px serviceaccount token integration test (#1615)

* refactor test

Signed-off-by: shsun_pure <shsun@purestorage.com>

* uninstall cluster and verify token secret deletion

* address comments

* fix test

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>

* fix tests

---------

Signed-off-by: shsun_pure <shsun@purestorage.com>
Co-authored-by: shsun_pure <shsun@purestorage.com>
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.

3 participants