Kubernetes cluster name can be added with whitespace => Problem when trying "To remove your integration, type ..."

Summary

When copying a Kubernetes cluster name from a console.cloud.google.com/kubernetes/clusters/details or https://console.cloud.google.com/kubernetes/list page some whitespace carries over into the Kubernetes cluster name field on GitLab's /admin/clusters/new > Add existing cluster page (screenshots 1 & 2).

Not causing any problems when creating the cluster, installing apps on it and using it (for a GitLab Runner in my case), but when trying to remove, that whitespace is expected exactly again before the Remove… buttons become active (screenshots 3 & 4).

Steps to reproduce

Follow steps in docs.gitlab.com/ee/user/project/clusters/add_remove_clusters and ensure that whitespace is copy-pasted as shown in screenshots below.

Example Project

(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)

(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)

What is the current bug behavior?

The <code> tag contains a space, but that is not displayed in the GUI, thus isn't copy-paste-able to confirm the removal, nor is it obvious that it needs to be added by typing it.

What is the expected correct behavior?

If indeed the presence of spaces in the Kubernetes cluster name field is intended, it should be displayed in the code-formatted name.

If not: strip leading & trailing whitespaces upon pasting a Kubernetes cluster name or upon clicking the Add Kubernetes cluster button.

Relevant logs and/or screenshots

1. Double- or triple-click to select entire cluster name from GCP & copy

image


2. Paste cluster name into GitLab where requested

image


3. Try deleting the cluster & check the exact name in the <code> block (use browser developer tools)

image


4. Copy cluster name with (white)space (characters) from source & paste into deletion confirmation field

image

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		Ubuntu 20.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.7.2p137
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.3
Redis Version:	6.0.12
Git Version:	2.31.1
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	13.11.4-ee
Revision:	d1a2e182d3b
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	12.6
URL:		https://katrinleinweber-gl-2020-04-28.do.gitlap.com
HTTP Clone URL:	https://katrinleinweber-gl-2020-04-28.do.gitlap.com/some-group/some-project.git
SSH Clone URL:	git@katrinleinweber-gl-2020-04-28.do.gitlap.com:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	13.17.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.17.0 ? ... OK (13.17.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 1/220 ... yes … 68/228 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.31.0 ? ... yes (2.31.1) Git user has default SSH configuration? ... yes Active users: ... 49 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by Katrin Leinweber