feat(defkit): experimental addon to install DefKit definition modules
Description of your changes
A new experimental addon for installing DefKit definition modules (Go modules of X-Definitions, such as vela-go-definitions) as Applications, so a cluster can take its definitions from a module and keep them in step with it.
Each module is an Application whose workflow renders, waits for review, then applies:
workflow:
steps:
- name: render
type: defkit-render
properties:
git: https://github.com/kubevela/vela-go-definitions
version: main
prefix: dk-
types: [trait]
outputs:
- name: rendered
valueFrom: configMap
- name: review
type: suspend
- name: apply
type: defkit-apply
inputs:
- from: rendered
parameterKey: configMap
defkit-renderruns a Job that loads the module the wayvela def apply-moduledoes and writes what it generates to a ConfigMap. It runs in its ownvela-defkitnamespace, under an account that may only write ConfigMaps there.defkit-applyapplies the rendered definitions as the Application's resources, so it tracks them and garbage collects any a new version drops.
The render tool and its Dockerfile are in render/ (it builds against KubeVela v1.11.0). Its image, oamdev/defkit-render:v0.1.0, isn't published yet: could a maintainer build and push it? It's multi-arch:
docker buildx build --platform linux/amd64,linux/arm64 -t oamdev/defkit-render:v0.1.0 experimental/addons/defkit/render/
The image parameter takes another image in the meantime.
How has this code been tested?
On k3d with KubeVela v1.10.1, with the image built from render/ and loaded into the cluster:
- The addon enables, and its Application runs; both WorkflowStepDefinitions are installed.
examples/vela-definitions-traits.yamlrenders vela-go-definitions atmain, then suspends for review.- After
vela workflow resume, the Application isrunningand all 29 traits are applied asdk-*.
Summary by cubic
Adds an experimental defkit addon that installs DefKit definition modules (Go modules of X-Definitions) as Applications. Each module is an Application whose workflow renders it in a Job, waits for review, then applies its definitions, which the Application tracks and garbage collects when a new version drops them.
The render Job runs in the vela-defkit namespace. The module's code runs in a tokenless container; only a separate write container mounts the account token, which may write config maps there and nothing else. Renders are scoped per module namespace and redact Git credentials from output and step messages. The apply step fails, applying nothing, when the render can't be read, is missing definitions.json, or produced errors.
Rollout
oamdev/defkit-render:v0.1.0is not published yet; a maintainer must build and push it, or set theimageparameter to a locally built image.