Skip to content

CLI

Templating

Users can create multiple Infrastructure Provisioners with a set of defined configurations. The template file contains a list of objects that helps to create multiple Infra Provisioner(s) from a single template.

Below is an example of Infra Provisioner template file

# Generated: {{now.UTC.Format "2006-01-02T15:04:05UTC"}}
#      With: {{command_line}}
{{ $envName := environment "PWD" | basename}}
{{ $glbCtx := . }}{{ range $i, $project := .ProjectNames }}
{{ $ctxInf := $glbCtx }}{{ range $j, $infp := $glbCtx.InfraProvionerNames }}
apiVersion: gitops.k8smgmt.io/v3
kind: InfraProvisioner
metadata:
 name: {{ $infp }}
 project: {{$envName}}-{{$project}}
spec:
 config:
  version: 0.14.9
 repository: fayas-repo
 revision: main
 type: Terraform
---{{end}}
{{end}}

Users can create one or more Infra Provisioner(s) with the required configuration defined in the template file. Below is an example of an Infra Provisioner value file. This file helps to create Infra Provisioner with version v1.0 along with the specified label key values

InfraProvionerNames:
- Infra_1
- Infra_2

Important

Only the objects defined in the template must be present in the value files

Use the command below to create Infra Provisioner(s) with the specified configuration once the value file(s) are prepared with the necessary objects.

 ./rctl apply -t infraprovisioner.tmpl --values values.yaml

where, - infraprovisioner.tmpl: template file - value.yaml: value file

Refer Templating for more details on Templating flags and examples