Testing plugins locally
Run a plugin against the local platform: the platform stores its definition, a sandbox cluster runs it, the console shows it.
k3d-fundament (platform) k3d-fundament-plugin (sandbox)┌─────────────────────────────┐ ┌─────────────────────────────┐│ marketplace-registry-api │◄──────┤ just plugins publish ││ │ │ ││ marketplace-catalog-api ├──────►│ plugin-controller ││ relays │ runs plugin-<org>--<name> ││ kube-api-proxy │ │ ││ plugin-proxy ├──────►│ (console reads the sandbox) ││ Secret plugin-sandbox-kubeconfig │└─────────────────────────────┘ └─────────────────────────────┘ registry localhost:5111 registry localhost:5112- Requires the platform from Getting started. Run the
justcommands from the fundament repository root. - Example: cert-manager runs every step for one plugin.
- Plugin-specific steps (extra images,
spec.config, test recipes) are in each plugin’splugins/<path>/README.md.
1. Create the sandbox
Section titled “1. Create the sandbox”just plugins cluster-createjust plugins deploycluster-createcreatesk3d-fundament-pluginand adds its context to.dev/kubeconfig, like the platform cluster (Getting started). An existing sandbox whose context is not in.dev/kubeconfiggets it fromjust plugins cluster-start.deploybuilds plugin-controller from source and deploys it.
2. Connect the clusters
Section titled “2. Connect the clusters”just plugin-sandbox-kubeconfigjust plugins sandbox-catalog- kube-api-proxy is proxying to the sandbox (mock disabled)- http://fundament-catalog-relay.fundament.svc:8080 in the sandbox relays to NodePort 30080- http://fundament-authn-relay.fundament.svc:8080 in the sandbox relays to NodePort 30081After restarting Docker, run just plugin-sandbox-kubeconfig and just plugins sandbox-catalog again: the containers get new addresses on the sandbox network. If k3d-fundament-plugin-server-0 keeps restarting, its k3s cannot find its old node address; recreate the sandbox (just plugins cluster-delete && just plugins cluster-create && just plugins deploy) and run both again. The new sandbox has an empty registry and no installations, while the catalog keeps the published versions: push each plugin’s image again with just plugins publish <path>, which then reports that the version already exists, and apply its installation again (5. Install).
3. Log in with functl
Section titled “3. Log in with functl”In the console, log in as an admin of the publishing organization and create a key under API keys (API keys). Then:
| Organization | ID | Admin |
|---|---|---|
system (first-party plugins) |
019b4000-0000-7000-8000-000000000000 |
platform-admin@fundament.io |
acme-corp |
019b4000-0000-7000-8000-000000000001 |
alice@acme-corp.com |
Plugin in this repository: just functl uses the local endpoints from mise.toml.
just functl auth login <API_KEY>just functl org set <organization-id>Plugin in its own project: point functl at the local installation; without it functl talks to fundament-poc.nl. The local installation serves its discovery document through the local gateway, so on a cluster created before that existed run just setup-gateway once from the Fundament repository root and redeploy.
export FUNCTL_URL=https://fundament.localhost:8443functl auth login <API_KEY>functl org set <organization-id>Fast iteration: hot reload
Section titled “Fast iteration: hot reload”Iterating on a plugin’s own code? functl plugin dev [dir] replaces steps 4–6 below: every saved Go or console source file rebuilds and reinstalls the plugin automatically, instead of a one-shot publish/install/verify. dir defaults to the current directory and works for standalone plugin projects too.
just plugins dev external-dns # wraps: functl plugin dev plugins/external-dnsfunctl plugin dev # from a standalone plugin projectFrom a standalone plugin project, first put <fundament checkout>/.dev/kubeconfig ahead of your own kubeconfig, as in Getting started: the sandbox’s context is there.
-
just plugins dev <path>takes the plugin’s path underplugins/(nested works:storage/ceph-rook) and passes extra flags through. Everything cluster-facing is named after the definition’smetadata.name: the installation is<organization>--<name>. -
Startup checks (each failure prints what to fix and links here):
docker,skaffoldandkubectlinstalled (plusbunfor Vite plugins), Docker running, kube contextk3d-fundament-pluginreachable,plugin-controllerdeployed with dev mode and unpinned hashes enabled and the current CRDs (just plugins deploy), and functl’s organization matching the controller’sFUNDAMENT_ORGANIZATION_ID. -
Publishes a throwaway
-devdraft version (metadata.versionplus-dev), installs aPluginInstallationwithspec.dev.imageset, and runsskaffold devwithairin the pod: every saved.gofile,go.modorgo.sumsyncs in and recompiles in place. A newly added module is downloaded in the pod on that build. -
functl’s own build files (Dockerfile, skaffold and installation config) live in
os.UserCacheDir()/functl/plugin-dev/<installation>/, not in the plugin repo. For Vite plugins,bun installand the build still writeconsole-ui/node_modules,bun.lockandconsole/into the repo, as they do when run by hand. -
Vite console (
console-ui/): functl runs the initialbun install && bun run build, thenvite build --watch. Save, wait for the rebuild, refresh the browser. -
A local SDK
replaceingo.modis built into the image; SDK edits are not hot-reloaded, restartfunctl plugin dev. -
Changes to
definition.yamlare not hot-reloaded either: restart. -
In this repo only the top-level dirs the plugin imports from at startup (plus
go.mod/go.sum) sync into the pod; functl prints them. A new import from another top-level dir needs a restart. -
spec.configcomes from--set KEY=VALUE(repeatable) and/or--config <file>(a YAML map ofKEY: value);--setwins. Values are checked against the definition’sconfigSchemabefore the build, and every missing required key is listed. Changing them needs a restart.Terminal window just plugins dev storage/ceph-rook --set MON_COUNT=1 --set MGR_COUNT=1 --set ALLOW_MULTIPLE_PER_NODE=true -
metadata.namemust not contain--; it separates organization and plugin in the installation name. -
After bumping
metadata.version, runfunctl plugin dev-downfirst:definitionRef.pluginVersionis immutable, so applying over an existing installation with a different version fails. -
Ctrl-C deletes the
PluginInstallationby default.--no-cleanupkeeps it;dev-downremoves it later. -
devanddev-downrefuse to touch an installation of the same name that is not in dev mode (the dev-mode annotation plusspec.dev). -
dev-downwaits (up to 2 minutes) until the controller has finished tearing the installation down, and prints that there is nothing to remove if it is already gone.functl plugin devdoes the same if a previous installation is still terminating.
functl plugin dev --no-cleanupjust plugins dev-down external-dns # or: functl plugin dev-down [dir]4. Publish
Section titled “4. Publish”Plugin in this repository:
PLUGIN_REGISTRY=localhost:5112 just plugins publish <path><path>is the plugin directory underplugins/, e.g.gateway-api/envoy-gateway.- Builds the image with the repository root as build context, pushes it and publishes
plugins/<path>/definition.yaml. - Extra flags go to
functl plugin publish.
Plugin in its own project, from the project directory (names from the scaffolded my-plugin):
just docker v0.1.0 # for an amd64 (x86) clusterPLATFORM=linux/arm64 just docker v0.1.0 # for an arm64 cluster, such as k3d on Apple Silicondocker tag my-plugin-plugin:v0.1.0 localhost:5112/my-plugin:v0.1.0docker push localhost:5112/my-plugin:v0.1.0functl plugin publish definition.yaml --image=localhost:5112/my-plugin@sha256:<digest from push> --createBoth print:
published plugin=<name> version=<version> hash=sha256:… id=… version_id=… status=SUBMISSION_STATUS_DRAFT--createreserves the listing on the first publish; without it functl answersno listing named "<name>" in this organization — pass --create to reserve it.--submitopens the review: see Marketplace route.- Step 5 needs
versionandhash. - Versions are create-only: bump
metadata.versionto publish changed content.
5. Install
Section titled “5. Install”kubectl --context k3d-fundament-plugin apply -f - <<'YAML'apiVersion: plugins.fundament.io/v1kind: PluginInstallationmetadata: name: <organizationName>--<pluginName>spec: definitionRef: organizationName: <organizationName> pluginName: <pluginName> pluginVersion: "<version from step 4>" definitionHash: "<hash printed by publish>" # includes the sha256: prefixYAML- A draft or pending version installs this way only when the sandbox’s organization,
acme-corp, published it: plugin-controller reads the catalog as that organization. A version of another organization, such assystemfor the first-party plugins, must be approved first, or the installation fails withGetPluginDefinition RPC: not_found. Publish it with--submit, then approve it:just funops plugin approve <pluginName> <version> --organization <organizationName> --reviewer alice@acme-corp.com. A draft cannot be approved; only a submitted version can. The Marketplace route approves through the admin console instead. - The image comes from the published definition; the CR carries none. Field reference: PluginInstallation CRD.
spec.configsets the plugin’sFUNP_values without the prefix, e.g.OPERATOR_IMAGE: <ref>.definitionRefis immutable: to change the version, uninstall and install again.
6. Verify
Section titled “6. Verify”just plugins statusjust plugins logs <organizationName>--<pluginName>NAME PLUGIN ORGANIZATION PHASE READY<organization>--<name> <name> <organization> Running trueIn the console, log in as a member of an organization with a cluster (alice@acme-corp.com) and open the project: the plugin’s section appears under its display name.
First-party plugins
Section titled “First-party plugins”Each first-party plugin documents its flow from step 4, its config and its recipes in plugins/<path>/README.md: see plugins/. ceph-rook: Example: Ceph Storage (Rook).
Marketplace route
Section titled “Marketplace route”- Publish with
--submit(step 4): the version becomes Pending review. - https://marketplace-registry.fundament.localhost:8443 (console session) lists it under My plugins.
- https://marketplace-admin.fundament.localhost:8443 (DCIM login): Review queue → Review → approve.
- https://marketplace.fundament.localhost:8443 lists the approved plugin.
- Console Plugins page, as a member of an organization with a cluster: install it on the cluster.
After a platform deploy
Section titled “After a platform deploy”Every platform deploy resets its databases: API keys, published definitions and the cluster’s ready state are gone. Installed plugins keep running; a new install reports fetch definition: GetPluginDefinition RPC: not_found: plugin definition not found. Repeat:
just plugin-sandbox-kubeconfig- step 3 with a new API key
- step 4, and for a version of another organization than
acme-corpthe approval from step 5. The hash stays the same while the image content is unchanged. If it differs from the installation’sdefinitionHash, uninstall and repeat step 5.
Remove
Section titled “Remove”just plugins uninstall <organizationName>--<pluginName>just plugins cluster-deleteA plugin whose pod keeps failing takes minutes to uninstall.
Example: cert-manager
Section titled “Example: cert-manager”Log in to the console as platform-admin@fundament.io (password password) and create an API key under API keys. Then:
just plugins cluster-createjust plugins deployjust plugin-sandbox-kubeconfigjust plugins sandbox-catalog
just functl auth login <API_KEY>just functl org set 019b4000-0000-7000-8000-000000000000
PLUGIN_REGISTRY=localhost:5112 just plugins publish cert-manager --submitjust funops plugin approve cert-manager 1.21.3 --organization system --reviewer alice@acme-corp.com
kubectl --context k3d-fundament-plugin apply -f - <<'YAML'apiVersion: plugins.fundament.io/v1kind: PluginInstallationmetadata: name: system--cert-managerspec: definitionRef: organizationName: system pluginName: cert-manager pluginVersion: "1.21.3" definitionHash: "<hash printed by publish>" # includes the sha256: prefixYAML
just plugins statusjust plugins cert-manager testpublishprintspublished plugin=cert-manager version=1.21.3 hash=sha256:… id=… version_id=… status=SUBMISSION_STATUS_DRAFT, thensubmitted … status=SUBMISSION_STATUS_PENDING; the listing exists, so no--create.systemis not the sandbox’s organization, so the version is submitted and approved before the install.statusshowssystem--cert-manager cert-manager system Running true;testends withtest-cert True test-cert-tls.just plugins logs system--cert-managerstreams the plugin log:cert-manager is running.- In the console as
alice@acme-corp.com: acme-project → Cert Manager → Certificates liststest-certinfundament, Ready.
Remove:
just plugins cert-manager test-cleanupjust plugins uninstall system--cert-managerjust plugins cluster-delete