Feat: leverage the secret to read authorization token

Merged
AN
3mo ago
+313-7

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 CR and 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 reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels 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 headersFromSecret to the CUE schema, Go Request, and chart request definition; each entry uses {header, secret, key}.
    • Resolves header values at runtime via KubeClient using the process context namespace; defaults Content-Type: application/json when no headers are set.
    • Clear errors when KubeClient is 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.