Group and Instance cluster UI won't allow swapping between managed/unmanaged with a custom namespace

Summary

When creating a group or instance level cluster, there is no option to input a custom namespace or namespace prefix. However, once the cluster has been successfully created and is marked as unmanaged, this field displays and is able to be edited. Being able to set this field may not be a problem as it seems to work, but is completely untested and the UX is confusing.

On top of this, problems arise when trying to change the cluster to managed. A managed cluster (excluding project level) is invalid if it has a custom namespace set, and will therefore fail to save due to validation error. Even if the namespace is removed from the field before saving, the update will still fail as the namespace ends up being set to "", which still triggers the validation error.

Steps to reproduce

  • Add existing group or instance level cluster, with GitLab-managed cluster unchecked.
  • Once cluster is created, enter a custom namespace in the Kubernetes cluster details section and save the cluster
  • Go back to the Kubernetes cluster details section and check the GitLab-managed cluster option.
  • Save the changes, and the cluster will fail to update.

Possible fixes

There's two things to fix here:

  1. If it is indeed intended for unmanaged group and instance clusters to have a custom namespace specified, this should be available from the creation page and shouldn't only show up when editing. Note that setting a custom namespace for these clusters will result in all projects being deployed to the same namespace, which causes problems with deployments overwriting each other unless the deployment names are explicitly overridden.
  2. The validation needs to be fixed to either null out the namespace if it is set to the empty string, or to not consider the empty string as a namespace.
Edited Jul 21, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading