그룹 클러스터 API(인증서 기반) (폐기됨)
경고: 이 기능은 GitLab 14.5에서 폐기되었습니다.
프로젝트 레벨 및 인스턴스 레벨 쿠버네티스 클러스터와 유사하게, 그룹 레벨 쿠버네티스 클러스터를 사용하여 하나의 클러스터를 여러 프로젝트에서 사용할 수 있도록 그룹에 쿠버네티스 클러스터를 연결할 수 있습니다.
이 엔드포인트를 사용하려면 사용자는 그룹의 유지관리자 역할을 최소한 가지고 있어야 합니다.
그룹 클러스터 목록
그룹 클러스터 목록을 반환합니다.
GET /groups/:id/clusters
매개변수:
속성 | 유형 | 필수 여부 | 설명 |
---|---|---|---|
id
| integer/string | 예 | 그룹의 ID 또는 URL-인코딩된 경로 |
예시 요청:
curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/groups/26/clusters"
예시 응답:
[
{
"id":18,
"name":"cluster-1",
"domain":"example.com",
"created_at":"2019-01-02T20:18:12.563Z",
"managed": true,
"enabled": true,
"provider_type":"user",
"platform_type":"kubernetes",
"environment_scope":"*",
"cluster_type":"group_type",
"user":
{
"id":1,
"name":"Administrator",
"username":"root",
"state":"active",
"avatar_url":"https://www.gravatar.com/avatar/4249f4df72b..",
"web_url":"https://gitlab.example.com/root"
},
"platform_kubernetes":
{
"api_url":"https://104.197.68.152",
"authorization_type":"rbac",
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----"
},
"management_project":
{
"id":2,
"description":null,
"name":"project2",
"name_with_namespace":"John Doe8 / project2",
"path":"project2",
"path_with_namespace":"namespace2/project2",
"created_at":"2019-10-11T02:55:54.138Z"
}
},
{
"id":19,
"name":"cluster-2",
...
}
]
단일 그룹 클러스터 가져오기
단일 그룹 클러스터를 가져옵니다.
GET /groups/:id/clusters/:cluster_id
매개변수:
속성 | 유형 | 필수 여부 | 설명 |
---|---|---|---|
id
| integer/string | 예 | 그룹의 ID 또는 URL-인코딩된 경로 |
cluster_id
| integer | 예 | 클러스터의 ID |
예시 요청:
curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/groups/26/clusters/18"
예시 응답:
{
"id":18,
"name":"cluster-1",
"domain":"example.com",
"created_at":"2019-01-02T20:18:12.563Z",
"managed": true,
"enabled": true,
"provider_type":"user",
"platform_type":"kubernetes",
"environment_scope":"*",
"cluster_type":"group_type",
"user":
{
"id":1,
"name":"Administrator",
"username":"root",
"state":"active",
"avatar_url":"https://www.gravatar.com/avatar/4249f4df72b..",
"web_url":"https://gitlab.example.com/root"
},
"platform_kubernetes":
{
"api_url":"https://104.197.68.152",
"authorization_type":"rbac",
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----"
},
"management_project":
{
"id":2,
"description":null,
"name":"project2",
"name_with_namespace":"John Doe8 / project2",
"path":"project2",
"path_with_namespace":"namespace2/project2",
"created_at":"2019-10-11T02:55:54.138Z"
},
"group":
{
"id":26,
"name":"group-with-clusters-api",
"web_url":"https://gitlab.example.com/group-with-clusters-api"
}
}
그룹에 기존 클러스터 추가
기존의 Kubernetes 클러스터를 그룹에 추가합니다.
POST /groups/:id/clusters/user
매개변수:
속성 | 유형 | 필수 여부 | 설명 |
---|---|---|---|
id
| integer/string | yes | 그룹의 ID 또는 URL 인코딩된 경로 |
name
| string | yes | 클러스터 이름 |
domain
| 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[authorization_type]
| string | no | 클러스터 인가 유형: rbac , abac 또는 unknown_authorization . 기본값은 rbac 입니다.
|
environment_scope
| string | no | 클러스터에 연결된 환경. 기본값은 * 입니다. Premium 및 Ultimate 전용입니다.
|
예시 요청:
curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/groups/26/clusters/user" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
--request POST --data '{"name":"cluster-5", "platform_kubernetes_attributes":{"api_url":"https://35.111.51.20","token":"12345","ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----"}}'
예시 응답:
{
"id":24,
"name":"cluster-5",
"created_at":"2019-01-03T21:53:40.610Z",
"managed": true,
"enabled": true,
"provider_type":"user",
"platform_type":"kubernetes",
"environment_scope":"*",
"cluster_type":"group_type",
"user":
{
"id":1,
"name":"Administrator",
"username":"root",
"state":"active",
"avatar_url":"https://www.gravatar.com/avatar/4249f4df72b..",
"web_url":"https://gitlab.example.com/root"
},
"platform_kubernetes":
{
"api_url":"https://35.111.51.20",
"authorization_type":"rbac",
"ca_cert":"-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----"
},
"management_project":null,
"group":
{
"id":26,
"name":"group-with-clusters-api",
"web_url":"https://gitlab.example.com/root/group-with-clusters-api"
}
}
그룹 클러스터 편집
기존의 그룹 클러스터를 업데이트합니다.
PUT /groups/:id/clusters/:cluster_id
매개변수:
속성 | 유형 | 필수 여부 | 설명 |
---|---|---|---|
id
| integer/string | yes | 그룹의 ID 또는 URL 인코딩된 경로 |
cluster_id
| integer | yes | 클러스터의 ID |
name
| string | no | 클러스터의 이름 |
domain
| string | no | 클러스터의 기본 도메인 |
management_project_id
| integer | no | 클러스터의 관리 프로젝트의 ID |
enabled
| boolean | no | 클러스터의 활성 상태 여부를 결정합니다 |
managed
| boolean | no | GitLab이 이 클러스터의 네임스페이스와 서비스 계정을 관리하는지 여부를 결정합니다 |
platform_kubernetes_attributes[api_url]
| string | no | Kubernetes API에 액세스하기 위한 URL |
platform_kubernetes_attributes[token]
| string | no | Kubernetes에 대한 인증에 사용되는 토큰 |
platform_kubernetes_attributes[ca_cert]
| string | no | TLS 인증서. API가 자체 서명된 TLS 인증서를 사용하는 경우 필요합니다 |
environment_scope
| string | no | 클러스터에 연결된 환경. Premium 및 Ultimate 전용입니다 |
참고:
name
, api_url
, ca_cert
및 token
은 클러스터가 “기존의 Kubernetes 클러스터 추가” 옵션 또는 “그룹에 기존 클러스터 추가” 엔드포인트를 통해 추가된 경우에만 업데이트할 수 있습니다.
예시 요청:
curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/groups/26/clusters/24" \
-H "Content-Type:application/json" \
--request PUT --data '{"name":"new-cluster-name","domain":"new-domain.com","platform_kubernetes_attributes":{"api_url":"https://10.10.101.1:6433"}}'
예시 응답:
{
"id":24,
"name":"new-cluster-name",
"domain":"new-domain.com",
"created_at":"2019-01-03T21:53:40.610Z",
"managed": true,
"enabled": true,
"provider_type":"user",
"platform_type":"kubernetes",
"environment_scope":"*",
"cluster_type":"group_type",
"user":
{
"id":1,
"name":"Administrator",
"username":"root",
"state":"active",
"avatar_url":"https://www.gravatar.com/avatar/4249f4df72b..",
"web_url":"https://gitlab.example.com/root"
},
"platform_kubernetes":
{
"api_url":"https://new-api-url.com",
"authorization_type":"rbac",
"ca_cert":null
},
"management_project":
{
"id":2,
"description":null,
"name":"project2",
"name_with_namespace":"John Doe8 / project2",
"path":"project2",
"path_with_namespace":"namespace2/project2",
"created_at":"2019-10-11T02:55:54.138Z"
},
"group":
{
"id":26,
"name":"group-with-clusters-api",
"web_url":"https://gitlab.example.com/group-with-clusters-api"
}
}
그룹 클러스터 삭제
기존의 그룹 클러스터를 삭제합니다. 연결된 Kubernetes 클러스터 내의 기존 리소스는 제거하지 않습니다.
DELETE /groups/:id/clusters/:cluster_id
매개변수:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id
| 정수/문자열 | 예 | 그룹의 ID 또는 URL 인코딩된 경로 |
cluster_id
| 정수 | 예 | 클러스터의 ID |
예시 요청:
curl --request DELETE --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/groups/26/clusters/23"