Feat: leverage the secret to read authorization token
Merged
AN
3mo ago+313+313+012345678901234567890123456789-7-7-0123456789
Description of your changes
- This PR support to pass the authorization header as the part of kubernetes secret. Previously, we have to hardcode the token in the
Application CRand now we can pass the reference of the secret and it take that token from k8s secret.
Fixes https://github.com/kubevela/kubevela/issues/7104
I have:
- Read and followed KubeVela's contribution process.
- Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
- Run
make reviewableto ensure this PR is ready for review. - Added
backport release-x.ylabels to auto-backport this PR if necessary.
How has this code been tested
Special notes for your reviewer
Summary by cubic
Allow pkg/providers/http to read HTTP headers (e.g., Authorization) from Kubernetes Secrets via headersFromSecret, removing hardcoded tokens in Application CRs and simplifying config.
- New Features
- Added
headersFromSecretto the CUE schema, GoRequest, and chartrequestdefinition; each entry uses{header, secret, key}. - Resolves header values at runtime via
KubeClientusing the process context namespace; defaultsContent-Type: application/jsonwhen no headers are set. - Clear errors when
KubeClientis missing, the Secret is not found, or the key is missing. - Added unit tests (success, missing secret/key, namespace resolution) and an e2e test with a mock server to verify Authorization injection.
- Added