ALIYUN::SAE::Secret

ALIYUN::SAE::Secret类型用于创建命名空间中的Secret实例。

语法

{
  "Type": "ALIYUN::SAE::Secret",
  "Properties": {
    "NamespaceId": String,
    "SecretName": String,
    "SecretType": String,
    "SecretData": Map
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

NamespaceId

String

Secret 实例所在命名空间 ID。

如果所在命名空间为默认命名空间,则只需填写 RegionId,例如cn-beijing

SecretName

String

Secret 实例名称。

允许数字、字母和下划线(_)组合,仅允许以字母开头。

SecretType

String

当前支持的 Secret 实例类型。

取值说明如下:

  • kubernetes.io/dockerconfigjson:存储镜像仓库用户名和密码的保密字典,用于部署时拉取镜像鉴权。

SecretData

Map

Secret 数据。

Secret 键值对数据,为必填项。格式如下:

{"Data":"{"k1":"v1", "k2":"v2"}"}

k 表示键,v 表示值。

示例:

{
  ".dockerconfigjson": "eyJhdXRocyI6eyJyZWdpc3RyeS12cGMuY24tYmVpamluZy5hbGl5dW5jcy5jb20iOnsidXNlcm5hbWUiOiJ1c2VybmFtZSIsInBhc3N3b3JkIjoicGFzc3dvcmQiLCJhdXRoIjoiZFhObGNtNWhiV1U2Y0dGemMzZHZjbVE9In0sInJlZ2lzdHJ5LmNuLWJlaWppbmcuYWxpeXVuY3MuY29tIjp7InVzZXJuYW1lIjoidXNlcm5hbWUiLCJwYXNzd29yZCI6InBhc3N3b3JkIiwiYXV0aCI6ImRYTmxjbTVoYldVNmNHRnpjM2R2Y21RPSJ9fX0="
}

返回值

Fn::GetAtt

  • SecretId:Secret 实例 ID。

  • NamespaceId:Secret 实例所在命名空间 ID。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SecretName:
    Type: String
    Description:
      en: Secret instance name.Allows combinations of numbers, letters, en dash (-) and underscores (_) and only start with letters.
    AllowedPattern: ^[a-zA-Z][a-zA-Z0-9_-]*$
    Required: true
  SecretType:
    Type: String
    Description:
      en: |-
        The currently supported Secret instance type.The values are as follows:
        kubernetes.io/dockerconfigjson: A confidential dictionary that stores the username and password of the mirror repository, used to pull mirror authentication during deployment.
    AllowedValues:
      - Opaque
      - kubernetes.io/dockerconfigjson
      - kubernetes.io/tls
    Required: true
  NamespaceId:
    Type: String
    Description:
      en: The namespace ID where the Secret instance resides. If the namespace you are in is the default namespace, you just need to fill in the RegionId.
    Required: true
  SecretData:
    Type: Json
    Description:
      en: |-
        Secret key-value pair data, required.The format is as follows:
        {"Data":"{"k1":"v1", "k2":"v2"}"}
        k represents the key and v represents the value.
    Required: true
Resources:
  Secret:
    Type: ALIYUN::SAE::Secret
    Properties:
      SecretName:
        Ref: SecretName
      SecretType:
        Ref: SecretType
      NamespaceId:
        Ref: NamespaceId
      SecretData:
        Ref: SecretData
Outputs:
  SecretId:
    Description: The ID of the secret.
    Value:
      Fn::GetAtt:
        - Secret
        - SecretId
  NamespaceId:
    Description: The namespace ID that the Secret instance belongs to.
    Value:
      Fn::GetAtt:
        - Secret
        - NamespaceId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SecretName": {
      "Type": "String",
      "Description": {
        "en": "Secret instance name.Allows combinations of numbers, letters, en dash (-) and underscores (_) and only start with letters."
      },
      "AllowedPattern": "^[a-zA-Z][a-zA-Z0-9_-]*$",
      "Required": true
    },
    "SecretType": {
      "Type": "String",
      "Description": {
        "en": "The currently supported Secret instance type.The values are as follows:\nkubernetes.io/dockerconfigjson: A confidential dictionary that stores the username and password of the mirror repository, used to pull mirror authentication during deployment."
      },
      "AllowedValues": [
        "Opaque",
        "kubernetes.io/dockerconfigjson",
        "kubernetes.io/tls"
      ],
      "Required": true
    },
    "NamespaceId": {
      "Type": "String",
      "Description": {
        "en": "The namespace ID where the Secret instance resides. If the namespace you are in is the default namespace, you just need to fill in the RegionId."
      },
      "Required": true
    },
    "SecretData": {
      "Type": "Json",
      "Description": {
        "en": "Secret key-value pair data, required.The format is as follows:\n{\"Data\":\"{\"k1\":\"v1\", \"k2\":\"v2\"}\"}\nk represents the key and v represents the value."
      },
      "Required": true
    }
  },
  "Resources": {
    "Secret": {
      "Type": "ALIYUN::SAE::Secret",
      "Properties": {
        "SecretName": {
          "Ref": "SecretName"
        },
        "SecretType": {
          "Ref": "SecretType"
        },
        "NamespaceId": {
          "Ref": "NamespaceId"
        },
        "SecretData": {
          "Ref": "SecretData"
        }
      }
    }
  },
  "Outputs": {
    "SecretId": {
      "Description": "The ID of the secret.",
      "Value": {
        "Fn::GetAtt": [
          "Secret",
          "SecretId"
        ]
      }
    },
    "NamespaceId": {
      "Description": "The namespace ID that the Secret instance belongs to.",
      "Value": {
        "Fn::GetAtt": [
          "Secret",
          "NamespaceId"
        ]
      }
    }
  }
}