Config Template
- Create multiple configs with the same type. Such as the and the Helm Repository.
- Define certain parameters and check the validity.
- Write the config to the Nacos server.
- Render and generate the Secret or Other resources by the parameters. Such as the Grafana template.
- Need to classify the configs and list them.
There are many Out-of-Box templates you could refer to.
More templates let’s find in the addon catalog.
- metadata(Required)
Define the base info for this template.
- template.parameter(Required)
parameter: {
//+usage=The name of Terraform Provider for Alibaba Cloud, default is `default`
name: *"default" | string
//+usage=Get ALICLOUD_ACCESS_KEY per this guide https://help.aliyun.com/knowledge_detail/38738.html
//+usage=Get ALICLOUD_SECRET_KEY per this guide https://help.aliyun.com/knowledge_detail/38738.html
ALICLOUD_SECRET_KEY: string
//+usage=Get ALICLOUD_REGION by picking one RegionId from Alibaba Cloud region list https://www.alibabacloud.com/help/doc-detail/72379.htm
ALICLOUD_REGION: string
}
}
- template.output
This section is not required, If you want to specify, it must be a Secret.
- template.outputs
outputs: {
"grafana": {
apiVersion: "o11y.prism.oam.dev/v1alpha1"
metadata: {
name: context.name
}
spec: {
endpoint: parameter.endpoint
if parameter.auth != _|_ {
access: {
if parameter.auth.username != _|_ && parameter.auth.password != _|_ {
username: parameter.auth.username
password: parameter.auth.password
if parameter.auth.token != _|_ {
token: parameter.auth.token
}
}
}
}
}
- template.nacos
This section is not required if you don’t want to create a Nacos config template.
Apply to the hub cluster
- Create or update a template
vela config-template apply -f template.cue
- Show the parameters of the template
We could copy the cue script to others. But, The addon is a common carrier to share the user-friendly config templates to more community users.
├── config-templates
│ ├── image-registry.cue
│ ├── nacos-config.cue
│ └── nacos-server.cue
├── metadata.yaml
├── parameter.cue
├── readme.md
├── readme_cn.md
├── resources
When installing this addon, the templates will be applied to the hub cluster.