LFX Mentorship: Secret-Sourced HTTP Headers and CRD-Based Config Management
Hi, I'm Anish Bista. In this post I want to share what I built as an LFX Mentee with KubeVela, mentored by Chaitanya Reddy and Jerrin Francis. My project, Secret-Sourced HTTP Headers and CRD-Based Config Management (#7104), was about how KubeVela handles sensitive data: I gave the request workflow step a way to read header values from Secrets, and I moved Config Management onto real Kubernetes CRDs. Header secrets are available from KubeVela v1.11.1, and the Config CRDs are the headline feature of KubeVela v1.12.
The problem
KubeVela's handling of secrets and configuration had two gaps:
- The
requeststep could not read a Secret. To call an authenticated endpoint, you had to write the token in plain text in theApplicationspec. Anyone could then read it withkubectl get, in Git history and in audit logs. The same provider already read Secrets fortlsConfig, but not for headers. - Config Management had no API. Templates and configs were stored as labelled ConfigMaps and Secrets. There was no Kubernetes type, no server-side validation, and the CLI, the workflow engine and VelaUX each applied the rules in their own way.
The project tackled them as two tracks, each with its own design, implementation and tests.
Track 1: headersFromSecret on the request step
The request step now takes a headersFromSecret list. Each entry names a header, a Secret and a key in that Secret. When the step runs, it reads the value from the Secret in the Application's namespace and sets it as the header:
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: call-protected-api
namespace: default
spec:
components: []
workflow:
steps:
- name: call-api
type: request
properties:
url: https://api.example.com/v1/validate
method: GET
headersFromSecret:
- header: Authorization
secret: api-creds # Secret in the Application's namespace
key: token # its value becomes the header value
The token never appears in the Application, so kubectl get app -o yaml shows only the Secret's name. A few details of how it works:
- The Secret is read in Go, after CUE evaluation. The value never goes through the CUE template, which avoids the interpolation problems you get when you try to build a header from a Secret in CUE.
- A header from
headersFromSecretreplaces a plainheaderentry with the same name. - If the Secret or the key is missing, the step fails with an error that names both, instead of sending the request without the header.
The provider change is in kubevela/workflow#229, and kubevela/kubevela#7292 exposes the field on the request step definition. It was backported, so it's available from KubeVela v1.11.1.
Track 2: ConfigTemplate and Config CRDs
I also wrote the design proposal, kubevela/kubevela#7308, which records the API and the decisions behind it. The implementation, kubevela/kubevela#7211, adds the config.oam.dev/v1alpha1 API group:
ConfigTemplateholds the CUE template, plus itsscope(systemornamespace) and whether it issensitive.Configfills a template in, with inlinepropertiesor withpropertiesFrom, which reads them from a Secret.- Controllers parse each
ConfigTemplateand extract its parameter schema, and render eachConfiginto a Secret that theConfigowns, rendering it again when the template or the source Secret changes. - A validating webhook checks each
Configagainst its template: the properties against the schema, the template's own validation rules, and thatpropertiesandpropertiesFromare not both set. AConfigwritten by the CLI or applied withkubectlmeets the same checks. - CLI support in
vela config-templateandvela config.
Here is a sensitive, cluster-wide template for database credentials, and a Config in another namespace that uses it:
apiVersion: config.oam.dev/v1alpha1
kind: ConfigTemplate
metadata:
name: db-credentials
namespace: vela-system
spec:
scope: system # usable from any namespace
sensitive: true # values are never returned by read operations
template: |
template: {
parameter: {
username: string
password: string
}
output: {
apiVersion: "v1"
kind: "Secret"
stringData: {
username: parameter.username
password: parameter.password
}
}
}
---
apiVersion: v1
kind: Secret
metadata:
name: raw-db-creds
namespace: default
stringData:
properties: '{"username": "alice", "password": "s3cr3t-pass"}' # read from the "properties" key by default
---
apiVersion: config.oam.dev/v1alpha1
kind: Config
metadata:
name: prod-db
namespace: default
spec:
templateRef:
name: db-credentials
namespace: vela-system
propertiesFrom:
secretRef:
name: raw-db-creds
The controller reads raw-db-creds, renders it against the template and writes the result to a prod-db Secret in default. It renders again when raw-db-creds changes, and Kubernetes garbage-collects prod-db when you delete the Config.
The CLI does the same without any YAML. The template file carries the same settings in a metadata block:
metadata: {
name: "db-credentials"
scope: "system"
sensitive: true
}
template: {
parameter: {
username: string
password: string
}
output: {
apiVersion: "v1"
kind: "Secret"
stringData: {
username: parameter.username
password: parameter.password
}
}
}
vela config-template apply -f db-credentials.cue
vela config create prod-db --template=db-credentials -n default \
username=alice password=s3cr3t-pass
Because the template is sensitive, vela config create doesn't put the values in the Config. It stores them in a prod-db-properties Secret and points propertiesFrom at it for you.
After the merge
When #7211 merged, the new API worked, but clusters that already had legacy configs had no upgrade path yet. Once the CRDs were installed, vela config list only showed CRs, so configs made by older CLIs, addons or VelaUX disappeared from the CLI. A global --config-mode auto|legacy|crd flag also left two write paths in use. My mentor Jerrin Francis tracked the remaining work in #7410 and finished it in an eight-part series before the release:
- Both backends, one write path (#7439). The CLI reads and deletes both legacy objects and CRs, and writes only CRs.
vela config listgets aSOURCEcolumn, and--config-modenow only filters the twolistcommands. #7420 by Abhishek Prasad fixed template listing to include CRs. - Migration (#7449, #7453).
vela config-template migrateadopts legacy templates and configs into CRs and deletes nothing, so a downgrade keeps working. TheAutoMigrateLegacyConfigsfeature gate (Alpha, off by default) runs the same migration each time the controller starts; a second run changes nothing. - Controller parity (#7457, #7470). The
Configcontroller now publishes to Nacos, and thecreate-config,read-config,list-configanddelete-configworkflow steps work withConfigCRs. - Tighter API contracts (#7481, #7501). A
systemtemplate must live invela-system. Using a namespace-scoped template from another namespace needsgetpermission on thatConfigTemplate.sensitivecan be turned on but never off, and aConfigthat usespropertiesFromis always treated as sensitive. - GitOps and upgrade e2e tests (#7518).
All of this is planned for the upcoming KubeVela v1.12.0 release, and you can try it now in the v1.12.0-alpha.3 pre-release. To upgrade an existing cluster, see Migrate Configs to ConfigTemplate and Config, and for the full API see the Config Template reference.
Demo
Beyond the mentorship
Alongside the mentorship, I also worked on:
- Kubernetes dependency upgrade (#7238). I mapped which KubeVela repos had to move, and in what order, to get off the end-of-life Kubernetes v1.31, and opened the initial upgrade PRs across terraform-controller, pkg, workflow, prism, kube-trigger, kubevela-core-api and kubevela. Along the way I found that six of these repos depended on
kmodules/apiserver-runtime, a fork of the long-unmaintainedkubernetes-sigs/apiserver-runtime. I raised it with the community, and as part of the bump I replaced it with the canonicalk8s.io/apiserverlibrary. Other KubeVela maintainers then took the upgrade the rest of the way, building on top of my commits. - terraform-controller fixes (#403): git-over-SSH clones no longer hang on a read-only
ssh-agentsocket, and aConfigurationno longer stays stuck inProvisioningAndCheckingafterterraform applysucceeds. - Enhancement issue template (#7242) for the main repo.
Thank you
My mentorship journey has been great. Working across many KubeVela repositories, on a Go provider, CUE definitions, CRDs, controllers and webhooks, showed me the broader KubeVela ecosystem and how its pieces fit together. I also got the chance to meet the KubeVela team in person at KubeCon India 2026, and it was a pleasure to talk with them.
Thank you to my mentors Chaitanya Reddy and Jerrin Francis. It was great working with you.
