グループクラスターAPI(証明書ベース)(非推奨)
- プラン: Free、Premium、Ultimate
- 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated
この機能は、GitLab 14.5で非推奨になりました。
プロジェクトレベルおよびインスタンスレベルのKubernetesクラスターと同様に、グループレベルのKubernetesクラスターを使用すると、Kubernetesクラスターをグループに接続して、複数のプロジェクトで同じクラスターを使用できます。
これらのエンドポイントを使用するには、グループのメンテナーロール以上が必要です。
グループクラスターの一覧表示
グループクラスターの一覧を返します。
GET /groups/:id/clustersパラメータは以下のとおりです:
| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | グループのIDまたはURLエンコードされたパス |
リクエスト例:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "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 | 整数または文字列 | はい | グループのIDまたはURLエンコードされたパス |
cluster_id | 整数 | はい | クラスターの |
リクエスト例:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "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 | 整数または文字列 | はい | グループのIDまたはURLエンコードされたパス |
name | 文字列 | はい | クラスターの名前 |
domain | 文字列 | いいえ | クラスターのベースドメイン |
management_project_id | 整数 | いいえ | クラスターの管理プロジェクトの |
enabled | ブール値 | いいえ | クラスターがアクティブかどうかを決定します。trueがデフォルトです。 |
managed | ブール値 | いいえ | が、このクラスターのネームスペースとサービスアカウントを管理するかどうかを決定します。デフォルトはtrueです。 |
platform_kubernetes_attributes[api_url] | 文字列 | はい | Kubernetes APIにアクセスするためのURL |
platform_kubernetes_attributes[token] | 文字列 | はい | Kubernetesに対して認証するためのトークン |
platform_kubernetes_attributes[ca_cert] | 文字列 | いいえ | TLS証明書。APIが自己署名TLS証明書を使用している場合に必要です。 |
platform_kubernetes_attributes[authorization_type] | 文字列 | いいえ | クラスターの認可タイプ: rbac、abac、またはunknown_authorization。rbacがデフォルトです。 |
environment_scope | 文字列 | いいえ | クラスターに関連付けられた環境。*がデフォルトです。PremiumおよびUltimateのみです。 |
リクエスト例:
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--header "Accept: application/json" \
--header "Content-Type:application/json" \
--url "https://gitlab.example.com/api/v4/groups/26/clusters/user" \
--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 | 整数または文字列 | はい | グループのIDまたはURLエンコードされたパス |
cluster_id | 整数 | はい | クラスターの |
name | 文字列 | いいえ | クラスターの名前 |
domain | 文字列 | いいえ | クラスターのベースドメイン |
management_project_id | 整数 | いいえ | クラスターの管理プロジェクトの |
enabled | ブール値 | いいえ | クラスターがアクティブかどうかを判断します |
managed | ブール値 | いいえ | が、このクラスターのネームスペースとサービスアカウントを管理するかどうかを決定します |
platform_kubernetes_attributes[api_url] | 文字列 | いいえ | Kubernetes APIにアクセスするためのURL |
platform_kubernetes_attributes[token] | 文字列 | いいえ | Kubernetesに対して認証するためのトークン |
platform_kubernetes_attributes[ca_cert] | 文字列 | いいえ | TLS証明書。APIが自己署名TLS証明書を使用している場合に必要です。 |
environment_scope | 文字列 | いいえ | クラスターに関連付けられた環境。PremiumおよびUltimateのみです。 |
name、api_url、ca_cert、およびtokenは、「既存のKubernetesクラスターを追加」オプションまたは「既存のクラスターをグループに追加」エンドポイントを介してクラスターが追加された場合にのみ更新できます。
リクエスト例:
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type:application/json" \
--url "https://gitlab.example.com/api/v4/groups/26/clusters/24" \
--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 | 整数 | はい | クラスターの |
リクエスト例:
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/groups/26/clusters/23"