No description
  • Go 68.1%
  • JavaScript 19.1%
  • HTML 11.6%
  • Just 0.7%
  • Dockerfile 0.5%
Find a file
2026-11-24 15:54:21 +01:00
console v0.5.0: rolebindings 2026-11-24 15:54:21 +01:00
crds v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
.dockerignore Add Argo CD plugin 2026-11-18 13:22:56 +01:00
.gitignore Add Argo CD plugin 2026-11-18 13:22:56 +01:00
console.go Show Argo CD instances in the console via an ArgoCDInstance resource 2026-11-18 16:10:49 +01:00
controller.go v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
crds.go v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
definition.yaml v0.5.0: rolebindings 2026-11-24 15:54:21 +01:00
definition_test.go v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
Dockerfile Add Argo CD plugin 2026-11-18 13:22:56 +01:00
go.mod v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
go.sum Add Argo CD plugin 2026-11-18 13:22:56 +01:00
instance.go v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
instance_test.go v0.5.0: rolebindings 2026-11-24 15:54:21 +01:00
Justfile Add Argo CD plugin 2026-11-18 13:22:56 +01:00
LICENSE Add Argo CD plugin 2026-11-18 13:22:56 +01:00
main.go v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
mise.toml Add Argo CD plugin 2026-11-18 13:22:56 +01:00
plugin.go v0.5.0: rolebindings 2026-11-24 15:54:21 +01:00
plugin_test.go v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
README.md v0.5.0: rolebindings 2026-11-24 15:54:21 +01:00
spec.go v0.3.0: multi instance 2026-11-24 13:23:58 +01:00
tenancy.go v0.5.0: rolebindings 2026-11-24 15:54:21 +01:00
tenantrole.go v0.5.0: rolebindings 2026-11-24 15:54:21 +01:00

Argo CD

A Fundament plugin that runs isolated Argo CD instances from the upstream argo-cd Helm chart.

A Fundament plugin named argocd, scaffolded with functl plugin create.

Layout

Path What it is
definition.yaml The plugin manifest: metadata, RBAC, console menu and components
plugin.go Plugin lifecycle and the pinned chart version
controller.go Reconciles each ArgoCDInstance into a Helm release
spec.go The instance spec: validation and chart values
tenancy.go Namespaces, RoleBindings and Pod Security for tenant instances
crds.go, crds/ The ArgoCDInstance CRD and the embedded Argo CD CRDs
console/ The console pages
Justfile Build, test, lint and image recipes
mise.toml Pinned tool versions (Go, just, skaffold, kubectl)

Develop

Tool versions are pinned in mise.toml. With mise installed, mise install gets Go, just, skaffold and kubectl at the versions this project expects. Recipes live in the Justfile; run just --list to see them all.

go mod tidy      # needs network access, or a warm module cache
just build
just test

Image builds need the docker buildx plugin (with Homebrew and Colima: brew install docker-buildx):

just docker                         # linux/amd64 image, also on an Apple Silicon Mac
PLATFORM=linux/arm64 just docker    # for an arm64 cluster

Hot reload

functl plugin dev runs the plugin in the Fundament plugin sandbox and rebuilds it when you save Go source, go.mod or go.sum. Changes to definition.yaml need a restart of functl plugin dev. Prerequisites: the sandbox cluster, docker, skaffold, kubectl, and a functl auth login session. Set up the sandbox as described in https://github.com/fundament-oss/fundament/blob/master/docs/developer/plugins/testing-plugins-locally.md.

functl plugin dev                  # deletes the dev installation on Ctrl-C
functl plugin dev --no-cleanup     # keeps it after exit
functl plugin dev-down             # removes a leftover dev installation

Config values for spec.config (the keys in definition.yaml's configSchema) come from --set KEY=VALUE (repeatable) or a --config YAML file; --set wins. functl checks them against the schema before building, including required keys.

functl plugin dev --set MY_KEY=value         # MY_KEY declared in configSchema
functl plugin dev --config dev-config.yaml   # MY_KEY: value

How it works

One installation manages any number of Argo CD instances. Each instance is an ArgoCDInstance (cluster-scoped), created in the console's Argo CD menu or with kubectl, and the plugin runs one Helm release for each.

apiVersion: argocd.uwv-platformteam.code.digitaledienst.overheid.nl/v1alpha1
kind: ArgoCDInstance
metadata:
  name: team-a
spec:
  namespace: team-a-argocd          # created when missing; immutable
  domain: argocd.team-a.example.org
  destinationNamespaces:            # the only places it can deploy to
    - tnt-acme--team-a
  exposure:
    type: Gateway                   # None, Ingress or Gateway
    tls: true
    gateway:
      name: shared
      namespace: gateways
      sectionName: https
  • One version for every instance. The chart version is pinned in plugin.go (chartVersion, currently 10.18.3 = Argo CD v3.6.2). See Update Argo CD.
  • Shared CRDs. The plugin installs the Argo CD CRDs and keeps those it manages up to date. CRDs owned by something else, such as an operator, are used as they are. CRDs are never deleted, so removing an instance can't cascade into deleting Applications.
  • Removing an instance uninstalls its release and its access. Its namespace, Applications and deployed workloads stay. Uninstalling the plugin does this for all of its instances.

Scope

  • Tenant (the default) deploys only to destinationNamespaces, as described below.
  • Cluster deploys anywhere, including cluster-scoped resources such as CRDs and ClusterRoles, using the chart's cluster-wide roles. It has no destinations and never blocks a tenant instance, but it can change tenants' namespaces. Whoever administers a Cluster instance is effectively a cluster administrator, and so is anyone who can create an ArgoCDInstance.

Tenant isolation

  • No cluster-wide RBAC. The chart's ClusterRoles are off. The controller and server get two RoleBindings in each destination namespace, and nothing else: Kubernetes' built-in admin role, and the plugin's argocd-plugin-tenant, which covers every namespaced kind with a few exceptions (see below). admin is bound too because Kubernetes only lets Argo CD grant roles it holds itself, and apps commonly bind admin, edit or view.
  • Destinations must be tnt-* namespaces of one organization, and belong to one instance at a time. The form lists them to pick from. Each must enforce Pod Security, because a privileged pod can escape to the node. The plugin sets pod-security.kubernetes.io/enforce=baseline on a destination without a level. Running pods keep running, but a pod that baseline forbids can't be recreated. A namespace with any other level set, such as privileged, is refused rather than changed.
  • Instance namespaces can't be platform or tenant namespaces, and an existing namespace is only used with spec.adoptExisting: true.
  • Network policies deny ingress to the Argo CD components by default. Only the server accepts traffic.
  • Creating an ArgoCDInstance grants deploy access to its destinations, so keep write access to this resource with platform administrators.

Limits you need to handle outside this plugin:

  • Reading ArgoCDInstance is all-or-nothing, because it is cluster-scoped. Whoever can read them sees every tenant's names, namespaces and domains.
  • There are no ResourceQuotas on instance namespaces. A busy tenant's Argo CD can use as much of the cluster as the nodes allow.
  • Tenants can't install cluster-scoped resources such as CRDs through Argo CD.

What a tenant instance may manage

A tenant instance can create, change and delete every namespaced kind in its destinations. That includes custom kinds such as external-dns DNSEndpoint, Gateway API HTTPRoute and anything a plugin adds later. Nobody has to grant kinds one by one. The plugin builds argocd-plugin-tenant from the kinds the API serves, and rebuilds it within seconds when a CRD is added, changed or removed. It also rebuilds it every five minutes, which covers APIs no CRD announces.

A RoleBinding can't reach cluster-scoped kinds, so those stay out of reach. Left out on purpose, because each would let a tenant out of its namespaces:

Left out Why
Changing or deleting the namespace itself (read stays) A tenant could remove the Pod Security level, change the organization label or delete the namespace.
bind and escalate on Roles and RoleBindings A tenant could bind any ClusterRole in its namespace, including one that can change the namespace. Without them it can only grant what it already has.
Changing ResourceQuotas and LimitRanges (read stays) These are the tenant's limits, as with Kubernetes' built-in admin role.
Pod bindings Placing pods on nodes is the scheduler's job.

Before 0.4.0, instances had Kubernetes' built-in admin role, which lacks most custom kinds. Argo CD then failed every Application holding such a kind, so every resource in it showed an error like this, ConfigMaps and PVCs included:

Failed to load live state: failed to get managed objects: unexpected error getting
managed object: dnsendpoints.externaldns.k8s.io "x" is forbidden: User
"system:serviceaccount:<instance-namespace>:argocd-application-controller" cannot
get resource "dnsendpoints" ...

Granting everything has a cost. A namespaced object can still have effects outside its namespace, through whichever controller acts on it. A DNSEndpoint, for example, can publish any name in the zone external-dns manages, so a tenant could take over another tenant's hostname. Such a kind needs a policy of its own, or limits in its controller, such as external-dns domain filters.

The plugin creates argocd-plugin-tenant at start and removes it on uninstall. Instances from earlier versions get the second RoleBinding when the plugin starts. Cluster instances don't use this role: they can already reach every kind.

Exposure

  • Gateway adds an HTTPRoute for domain to an existing Gateway, which must allow routes from the instance's namespace. The Gateway terminates TLS, so the server serves plain HTTP. A rejected route shows as RouteNotAccepted.
  • Ingress creates an Ingress. With tls: true it uses secret argocd-server-tls.
  • The argocd CLI needs --grpc-web through a Gateway, because only an HTTPRoute is created.

For Gateway exposure, you set up these yourself for now:

What How Why the plugin doesn't
The Gateway Create one, with a listener for the instance's domain that allows routes from the instance's namespace. A Gateway decides the IP address, listeners and certificates, which are the cluster's choice. One Gateway per instance would cost a load balancer and public IP each, and sharing one would mean the plugin editing a Gateway it doesn't own.
The DNS record Create a DNSEndpoint for the domain, pointing at the Gateway's address. The external-dns plugin only reads DNSEndpoint resources, not Gateways or routes, and the plugin doesn't create them yet.
The certificate Annotate the Gateway with cert-manager.io/cluster-issuer: <issuer> or cert-manager.io/issuer: <issuer>. The cert-manager plugin then issues a certificate for each HTTPS listener. It comes with the Gateway: the listener that terminates TLS is where the certificate belongs.

Creating the DNSEndpoint is the likeliest step to move into the plugin: it is small, and the plugin already refuses a domain another instance uses.

Migrating an instance from an earlier plugin version

An existing instance keeps running unchanged, with cluster-wide access, and reports MigrationRequired. While it does, it can still reach every tenant.

To keep its cluster-wide access, make it a Cluster instance:

kubectl patch argocdinstance argocd --type=merge -p '{"spec":{"scope":"Cluster","adoptExisting":true}}'

To isolate it instead, first check that all its Applications deploy to tenant namespaces, because it loses access to everything else. Then run:

kubectl patch argocdinstance argocd --type=merge -p '{"spec":{
  "domain":"argocd.example.org",
  "adoptExisting":true,
  "destinationNamespaces":["tnt-acme--team-a"],
  "exposure":{"type":"Gateway","tls":true,"gateway":{"name":"argocd-server"}}
}}'

adoptExisting also takes over an existing HTTPRoute with the chart's name and replaces its rules.

Install options

The plugin has none: installing it asks no questions, and each instance is configured in the console's Argo CD menu. Versions before tenant isolation had install options; an installation of such a version keeps them, and Fundament drops them when you install the new version.

metadata.license says Apache-2.0, and LICENSE holds its text.

Test

just test    # unit tests; the console check needs node, and is skipped without it
just lint    # if golangci-lint is installed

The unit tests don't install Argo CD. Before you publish a change to the controller, the RBAC in definition.yaml or the chart version, also run the plugin on a cluster (see Hot reload) and check:

  • A tenant instance becomes Ready and syncs an Application into one of its destination namespaces.
  • It can't deploy outside them: kubectl auth can-i create deployments -n <other namespace> --as=system:serviceaccount:<instance namespace>:argocd-application-controller answers no.
  • A Cluster instance becomes Ready, and the plugin's status says "N of N Argo CD instances ready".

Update Argo CD

Each plugin version pins one chart version, and every instance runs it.

  1. Pick a chart version from the argo-cd chart releases and note the Argo CD version it ships.

  2. Set the chart version in plugin.go (chartVersion) and the Argo CD version in instance.go (argoCDAppVersion, only shown in the console).

  3. Regenerate the Argo CD CRDs. The plugin ships them in its image, so they don't follow the chart by themselves:

    CHART=10.19.0   # the new chart version
    for kind in application applicationset appproject; do
      helm template x argo-cd --repo https://argoproj.github.io/argo-helm --version "$CHART" \
        --set crds.install=true --set crds.keep=false \
        --show-only templates/crds/crd-$kind.yaml \
        | sed '/^# Source:/d;/^---$/d' > crds/argoproj/$kind.yaml
    done
    
  4. Read the chart's and Argo CD's upgrade notes for breaking changes, especially in values the plugin sets (chartValues in spec.go).

  5. Bump metadata.version in definition.yaml, and update the version in this README.

  6. Test and publish the new version, then upgrade the installations.

When the new version starts, it updates the CRDs it manages and upgrades every instance with Helm, up to three at a time. CRDs that something else owns, such as an Argo CD operator, are left as they are: check that their version suits the new Argo CD.

Build

just build                                  # the binary
just docker v0.2.0                          # an image for amd64 clusters
PLATFORM=linux/arm64 just docker v0.2.0     # for arm64, such as k3d on Apple Silicon

The image is argocd-plugin:<tag> and contains Helm, which the plugin runs at install time.

Publish

Publishing pushes the image to a registry and registers the definition with a Fundament installation's marketplace. A published version can't change: bump metadata.version in definition.yaml for every change.

To the local sandbox

Log in with functl auth login as an admin of the publishing organization, for example acme-corp (see testing plugins locally).

VERSION=v0.2.0                 # metadata.version in definition.yaml
REGISTRY=localhost:5112        # the sandbox's registry
PLATFORM=linux/arm64 just docker "$VERSION"   # k3d on Apple Silicon; omit PLATFORM on x86
docker tag argocd-plugin:"$VERSION" "$REGISTRY/argocd-plugin:$VERSION"
docker push "$REGISTRY/argocd-plugin:$VERSION"
DIGEST=$(docker inspect --format '{{index .RepoDigests 0}}' "$REGISTRY/argocd-plugin:$VERSION")
functl plugin publish definition.yaml --image="$DIGEST"
  • Add --create the first time the plugin is published in an organization.
  • functl prints the version and hash you need to install it.

To a Fundament installation

You need:

  • An API key from that installation's console (API keys), as an admin of the organization that publishes the plugin. A key only works on the installation it was created on.
  • A container registry the clusters can pull from without credentials. Fundament adds no pull secret to the plugin's pod, so use a public repository. The localhost registry of the sandbox won't do.
  1. Point functl at the installation in ~/.config/fundament/config.yaml (functl config path shows where it is). Without this file, functl uses https://fundament-poc.nl.

    url: https://fundament-poc.nl   # the installation's root URL
    

    functl finds the installation's APIs, including the marketplace registry, from <url>/.well-known/fundament.json.

  2. Log in and select the publishing organization:

    functl auth login              # prompts for the API key
    functl org list
    functl org set <ORG_ID>
    

    In CI, set FUNDAMENT_API_KEY instead of running functl auth login.

  3. Build, push and publish. Fundament clusters run on amd64, which is the default of just docker:

    VERSION=v0.4.0                                   # metadata.version
    IMAGE=code.digitaledienst.overheid.nl/uwv-platformteam/argocd-plugin   # your registry
    just docker "$VERSION"
    docker tag argocd-plugin:"$VERSION" "$IMAGE:$VERSION"
    docker push "$IMAGE:$VERSION"
    DIGEST=$(docker inspect --format '{{index .RepoDigests 0}}' "$IMAGE:$VERSION")
    functl plugin publish definition.yaml --image="$DIGEST" --submit
    
    • Add --create the first time the plugin is published in the organization.
    • --image must be a digest (repo@sha256:…), which the docker inspect line gives you. A tag is refused.
    • Leave out --submit to keep the version as a draft, for example to try it on your own clusters first. --replace changes a draft in place, but a replaced version can never be submitted for review: for the marketplace, bump the version instead.
  4. Review. --submit sets the version to Pending review, and the Fundament team approves it in the marketplace admin. Until then, only your own organization's clusters can install it.

  5. Install it from the console's Plugins page, on each cluster that needs it. For a cluster that runs an earlier version, see Upgrade an installation.

Upgrade an installation

Fundament can't upgrade an installed plugin in place yet, so you uninstall it and install the new version. Uninstalling this plugin removes every Argo CD instance it manages, so save them first and restore them afterwards.

What an uninstall removes and keeps

Removed:

  • Each instance's Argo CD (its Helm release). Nothing syncs or self-heals until you restore it.
  • The ArgoCDInstance objects.
  • Tenant access: the RoleBindings in destination namespaces. Restoring recreates them.
  • What is stored in the chart's ConfigMaps and Secrets (argocd-cm, argocd-rbac-cm, argocd-secret): local users, RBAC policies and an admin password changed after install. Login sessions end, and the admin password may change.

Kept:

  • The workloads the instances deployed.
  • Applications, ApplicationSets and AppProjects, in the instance namespaces. The Argo CD CRDs are never deleted.
  • The instance namespaces, and Secrets Argo CD created outside the chart, such as repository credentials added in the UI.

After the restore, each instance has the same name, so Argo CD recognizes what it deployed: it marks the Applications synced instead of deploying them again. Only changes made in Git meanwhile are applied, including pruning where an Application prunes automatically.

Steps

  1. Save the instances, while the old version still runs:

    kubectl get argocdinstances -o json | jq '.items |= map(
      del(.status, .metadata.uid, .metadata.resourceVersion, .metadata.generation,
          .metadata.creationTimestamp, .metadata.managedFields, .metadata.finalizers)
      | .spec.adoptExisting = true)' > argocd-instances.json
    

    If you changed RBAC policies or local users, also save argocd-cm and argocd-rbac-cm from each instance namespace.

  2. Uninstall the plugin in the console, and wait until it is gone.

  3. Install the new version.

  4. Restore the instances: kubectl apply -f argocd-instances.json. adoptExisting lets each take over its old namespace again.

  5. Check that every instance becomes Ready in the console's Argo CD menu, and that its Applications show Synced. Re-apply saved RBAC policies or local users, and look up the admin password in argocd-initial-admin-secret in the instance namespace.

In the local sandbox, run functl plugin dev-down after bumping metadata.version, before the next functl plugin dev.

Why not in place

  • The version is locked. The PluginInstallation resource rejects any change to its plugin version (definitionRef is immutable once set).
  • Nothing triggers an upgrade. The plugin SDK defines an Upgrade step, which this plugin implements, but Fundament's runtime never calls it, and the console has no upgrade action.
  • Permissions need new consent. An admin approves a version's permissions at install. An in-place upgrade needs a way to approve a new version's permissions again, so they can't widen silently.

This plugin is ready for it. Once Fundament can roll an installation over to a new version, the new version updates the Argo CD CRDs it manages and upgrades each instance with Helm, because the chart version is part of what each instance last applied. The instances, their settings and namespaces stay; only Argo CD's pods restart. No backup and restore would be needed.

Docs

https://github.com/fundament-oss/fundament/tree/master/docs/developer/plugins