Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Handle plus signs in Kubernetes minor version #928

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

Douglas-Cleghorn
Copy link
Contributor

@Douglas-Cleghorn Douglas-Cleghorn commented Feb 5, 2021

Resolves #927
Resolves #943

This PR updates Tye's KubectlDetector to handle plus signs in the minor version instead of returning an error message.

kubectl version -o json

{
  "clientVersion": {
    "major": "1",
    "minor": "20",
    "gitVersion": "v1.20.2",
    "gitCommit": "faecb196815e248d3ecfb03c680a4507229c2a56",
    "gitTreeState": "clean",
    "buildDate": "2021-01-13T13:28:09Z",
    "goVersion": "go1.15.5",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "serverVersion": {
    "major": "1",
    "minor": "20+",
    "gitVersion": "v1.20.1-34+e7db93d188d0d1",
    "gitCommit": "e7db93d188d0d12f2fe5336d1b85cdb94cb909d3",
    "gitTreeState": "clean",
    "buildDate": "2021-01-11T23:50:46Z",
    "goVersion": "go1.15.6",
    "compiler": "gc",
    "platform": "linux/amd64"
  }
}

This line is the problem:

"minor": "20+",

@Douglas-Cleghorn
Copy link
Contributor Author

Would it be better if it removed all non-numeric characters?

Something like:
Regex.Replace("20+", "[^0-9]", "")

@jkotalik
Copy link
Contributor

jkotalik commented Mar 3, 2021

I think this is fine for now.

@jkotalik jkotalik merged commit 2239325 into dotnet:master Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

microk8s serverVersion can't be parsed Error parsing Kubernetes minor version with extra characters (+)
2 participants