인스턴스 클러스터 API (인증 기반) (사용 중지)

Tier: Free, Premium, Ultimate Offering: Self-Managed
caution
이 기능은 GitLab 14.5에서 사용 중지되었습니다.

인스턴스 수준의 Kubernetes 클러스터를 사용하여 GitLab 인스턴스에 Kubernetes 클러스터를 연결하고 인스턴스 내의 모든 프로젝트에서 동일한 클러스터를 사용할 수 있습니다.

사용자는 이 엔드포인트를 사용하려면 관리자 액세스가 필요합니다.

인스턴스 클러스터 디렉터리

인스턴스 클러스터 디렉터리을 반환합니다.

GET /admin/clusters

예시 요청:

curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/admin/clusters"

예시 응답:

[
  {
    "id": 9,
    "name": "cluster-1",
    "created_at": "2020-07-14T18:36:10.440Z",
    "managed": true,
    "enabled": true,
    "domain": null,
    "provider_type": "user",
    "platform_type": "kubernetes",
    "environment_scope": "*",
    "cluster_type": "instance_type",
    "user": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/root"
    },
    "platform_kubernetes": {
      "api_url": "https://example.com",
      "namespace": null,
      "authorization_type": "rbac",
      "ca_cert":"-----BEGIN CERTIFICATE-----IxMDM1MV0ZDJkZjM...-----END CERTIFICATE-----"
    },
    "provider_gcp": null,
    "management_project": null
  },
  {
    "id": 10,
    "name": "cluster-2",
    "created_at": "2020-07-14T18:39:05.383Z",
    "domain": null,
    "provider_type": "user",
    "platform_type": "kubernetes",
    "environment_scope": "staging",
    "cluster_type": "instance_type",
    "user": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/root"
    },
    "platform_kubernetes": {
      "api_url": "https://example.com",
      "namespace": null,
      "authorization_type": "rbac",
      "ca_cert":"-----BEGIN CERTIFICATE-----LzEtMCadtaLGxcsGAZjM...-----END CERTIFICATE-----"
    },
    "provider_gcp": null,
    "management_project": null
  },
  {
    "id": 11,
    "name": "cluster-3",
    ...
  }
]

단일 인스턴스 클러스터 가져오기

단일 인스턴스 클러스터를 반환합니다.

매개변수:

속성 유형 필수 설명
cluster_id integer yes 클러스터의 ID
GET /admin/clusters/:cluster_id

예시 요청:

curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/admin/clusters/9"

예시 응답:

{
  "id": 9,
  "name": "cluster-1",
  "created_at": "2020-07-14T18:36:10.440Z",
  "managed": true,
  "enabled": true,
  "domain": null,
  "provider_type": "user",
  "platform_type": "kubernetes",
  "environment_scope": "*",
  "cluster_type": "instance_type",
  "user": {
    "id": 1,
    "name": "Administrator",
    "username": "root",
    "state": "active",
    "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/root"
  },
  "platform_kubernetes": {
    "api_url": "https://example.com",
    "namespace": null,
    "authorization_type": "rbac",
    "ca_cert":"-----BEGIN CERTIFICATE-----IxMDM1MV0ZDJkZjM...-----END CERTIFICATE-----"
  },
  "provider_gcp": null,
  "management_project": null
}

기존 인스턴스 클러스터 추가

기존 Kubernetes 인스턴스 클러스터를 추가합니다.

POST /admin/clusters/add

매개변수:

속성 유형 필수 설명
name string yes 클러스터의 이름
domain string no 클러스터의 기본 도메인
environment_scope string no 클러스터에 연결된 환경. 기본값은 *
management_project_id integer no 클러스터의 관리 프로젝트의 ID
enabled boolean no 클러스터가 활성 상태인지 여부를 결정합니다. 기본값은 true
managed boolean no GitLab이 이 클러스터의 네임스페이스 및 서비스 계정을 관리하는지 여부를 결정합니다. 기본값은 true
platform_kubernetes_attributes[api_url] string yes Kubernetes API에 액세스하기 위한 URL
platform_kubernetes_attributes[token] string yes Kubernetes에 대한 인증을 위한 토큰
platform_kubernetes_attributes[ca_cert] string no TLS 인증서. API가 자체 서명된 TLS 인증서를 사용하는 경우 필요합니다.
platform_kubernetes_attributes[namespace] string no 프로젝트와 관련된 고유한 네임스페이스
platform_kubernetes_attributes[authorization_type] string no 클러스터 인증 유형: rbac, abac 또는 unknown_authorization. 기본값은 rbac.

예시 요청:

curl --header "Private-Token:<your_access_token>" "http://gitlab.example.com/api/v4/admin/clusters/add" \
-H "Accept:application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"name":"cluster-3", "environment_scope":"production", "platform_kubernetes_attributes":{"api_url":"https://example.com", "token":"12345",  "ca_cert":"-----BEGIN CERTIFICATE-----qpoeiXXZafCM0ZDJkZjM...-----END CERTIFICATE-----"}}'

예시 응답:

{
  "id": 11,
  "name": "cluster-3",
  "created_at": "2020-07-14T18:42:50.805Z",
  "managed": true,
  "enabled": true,
  "domain": null,
  "provider_type": "user",
  "platform_type": "kubernetes",
  "environment_scope": "production",
  "cluster_type": "instance_type",
  "user": {
    "id": 1,
    "name": "Administrator",
    "username": "root",
    "state": "active",
    "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "http://gitlab.example.com:3000/root"
  },
  "platform_kubernetes": {
    "api_url": "https://example.com",
    "namespace": null,
    "authorization_type": "rbac",
    "ca_cert":"-----BEGIN CERTIFICATE-----qpoeiXXZafCM0ZDJkZjM...-----END CERTIFICATE-----"
  },
  "provider_gcp": null,
  "management_project": null
}

인스턴스 클러스터 편집

기존의 인스턴스 클러스터를 업데이트합니다.

PUT /admin/clusters/:cluster_id

매개변수:

속성 유형 필수 여부 설명
cluster_id integer 클러스터의 ID
name string 아니요 클러스터의 이름
domain string 아니요 클러스터의 기본 도메인
environment_scope string 아니요 클러스터와 관련된 환경
management_project_id integer 아니요 클러스터의 관리 프로젝트의 ID
enabled boolean 아니요 클러스터가 활성화되었는지 여부를 결정합니다
managed boolean 아니요 GitLab이 이 클러스터의 네임스페이스와 서비스 계정을 관리하는지 여부를 결정합니다
platform_kubernetes_attributes[api_url] string 아니요 Kubernetes API에 액세스하기 위한 URL
platform_kubernetes_attributes[token] string 아니요 Kubernetes에 대해 인증하기 위한 토큰
platform_kubernetes_attributes[ca_cert] string 아니요 필수 사항인 TLS 인증서. API가 자체 서명된 TLS 인증서를 사용하는 경우 필요합니다.
platform_kubernetes_attributes[namespace] string 아니요 프로젝트와 관련된 고유한 네임스페이스
note
name, api_url, ca_certtoken은 클러스터가 기존의 Kubernetes 클러스터 추가 옵션을 통해 추가되었을 때 또는 기존의 인스턴스 클러스터 추가 엔드포인트를 통해 추가되었을 때만 업데이트할 수 있습니다.

예시 요청:

curl --header "Private-Token: <your_access_token>" "http://gitlab.example.com/api/v4/admin/clusters/9" \
-H "Content-Type:application/json" \
-X PUT --data '{"name":"update-cluster-name", "platform_kubernetes_attributes":{"api_url":"https://new-example.com","token":"new-token"}}'

예시 응답:

{
  "id": 9,
  "name": "update-cluster-name",
  "created_at": "2020-07-14T18:36:10.440Z",
  "managed": true,
  "enabled": true,
  "domain": null,
  "provider_type": "user",
  "platform_type": "kubernetes",
  "environment_scope": "*",
  "cluster_type": "instance_type",
  "user": {
    "id": 1,
    "name": "Administrator",
    "username": "root",
    "state": "active",
    "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/root"
  },
  "platform_kubernetes": {
    "api_url": "https://new-example.com",
    "namespace": null,
    "authorization_type": "rbac",
    "ca_cert":"-----BEGIN CERTIFICATE-----IxMDM1MV0ZDJkZjM...-----END CERTIFICATE-----"
  },
  "provider_gcp": null,
  "management_project": null,
  "project": null
}

인스턴스 클러스터 삭제

기존의 인스턴스 클러스터를 삭제합니다. 연결된 Kubernetes 클러스터 내에서 기존 리소스를 제거하지는 않습니다.

DELETE /admin/clusters/:cluster_id

매개변수:

속성 유형 필수 여부 설명
cluster_id integer 클러스터의 ID

예시 요청:

curl --request DELETE --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/admin/clusters/11"