template

command
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 7 Imported by: 0

README

Template Transformer

It is a plugin for Kustomize that allows you to template manifests by using Go's text/template library.

This plugin uses ([{ and }]) as delimiters to avoid collision with other libraries.

Using

A Template transformer can be defined as:

apiVersion: incognia.com/v1alpha1
kind: Template
metadata:
  name: _
data:
  aws:
    account:
      name: example-aws-account-1234
      number: 1234
  cluster:
    name: blue
    owner: mario

Specify ./template.yaml as a transform on kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
transformers:
  - ./template.yaml
resources:
  - deployment.yaml

If your ./deployment.yaml file look like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: example
spec:
  template:
    spec:
      containers:
        - name: example
          command:
            - example-cmd
            - input-arg=([{ .aws.account.name }])

It'll be outputted as:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: example
spec:
  template:
    spec:
      containers:
        - name: example
          command:
            - example-cmd
            - input-arg=example-aws-account-1234

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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