sigs.k8s.io/cluster-api@v1.7.1/docs/book/src/clusterctl/commands/generate-yaml.md (about) 1 # clusterctl generate yaml 2 3 The `clusterctl generate yaml` command processes yaml using clusterctl's yaml 4 processor. 5 6 The intent of this command is to allow users who may have specific templates 7 to leverage clusterctl's yaml processor for variable substitution. For 8 example, this command can be leveraged in local and CI scripts or for 9 development purposes. 10 11 clusterctl ships with a simple yaml processor that performs variable 12 substitution that takes into account default values. 13 Under the hood, clusterctl's yaml processor uses 14 [drone/envsubst][drone-envsubst] to replace variables and uses the defaults if 15 necessary. 16 17 Variable values are either sourced from the clusterctl config file or 18 from environment variables. 19 20 Current usage of the command is as follows: 21 ```bash 22 # Generates a configuration file with variable values using a template from a 23 # specific URL as well as a GitHub URL. 24 clusterctl generate yaml --from https://github.com/foo-org/foo-repository/blob/main/cluster-template.yaml 25 26 clusterctl generate yaml --from https://foo.bar/cluster-template.yaml 27 28 # Generates a configuration file with variable values using 29 # a template stored locally. 30 clusterctl generate yaml --from ~/workspace/cluster-template.yaml 31 32 # Prints list of variables used in the local template 33 clusterctl generate yaml --from ~/workspace/cluster-template.yaml --list-variables 34 35 # Prints list of variables from template passed in via stdin 36 cat ~/workspace/cluster-template.yaml | clusterctl generate yaml --from - --list-variables 37 38 # Default behavior for this sub-command is to read from stdin. 39 # Generate configuration from stdin 40 cat ~/workspace/cluster-template.yaml | clusterctl generate yaml 41 ``` 42 43 <!-- Links --> 44 [drone-envsubst]: https://github.com/drone/envsubst