diff --git a/docs/design/proposal-standard-interface.md b/docs/design/proposal-standard-interface.md index 156caca2..24ea0086 100644 --- a/docs/design/proposal-standard-interface.md +++ b/docs/design/proposal-standard-interface.md @@ -42,7 +42,7 @@ An initially unintended benefit of using the Aggregation Layer is that any HostC * [microk8s implementation](https://github.com/canonical/microk8s/blob/master/build-scripts/patches/0000-Kubelite-integration.patch) - bundles slightly modified binaries * [k0s uses upstream binaries statically compiled](https://docs.k0sproject.io/v1.23.8+k0s.0/architecture/) - bundles statically compiled binaries that self extract and uses a process monitor to run them -2. Can you in fact push metadat like "Status" into an api-server or do we have to write directly to etcd? +2. Can you in fact push metadata like "Status" into an api-server or do we have to write directly to etcd? * If we can't push to the api-server is just writing the information directly into etcd something we can do and have a reasonable expectation of compatibility? diff --git a/pkg/analyze/distribution.go b/pkg/analyze/distribution.go index 6b2c3360..9670a059 100644 --- a/pkg/analyze/distribution.go +++ b/pkg/analyze/distribution.go @@ -13,44 +13,46 @@ import ( ) type providers struct { - microk8s bool - dockerDesktop bool - eks bool - gke bool - digitalOcean bool - openShift bool - tanzu bool - kurl bool - aks bool - ibm bool - minikube bool - rke2 bool - k3s bool - oke bool - kind bool - k0s bool + microk8s bool + dockerDesktop bool + eks bool + gke bool + digitalOcean bool + openShift bool + tanzu bool + kurl bool + aks bool + ibm bool + minikube bool + rke2 bool + k3s bool + oke bool + kind bool + k0s bool + embeddedCluster bool } type Provider int const ( - unknown Provider = iota - microk8s Provider = iota - dockerDesktop Provider = iota - eks Provider = iota - gke Provider = iota - digitalOcean Provider = iota - openShift Provider = iota - tanzu Provider = iota - kurl Provider = iota - aks Provider = iota - ibm Provider = iota - minikube Provider = iota - rke2 Provider = iota - k3s Provider = iota - oke Provider = iota - kind Provider = iota - k0s Provider = iota + unknown Provider = iota + microk8s Provider = iota + dockerDesktop Provider = iota + eks Provider = iota + gke Provider = iota + digitalOcean Provider = iota + openShift Provider = iota + tanzu Provider = iota + kurl Provider = iota + aks Provider = iota + ibm Provider = iota + minikube Provider = iota + rke2 Provider = iota + k3s Provider = iota + oke Provider = iota + kind Provider = iota + k0s Provider = iota + embeddedCluster Provider = iota ) type AnalyzeDistribution struct { @@ -140,6 +142,11 @@ func ParseNodesForProviders(nodes []corev1.Node) (providers, string) { foundProviders.k0s = true stringProvider = "k0s" } + + if k == "kots.io/embedded-cluster-role" { + foundProviders.embeddedCluster = true + stringProvider = "embedded-cluster" + } } for k := range node.ObjectMeta.Annotations { @@ -351,6 +358,8 @@ func compareDistributionConditionalToActual(conditional string, actual providers isMatch = actual.kind case k0s: isMatch = actual.k0s + case embeddedCluster: + isMatch = actual.embeddedCluster } switch parts[0] { @@ -397,6 +406,8 @@ func mustNormalizeDistributionName(raw string) Provider { return kind case "k0s": return k0s + case "embeddedcluster": + return embeddedCluster } return unknown diff --git a/pkg/analyze/distribution_test.go b/pkg/analyze/distribution_test.go index 78021658..9038d4a5 100644 --- a/pkg/analyze/distribution_test.go +++ b/pkg/analyze/distribution_test.go @@ -55,6 +55,14 @@ func Test_compareDistributionConditionalToActual(t *testing.T) { }, expected: true, }, + { + name: "== embedded-cluster when embedded-cluster is found", + conditional: "== embedded-cluster", + input: providers{ + embeddedCluster: true, + }, + expected: true, + }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -89,6 +97,66 @@ func Test_mustNormalizeDistributionName(t *testing.T) { raw: "Docker-Desktop", expected: dockerDesktop, }, + { + raw: "embedded-cluster", + expected: embeddedCluster, + }, + { + raw: "k0s", + expected: k0s, + }, + { + raw: "kind", + expected: kind, + }, + { + raw: "k3s", + expected: k3s, + }, + { + raw: "ibm", + expected: ibm, + }, + { + raw: "ibmcloud", + expected: ibm, + }, + { + raw: "ibm cloud", + expected: ibm, + }, + { + raw: "gke", + expected: gke, + }, + { + raw: "aks", + expected: aks, + }, + { + raw: "eks", + expected: eks, + }, + { + raw: "oke", + expected: oke, + }, + { + raw: "rke2", + expected: rke2, + }, + { + raw: "dockerdesktop", + expected: dockerDesktop, + }, + { + raw: "docker desktop", + expected: dockerDesktop, + }, + { + raw: "docker-desktop", + expected: dockerDesktop, + }, } for _, test := range tests {