kubeshop / testkube

☸️ Kubernetes-native testing framework for test execution and orchestration
https://testkube.io
Other
1.33k stars 130 forks source link

Give 401 auth error after using kubectl testkube api #5872

Open TWpower opened 4 days ago

TWpower commented 4 days ago

Describe the bug When using kubectl testkube api, the call works fine initially, but after about an hour, it returns the following error. The error occurs at the end after using the --watch command. Could you help me identify the problem? My GCP authentication is set to expire after 4 hours. Where and why is the authorization fail?

To Reproduce Steps to reproduce the behavior:

  1. Run "kubectl testkube run test $test_name --namespace $namespace --watch"
  2. See error
    
    Request URI:    http://10.7.106.111/infra/target-sources/1457/assume-roles/?isReadOnly=false
    07:23:16.819 [main] INFO  c.s.b.d.i.i.CheckServiceCodeExistTest - Cleanup of assume role done
    07:23:16.820 [main] INFO  c.s.b.d.i.i.CheckServiceCodeExistTest - cleaning test environment done
    [INFO] Tests run: 19, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3649 s -- in com.samsung.bigdata.dip.integrationtest.pipeline.meta.SchemaManagerLoadTest
    [INFO] 
    [INFO] Results:
    [INFO] 
    [INFO] Tests run: 19, Failures: 0, Errors: 0, Skipped: 0
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  01:01 h
    [INFO] Finished at: 2024-09-26T07:23:16Z
    [INFO] ------------------------------------------------------------------------

get test execution details (error: api/GET-testkube.Execution returned error: api server response: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401}

' error: Unauthorized)

Error: Process completed with exit code 1.


**Expected behavior**
- It should not give me a authorization error.

**Version / Cluster**
- Which testkube version? 1.16.39
- What Kubernetes cluster? GKE
- What Kubernetes version?

Client Version: v1.30.0 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.30.3-gke.1969001

vsukhin commented 4 days ago

hey, @TWpower Looks like an interesting issue.

I saw some requests about mismatching between token expiration and policy settings https://www.googlecloudcommunity.com/gc/Cloud-Hub/gcloud-token-is-expiring-every-1hour/td-p/733736

But might be, it was just near the end of token expiration tine, when you started the test, so it's expired during test executiom? So,