Merge pull request #325 from replicatedhq/feat/rke3-k3s-anaylzer

feat(analyzer): rke2 and k3s distro support
This commit is contained in:
Dan Stough
2021-02-19 14:52:22 -05:00
committed by GitHub
2 changed files with 33 additions and 1 deletions

View File

@@ -60,13 +60,18 @@ spec:
- pass:
when: "== aks"
message: AKS is a supported distribution
# Will be supported in the future
- pass:
when: "== kurl"
message: KURL is a supported distribution
- pass:
when: "== digitalocean"
message: DigitalOcean is a supported distribution
- pass:
when: "== rke2"
message: RKE2 is a supported distribution
- pass:
when: "== k3s"
message: K3S is a supported distribution
- warn:
message: Unable to determine the distribution of Kubernetes
- nodeResources:

View File

@@ -22,6 +22,8 @@ type providers struct {
aks bool
ibm bool
minikube bool
rke2 bool
k3s bool
}
type Provider int
@@ -38,6 +40,8 @@ const (
aks Provider = iota
ibm Provider = iota
minikube Provider = iota
rke2 Provider = iota
k3s Provider = iota
)
func CheckOpenShift(foundProviders *providers, apiResources []*metav1.APIResourceList, provider string) string {
@@ -77,6 +81,21 @@ func ParseNodesForProviders(nodes []corev1.Node) (providers, string) {
foundProviders.minikube = true
stringProvider = "minikube"
}
if k == "node.kubernetes.io/instance-type" && v == "k3s" {
foundProviders.k3s = true
stringProvider = "k3s"
}
if k == "beta.kubernetes.io/instance-type" && v == "k3s" {
foundProviders.k3s = true
stringProvider = "k3s"
}
}
for k := range node.ObjectMeta.Annotations {
if k == "rke2.io/node-args" {
foundProviders.rke2 = true
stringProvider = "rke2"
}
}
if node.Status.NodeInfo.OSImage == "Docker Desktop" {
@@ -270,6 +289,10 @@ func compareDistributionConditionalToActual(conditional string, actual providers
isMatch = actual.ibm
case minikube:
isMatch = actual.minikube
case rke2:
isMatch = actual.rke2
case k3s:
isMatch = actual.k3s
}
switch parts[0] {
@@ -304,6 +327,10 @@ func mustNormalizeDistributionName(raw string) Provider {
return ibm
case "minikube":
return minikube
case "rke2":
return rke2
case "k3s":
return k3s
}
return unknown