CLI
Users can use RCTL to automate the lifecycle of operations associated with Infrastructure Provisioner.
Resource | Create | Get | Update | Delete |
---|---|---|---|---|
Infrastructure Provisioner | YES | YES | YES | YES |
Create Infra Provisioner¶
You can also create a Infra Provisioner in your project based on a version controlled spec that you can store in a Git repository. This enables users to develop automation for reproducible infrastructure.
./rctl create infraprovisioner -f infraprovisioner.yml --v3
(or)
./rctl apply -f <infra_provisioner.yaml>
An illustrative example of the blueprint spec YAML file is shown below
apiVersion: gitops.k8smgmt.io/v3
kind: InfraProvisioner
metadata:
name: tes
project: fayas
spec:
config:
secretGroups:
- test
version: 0.14.9
folder:
name: allsecterkeys
repository: fayas-syncrepo
revision: main
type: Terraform
Update Infra Provisioner¶
Use the below command to update an existing infra provisioner configuration
./rctl update infraprovisioner -f infra_provisioner.yaml --v3
List Infra Provisioner¶
To view the list of Infra Provisioners without output, use the below command
./rctl get ip
+-------+-----------+----------------+-------------+---------------+------------------------------+------------------------------+
| NAME | TYPE | GITREPOSITORY | GITREVISION | DIRECTORYPATH | CREATED AT | MODIFIED AT |
+-------+-----------+----------------+-------------+---------------+------------------------------+------------------------------+
| test1 | Terraform | syncrepo | main | allsecterkeys | Wed Jan 4 10:30:24 UTC 2023 | Wed Jan 4 11:42:09 UTC 2023 |
+-------+-----------+----------------+-------------+---------------+------------------------------+------------------------------+
| test2 | Terraform | syncrepo | main | | Wed Jan 4 12:38:36 UTC 2023 | Wed Jan 4 12:38:59 UTC 2023 |
+-------+-----------+----------------+-------------+---------------+------------------------------+------------------------------+
To view a specific Infra Provisioner with output, use the below command
./rctl get infrastructure provisioner test1 -o yaml --v3
apiVersion: gitops.k8smgmt.io/v3
kind: InfraProvisioner
metadata:
name: test1
project: default_project
spec:
config:
secretGroups:
- test
version: 0.14.9
folder:
name: allsecterkeys
repository: syncrepo
revision: main
type: Terraform
Delete Infra Provisioner¶
Use the below command to delete one or more Infra Provisioner(s)
./rctl delete infraprovisioner <infra_provisioner_name1> <infra_provisioner_name2>
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