Skip to content

feat(defkit): experimental addon to install DefKit definition modules - #799

Merged
anoop2811 merged 13 commits into
kubevela:masterfrom
briankane:feat/experimental-defkit
Oct 15, 2026
Merged

anoop2811 merged 13 commits into
kubevela:masterfrom
briankane:feat/experimental-defkit

Conversation

@briankane

@briankane briankane commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

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-render runs a Job that loads the module the way vela def apply-module does and writes what it generates to a ConfigMap. It runs in its own vela-defkit namespace, under an account that may only write ConfigMaps there.
  • defkit-apply applies 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.yaml renders vela-go-definitions at main, then suspends for review.
  • After vela workflow resume, the Application is running and all 29 traits are applied as dk-*.

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.0 is not published yet; a maintainer must build and push it, or set the image parameter to a locally built image.

Written for commit e244fa9. Summary will update on new commits.

View guided diff

A module is an Application that renders it in a Job, waits for review,
then applies its definitions, which the Application tracks and garbage
collects. The render tool and its Dockerfile are in render/.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 11 files

Tip: instead of fixing issues one by one fix them all with cubic

Turn on auto-fix | Re-trigger cubic

Comment thread experimental/addons/defkit/template.cue Resolved
@anoop2811

Copy link
Copy Markdown
Member

@briankane , can you take care of the cubic reviews

An empty render wrote null for definitions.json and errors.json; both are always JSON lists.

Signed-off-by: Brian Kane <briankane1@gmail.com>
module.json and clone errors carry the repository URL without its userinfo.

Signed-off-by: Brian Kane <briankane1@gmail.com>
The URL may carry credentials, and the step message is shown wherever the workflow is.

Signed-off-by: Brian Kane <briankane1@gmail.com>
A failed ConfigMap read, or a render without definitions.json, fails the step rather than applying an empty list.

Signed-off-by: Brian Kane <briankane1@gmail.com>
A definition that failed to render fails the step, naming the first few errors, and nothing is applied.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Pruning selects defkit.oam.dev/render=true as well as the module, the labels a render is written with.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Renders and their Job carry defkit.oam.dev/module-namespace, and pruning selects it, so same-named modules in different namespaces keep their own renders.

Signed-off-by: Brian Kane <briankane1@gmail.com>
The render Job runs the module in a tokenless init container and writes its result from a second container, the only one that mounts the token.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Each repositories entry names its module by exactly one of git and ref, as the render step takes it.

Signed-off-by: Brian Kane <briankane1@gmail.com>
A multi-platform buildx build stays in the build cache unless it is pushed.

Signed-off-by: Brian Kane <briankane1@gmail.com>
The example keeps them with keepLegacyResource, and the readme now says so.

Signed-off-by: Brian Kane <briankane1@gmail.com>
Signed-off-by: Brian Kane <briankane1@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

@anoop2811
anoop2811 merged commit fe24533 into kubevela:master Oct 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants