全部产品
Search
文档中心

资源编排:DATASOURCE::CS::ClusterUserKubeconfig

更新时间:Sep 29, 2024

DATASOURCE::CS::ClusterUserKubeconfig类型用于根据集群ID查询访问该集群的Kubeconfig配置。

语法

{
  "Type": "DATASOURCE::CS::ClusterUserKubeconfig",
  "Properties": {
    "PrivateIpAddress": Boolean,
    "ClusterId": String,
    "TemporaryDurationMinutes": Integer,
    "RefreshOptions": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

PrivateIpAddress

Boolean

是否获取内网连接配置。

取值:

  • true:仅获取内网连接凭据。

  • false(默认值):仅获取公网连接凭据。

ClusterId

String

集群ID。

TemporaryDurationMinutes

Integer

临时kubeconfig有效期。

单位:分钟。取值范围:15~4320。

说明

当不设置该参数时,将由系统自动确定一个更长的有效期,具体过期时间通过返回的expiration字段值确定。

RefreshOptions

String

当资源栈更新时,数据源资源的刷新策略。

取值:

  • Never(默认值):更新堆栈时,从不刷新数据源资源。

  • Always:更新堆栈时,始终刷新数据源资源。

返回值

Fn::GetAtt

  • ClusterId:ACK集群的ID。

  • Config:集群访问配置。

  • Expiration:Kubeconfig的过期时间。以RFC3339格式显示的UTC时间。 

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ClusterId:
    Description: The ID of the ACK cluster.
    Type: String
Resources:
  ClusterUserKubeconfig:
    Properties:
      ClusterId:
        Ref: ClusterId
    Type: DATASOURCE::CS::ClusterUserKubeconfig
Outputs:
  ClusterId:
    Description: The ID of the ACK cluster.
    Value:
      Fn::GetAtt:
      - ClusterUserKubeconfig
      - ClusterId
  Config:
    Description: The content of the kubeconfig file.
    Value:
      Fn::GetAtt:
      - ClusterUserKubeconfig
      - Config
  Expiration:
    Description: The expiration time of the kubeconfig file. The value is the UTC
      time displayed in RFC3339 format.
    Value:
      Fn::GetAtt:
      - ClusterUserKubeconfig
      - Expiration

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ClusterId": {
      "Type": "String",
      "Description": "The ID of the ACK cluster."
    }
  },
  "Resources": {
    "ClusterUserKubeconfig": {
      "Type": "DATASOURCE::CS::ClusterUserKubeconfig",
      "Properties": {
        "ClusterId": {
          "Ref": "ClusterId"
        }
      }
    }
  },
  "Outputs": {
    "ClusterId": {
      "Description": "The ID of the ACK cluster.",
      "Value": {
        "Fn::GetAtt": [
          "ClusterUserKubeconfig",
          "ClusterId"
        ]
      }
    },
    "Config": {
      "Description": "The content of the kubeconfig file.",
      "Value": {
        "Fn::GetAtt": [
          "ClusterUserKubeconfig",
          "Config"
        ]
      }
    },
    "Expiration": {
      "Description": "The expiration time of the kubeconfig file. The value is the UTC time displayed in RFC3339 format.",
      "Value": {
        "Fn::GetAtt": [
          "ClusterUserKubeconfig",
          "Expiration"
        ]
      }
    }
  }
}