Config Template

    1. Create multiple configs with the same type. Such as the and the Helm Repository.
    2. Define certain parameters and check the validity.
    3. Write the config to the Nacos server.
    4. Render and generate the Secret or Other resources by the parameters. Such as the Grafana template.
    5. 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)
    1. parameter: {
    2. //+usage=The name of Terraform Provider for Alibaba Cloud, default is `default`
    3. name: *"default" | string
    4. //+usage=Get ALICLOUD_ACCESS_KEY per this guide https://help.aliyun.com/knowledge_detail/38738.html
    5. //+usage=Get ALICLOUD_SECRET_KEY per this guide https://help.aliyun.com/knowledge_detail/38738.html
    6. ALICLOUD_SECRET_KEY: string
    7. //+usage=Get ALICLOUD_REGION by picking one RegionId from Alibaba Cloud region list https://www.alibabacloud.com/help/doc-detail/72379.htm
    8. ALICLOUD_REGION: string
    9. }
    10. }
    • template.output

    This section is not required, If you want to specify, it must be a Secret.

    • template.outputs
    1. outputs: {
    2. "grafana": {
    3. apiVersion: "o11y.prism.oam.dev/v1alpha1"
    4. metadata: {
    5. name: context.name
    6. }
    7. spec: {
    8. endpoint: parameter.endpoint
    9. if parameter.auth != _|_ {
    10. access: {
    11. if parameter.auth.username != _|_ && parameter.auth.password != _|_ {
    12. username: parameter.auth.username
    13. password: parameter.auth.password
    14. if parameter.auth.token != _|_ {
    15. token: parameter.auth.token
    16. }
    17. }
    18. }
    19. }
    20. }
    • template.nacos

    This section is not required if you don’t want to create a Nacos config template.

    Apply to the hub cluster

    1. Create or update a template
    1. vela config-template apply -f template.cue
    1. 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.

    1. ├── config-templates
    2. ├── image-registry.cue
    3. ├── nacos-config.cue
    4. └── nacos-server.cue
    5. ├── metadata.yaml
    6. ├── parameter.cue
    7. ├── readme.md
    8. ├── readme_cn.md
    9. ├── resources

    When installing this addon, the templates will be applied to the hub cluster.