全部產品
Search
文件中心

:DATASOURCE::CS::ClusterApplicationResources

更新時間:Sep 30, 2024

DATASOURCE::CS::ClusterApplicationResources類型用於列出Kubernetes叢集中指定類型的資源資訊。

文法

{
  "Type": "DATASOURCE::CS::ClusterApplicationResources",
  "Properties": {
    "FirstMatch": Boolean,
    "ClusterId": String,
    "Kind": String,
    "JsonPath": String,
    "Namespace": String,
    "Name": String,
    "RefreshOptions": String
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

ClusterId

String

叢集ID。

Kind

String

要查詢的Kubernetes叢集的類型。

取值:

  • ConfigMap

  • Service

  • PodTemplate

  • Namespace

  • Secret

  • Node

  • ComponentStatus

  • ReplicationController

  • LimitRange

  • ResourceQuota

  • PersistentVolumeClaim

  • ServiceAccount

  • PersistentVolume

  • Endpoints

  • Binding

  • Pod

  • Event

Name

String

要查詢kubernetes叢集的名稱。

Namespace

String

kubernetes的命名空間。

JsonPath

String

用於篩選輸出的 JsonPath運算式。

FirstMatch

Boolean

是否僅返回JsonPath過濾結果中的第一個匹配結果。

取值:

  • true:僅返回JsonPath過濾結果中的第一個匹配結果。

  • false(預設值):不只返回JsonPath過濾結果中的第一個匹配結果。

RefreshOptions

String

當資源棧更新時,資料來源資源的重新整理策略。

取值:

  • Never(預設值):更新堆棧時,從不重新整理資料來源資源。

  • Always:更新堆棧時,始終重新整理資料來源資源。

返回資料(Fn::GetAtt)

Response:要查詢的Kubernetes資源集合。

屬性名稱

類型

描述

約束

metadata

Map

資源的中繼資料。

例如:

{"resourceVersion": "254****"}

apiVersion

String

API版本。

例如:v1。

kind

String

Kubernetes資源的類型。

取值:

  • ConfigmapList

  • ServiceList

  • PodTemplateList

  • Namespace

  • SecretList

  • NodeList

  • ComponentStatusList

  • ReplicationControllerList

  • LimitRangeList

  • ResourceQuotaList

  • PersistentVolumeClaimList

  • ServiceAccountList

  • PersistentVolumeList

  • EndpointsList

  • BindingList

  • PodList

  • EventList

items

List

Kubernetes資源詳情列表。

僅在不指定Name時返回該資訊。

例如:

[
  {
   "metadata": {
    "uid": "5a3d04e1-8a72-4566-b435-af56f77f****",
    "managedFields": [
     {
      "apiVersion": "v1",
      "fieldsV1": {
       "f:data": {
        "f:ca.crt": {},
        ".": {}
       },
       "f:metadata": {
        "f:annotations": {
         "f:kubernetes.io/description": {},
         ".": {}
        }
       }
      },
      "manager": "kube-controller-manager",
      "time": "2022-11-02T04:03:08Z",
      "operation": "Update",
      "fieldsType": "FieldsV1"
     }
    ],
    "resourceVersion": "254",
    "namespace": "default",
    "creationTimestamp": "2022-11-02T04:03:08Z",
    "name": "kube-root-ca.crt",
    "annotations": {
     "kubernetes.io/description": "Contains a CA bundle that can be used to verify the kube-apiserver when using internal endpoints such as the internal service IP or kubernetes.default.svc. No other usage is guaranteed across distributions of Kubernetes clusters."
    }
   },
   "apiVersion": "v1",
   "data": {
    "ca.crt": "-----BEGIN CERTIFICATE-----\nMIIDTjCCAjagAwIBAgIUZvaXvIyXCj7R1q7UgYKPmO+D4lgwDQYJKoZIhvcN****\nBQAwPjEnMA8GA1UEChMIaGFuZ3pob3UwFAYDVQQKEw1hbGliYWJhIGNsb3Vk****\nEQYDVQQDEwprdWJlcm5ldGVzMCAXDTIyMTEwMjAzNTgwMFoYDzIwNTIxMDI1****\nODAwWjA+MScwDwYDVQQKEwhoYW5nemhvdTAUBgNVBAoTDWFsaWJhYmEgY2xv****\nEzARBgNVBAMTCmt1YmVybmV0ZXMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw****\nAoIBAQDXEuGvRudCTo7FJoyQCBvfG2Zx+F+htG8****/doyE6LjW7o2lxejs****\nz/3QO4hzVpNsicdBlNNwzPyykKDoxgAXE8HLL5P****/RyE6CiANzG6qQRPE****\nKm9G88XdXnPsaYEwRAskPmnifR04Ofqp0d4tSAEYoMgLFIjfOhFezrhDNYQw****\nAr0H77bwse5PABcHtbZ3JIZlV7ArluH4FMHAqw4YWq71EgPxooRmqWxH7nOI****\nVTCfaJ5Jtxc2iuDlmIgODrpYyweoIxs7oIgXgDJT8/RZ0DOv2WEfzeTuuBYFE+fi\nkk+5WFy0WIIZkrc7KhZdru096rD1AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIC****\nBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTPFeL0s4fc/uMRdLkkBpbyCYlb****\nBgkqhkiG9w0BAQsFAAOCAQEAFknCC6c7Y8aO8UEgC8e+y7oVuQokV2e+UhzM****\nryHO3XTPhE1paIaKsY70u2OgRHxqhQuuVm8pJbAXcKigXzK0tRcrS94p****\nQhNbiVsrZjws49Vy5iTigRhejiyIauS2qXwbq4Fh4miOM7cu02cXT58kdunR****\naS29Vzz9NeZXTCrUY19jkVoKIFVQpldyNJt/012SY044scejeba5/MsUPc01****\nPddEJLx5TuZb16K48qvSkGv1fJFNA/Dia61T4EDHRobcDU6ge2o6nSCy7AoX****\nDbHv5QxY7mhn1DJFJFzY13Ep/5xXUH5ZDtbY4vMyWio1****\n-----END CERTIFICATE-----\n"
   },
   "kind": "ConfigMap"
  }
 ]
                                

樣本

本樣本為您介紹如何使用DATASOURCE::CS::ClusterApplicationResources資源擷取Kubernetes叢集的ConfigMap。

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ClusterId": {
      "Type": "String",
      "Description": "The ID of the kubernetes cluster."
    },
    "Kind": {
      "Type": "String",
      "Description": "The kind of kubernetes resources to query.",
      "Default": "ConfigMap",
      "AllowedValues": [
        "ConfigMap",
        "Service",
        "PodTemplate",
        "Namespace",
        "Secret",
        "Node",
        "ComponentStatus",
        "ReplicationController",
        "LimitRange",
        "ResourceQuota",
        "PersistentVolumeClaim",
        "ServiceAccount",
        "PersistentVolume",
        "Endpoints",
        "Binding",
        "Pod",
        "Event"
      ]
    }
  },
  "Resources": {
    "ClusterApplicationResources": {
      "Type": "DATASOURCE::CS::ClusterApplicationResources",
      "Properties": {
        "ClusterId": {
          "Ref": "ClusterId"
        },
        "Kind": {
          "Ref": "Kind"
        }
      }
    }
  },
  "Outputs": {
    "Response": {
      "Description": "Query result of kubernetes resource(s).",
      "Value": {
        "Fn::GetAtt": [
          "ClusterApplicationResources",
          "Response"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ClusterId:
    Type: String
    Description: The ID of the kubernetes cluster.
  Kind:
    Type: String
    Description: The kind of kubernetes resources to query.
    Default: ConfigMap
    AllowedValues:
      - ConfigMap
      - Service
      - PodTemplate
      - Namespace
      - Secret
      - Node
      - ComponentStatus
      - ReplicationController
      - LimitRange
      - ResourceQuota
      - PersistentVolumeClaim
      - ServiceAccount
      - PersistentVolume
      - Endpoints
      - Binding
      - Pod
      - Event
Resources:
  ClusterApplicationResources:
    Type: DATASOURCE::CS::ClusterApplicationResources
    Properties:
      ClusterId:
        Ref: ClusterId
      Kind:
        Ref: Kind
Outputs:
  Response:
    Description: Query result of kubernetes resource(s).
    Value:
      Fn::GetAtt:
        - ClusterApplicationResources
        - Response