kustomize-variable-injector

command module
v0.1.0-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

README

kustomize-variable-injector

Plugin for kustomize to allow to expand placeholders with values. The initial use case is to make domain names in ingresses configurable.

Syntax

  • host: sub.${DOMAIN} replace with value DOMAIN or fail if value is missing
  • host: sub.${DOMAIN:-fallback.com} replace with value DOMAIN or fall back to "fallback.com" if missing
  • port: ${REDIS_PORT:number:-6379} replace with value REDIS_PORT, inject as number (not as string) and fall back to 6379 if missing

Usage

# ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
spec:
  rules:
    - host: "sub.${DOMAIN:-domain.com}"

# variable-injector.yaml
apiVersion: choffmeister.github.com/v1alpha1
kind: VariableReplacer
metadata:
  name: variable-injector
  annotations:
    config.kubernetes.io/function: |
      container:
        image: ghcr.io/choffmeister/kustomize-variable-injector:latest
replacements:
  - targets:
      - group: networking.k8s.io
        version: v1
        kind: Ingress
        name: ingress
    variables:
      DOMAIN: mydomain.com

# kustomization.yaml
resources:
  - secret.yaml
transformers:
  - variable-injector.yaml

Caveats

Plugins are still in alpha. For this to work, you need to provide the --enable-alpha-plugins flag (i.e. kustomize build --enable-alpha-plugins).

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL