diff --git a/examples/preflight/sample-preflight.yaml b/examples/preflight/sample-preflight.yaml index c86950dde..a727e7dbd 100644 --- a/examples/preflight/sample-preflight.yaml +++ b/examples/preflight/sample-preflight.yaml @@ -75,6 +75,9 @@ spec: - pass: when: "== oke" message: OKE is a supported distribution + - pass: + when: "== kind" + message: Kind is a supported distribution - warn: message: Unable to determine the distribution of Kubernetes - nodeResources: diff --git a/pkg/analyze/distribution.go b/pkg/analyze/distribution.go index 8f9624fb7..861254be9 100644 --- a/pkg/analyze/distribution.go +++ b/pkg/analyze/distribution.go @@ -27,6 +27,7 @@ type providers struct { rke2 bool k3s bool oke bool + kind bool } type Provider int @@ -47,6 +48,7 @@ const ( rke2 Provider = iota k3s Provider = iota oke Provider = iota + kind Provider = iota ) type AnalyzeDistribution struct { @@ -162,6 +164,10 @@ func ParseNodesForProviders(nodes []corev1.Node) (providers, string) { foundProviders.ibm = true stringProvider = "ibm" } + if strings.HasPrefix(node.Spec.ProviderID, "kind:") { + foundProviders.kind = true + stringProvider = "kind" + } } if foundMaster { @@ -335,6 +341,8 @@ func compareDistributionConditionalToActual(conditional string, actual providers isMatch = actual.k3s case oke: isMatch = actual.oke + case kind: + isMatch = actual.kind } switch parts[0] { @@ -377,6 +385,8 @@ func mustNormalizeDistributionName(raw string) Provider { return k3s case "oke": return oke + case "kind": + return kind } return unknown diff --git a/pkg/analyze/distribution_test.go b/pkg/analyze/distribution_test.go index 9f69fbb6c..a9a9abb7f 100644 --- a/pkg/analyze/distribution_test.go +++ b/pkg/analyze/distribution_test.go @@ -39,6 +39,14 @@ func Test_compareDistributionConditionalToActual(t *testing.T) { }, expected: true, }, + { + name: "== kind when kind is found", + conditional: "== kind", + input: providers{ + kind: true, + }, + expected: true, + }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) {