Skip to content

Sanitize Vault version strings for Kubernetes#8411

Merged
tyrannosaurus-becks merged 4 commits into
masterfrom
sanitize-kube-label-strings
Feb 24, 2020
Merged

Sanitize Vault version strings for Kubernetes#8411
tyrannosaurus-becks merged 4 commits into
masterfrom
sanitize-kube-label-strings

Conversation

@tyrannosaurus-becks
Copy link
Copy Markdown
Contributor

@tyrannosaurus-becks tyrannosaurus-becks commented Feb 21, 2020

We have found that if the Vault version contains a "+", as is used with Vault enterprise, the Kubernetes API returns a 422 and service registration fails.

This PR adds a Sanitize method to the hand-rolled Kube client, which is then used by Kube service registration to clean the Vault version string.

When creating this PR, I considered the possibility of using regex. I chose this approach because in my opinion, this is the most readable/maintainable option, however, I am flexible on that as it's quite subjective.

@tyrannosaurus-becks tyrannosaurus-becks requested a review from a team February 21, 2020 23:01
Comment thread serviceregistration/kubernetes/client/client_test.go Outdated
Comment thread serviceregistration/kubernetes/client/client.go Outdated
Copy link
Copy Markdown
Contributor

@kalafut kalafut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kalafut kalafut added this to the 1.4 milestone Feb 21, 2020
@kalafut kalafut removed the backport label Feb 21, 2020
@tyrannosaurus-becks tyrannosaurus-becks merged commit 18a323c into master Feb 24, 2020
@tyrannosaurus-becks tyrannosaurus-becks deleted the sanitize-kube-label-strings branch February 24, 2020 22:20
tyrannosaurus-becks added a commit that referenced this pull request Mar 2, 2020
* sanitize vault version strings for kube

* replace disallowed chars with dashes

* use strings.Map

* use switch for whitelisted chars
tyrannosaurus-becks added a commit that referenced this pull request Mar 3, 2020
* sanitize vault version strings for kube

* replace disallowed chars with dashes

* use strings.Map

* use switch for whitelisted chars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants