Skip to content

Improves restriction of multiple Kubernetes clusters via API

What does this MR do?

Improves restriction of adding multiple Kubernetes clusters through API.

EE Port https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9088

Before

Adding a cluster to a project with existing cluster

❯ curl --header 'Private-Token: '$CE_MAINTAINER_PAT'' http://localhost:3000/api/v4/projects/26/clusters/user \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"name":"cluster-2", "platform_kubernetes_attributes":{"api_url":"https://cluster-2-api-url.com","token":"12345","namespace":"cluster-2-namespace"}}'
{"message":"500 Internal Server Error"}

After

❯ curl --header 'Private-Token: '$CE_MAINTAINER_PAT'' http://localhost:3000/api/v4/projects/26/clusters/user \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data '{"name":"cluster-2", "platform_kubernetes_attributes":{"api_url":"https://cluster-2-api-url.com","token":"12345","namespace":"cluster-2-namespace"}}'
{"message":"403 Forbidden  - Instance does not support multiple Kubernetes clusters"}

What are the relevant issue numbers?

#56110 (closed)

Does this MR meet the acceptance criteria?

Closes #56110 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports