doc-locale/fr-fr/api/group_clusters.md
{{< details >}}
{{< /details >}}
[!warning] Cette fonctionnalité a été dépréciée dans GitLab 14.5.
Comme pour les clusters Kubernetes de niveau projet et de niveau instance, les clusters Kubernetes de niveau groupe vous permettent de connecter un cluster Kubernetes à votre groupe, ce qui vous permet d'utiliser le même cluster dans plusieurs projets.
Les utilisateurs doivent disposer du rôle Maintainer ou Owner pour le groupe afin d'utiliser ces endpoints.
Liste tous les clusters de groupe pour un groupe spécifié.
GET /groups/:id/clusters
Paramètres :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | entier ou chaîne | oui | L'ID ou le chemin encodé en URL du groupe |
Exemple de requête :
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/groups/26/clusters"
Exemple de réponse :
[
{
"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",
...
}
]
Récupère un cluster de groupe spécifié.
GET /groups/:id/clusters/:cluster_id
Paramètres :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | entier ou chaîne | oui | L'ID ou le chemin encodé en URL du groupe |
cluster_id | entier | oui | L'ID du cluster |
Exemple de requête :
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/groups/26/clusters/18"
Exemple de réponse :
{
"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"
}
}
Crée un cluster de groupe pour un groupe spécifié en ajoutant un cluster Kubernetes existant.
POST /groups/:id/clusters/user
Paramètres :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | entier ou chaîne | oui | L'ID ou le chemin encodé en URL du groupe |
name | string | oui | Le nom du cluster |
domain | string | non | Le domaine de base du cluster |
management_project_id | entier | non | L'ID du projet de gestion pour le cluster |
enabled | boolean | non | Détermine si le cluster est actif ou non, par défaut true |
managed | boolean | non | Détermine si GitLab gère les espaces de nommage et les comptes de service pour ce cluster. Par défaut true |
platform_kubernetes_attributes[api_url] | string | oui | L'URL pour accéder à l'API Kubernetes |
platform_kubernetes_attributes[token] | string | oui | Le jeton pour s'authentifier auprès de Kubernetes |
platform_kubernetes_attributes[ca_cert] | string | non | Certificat TLS. Requis si l'API utilise un certificat TLS auto-signé. |
platform_kubernetes_attributes[authorization_type] | string | non | Le type d'autorisation du cluster : rbac, abac ou unknown_authorization. Par défaut rbac. |
environment_scope | string | non | L'environnement associé au cluster. Par défaut *. Premium et Ultimate uniquement. |
Exemple de requête :
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-----"
}
}'
Exemple de réponse :
{
"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"
}
}
Met à jour un cluster de groupe spécifié.
PUT /groups/:id/clusters/:cluster_id
Paramètres :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | entier ou chaîne | oui | L'ID ou le chemin encodé en URL du groupe |
cluster_id | entier | oui | L'ID du cluster |
name | string | non | Le nom du cluster |
domain | string | non | Le domaine de base du cluster |
management_project_id | entier | non | L'ID du projet de gestion pour le cluster |
enabled | boolean | non | Détermine si le cluster est actif ou non |
managed | boolean | non | Détermine si GitLab gère les espaces de nommage et les comptes de service pour ce cluster |
platform_kubernetes_attributes[api_url] | string | non | L'URL pour accéder à l'API Kubernetes |
platform_kubernetes_attributes[token] | string | non | Le jeton pour s'authentifier auprès de Kubernetes |
platform_kubernetes_attributes[ca_cert] | string | non | Certificat TLS. Requis si l'API utilise un certificat TLS auto-signé. |
environment_scope | string | non | L'environnement associé au cluster. Premium et Ultimate uniquement. |
[!note]
name,api_url,ca_certettokenne peuvent être mis à jour que si le cluster a été ajouté via l'option « Ajouter un cluster Kubernetes existant » ou via l'endpoint « Créer un cluster de groupe ».
Exemple de requête :
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"
}
}'
Exemple de réponse :
{
"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"
}
}
Supprime un cluster de groupe spécifié. Ne supprime pas les ressources existantes dans le cluster Kubernetes connecté.
DELETE /groups/:id/clusters/:cluster_id
Paramètres :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | entier ou chaîne | oui | L'ID ou le chemin encodé en URL du groupe |
cluster_id | entier | oui | L'ID du cluster |
Exemple de requête :
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/groups/26/clusters/23"