Skip to content

schubergphilis/cue-kube-tenant

Repository files navigation

Tenant

Module used to quickly generate K8s Tenants using CUE and Timoni.

Values

Name Description Type Default Required
name string n/a yes
annotations Annotations to be added to the K8s objects {[string]: string} {} yes
role Currently only admin and namespace-admin are supported string namespace-admin no
gitopsAgent Create objects for gitops agent, currently only fluxV2(GitSource + Kustomization) is supported. string "" no
Supported: flux
git Needs to be configured with gitopsAgent {[string]: string}
git: {
url: ""
branch: ""
path: ""
interval: "5m"
timeout: "1m"
prune: true
}
Only with gitopsAgent
For flux see here and here
slack Needs to be configured with gitopsAgent {[string]: string}
slack: {
enabled: false
channel: ""
secretName: ""
summary: ""
}
Only with gitopsAgent
For Flux see
metadata: labels Overwrite labels "app.kubernetes.io/tenant": metadata.name {} no

Example usage

// tenants.cue
_module: {
	url:     "oci://ghcr.io/schubergphilis/cue-modules/tenant"
	version: "0.0.1"
}

_common_values: {// set common_values
	gitopsAgent: "flux"
	git: {
		url:      "ssh://git@testgit.com/test-repo.git"
		branch:   "main"
		interval: "5m"
	}
}

bundle: {
	apiVersion: "v1alpha1"
	name:       "tenants"
	instances: {// each instances can present a tenant
		frontend: {
			module:    _module
			namespace: "frontend"
			values:    _common_values
			values: role: "admin"
			values: name: "frontend-team"
			values: git: path: "./frontend"
		}
		backend: {
			module:    _module
			namespace: "backend"
			values:    _common_values // reuse common values
			values: {
				name: "backend-team"
				role: "cluster-admin"
				git: path: "./backend"
			}
		}
	}
}