Skip to content

Commit 8d0fa11

Browse files
detect embedded-cluster distribution for reporting (#200)
1 parent 49b4b6e commit 8d0fa11

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

pkg/report/distribution.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ func distributionFromLabels(clientset kubernetes.Interface) types.Distribution {
8181
if k == "minikube.k8s.io/version" {
8282
return types.Minikube
8383
}
84+
if k == "kots.io/embedded-cluster-role" {
85+
return types.EmbeddedCluster
86+
}
8487
}
8588
}
8689
return types.UnknownDistribution

pkg/report/distribution_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,23 @@ func TestGetDistribution(t *testing.T) {
163163
},
164164
want: types.Minikube,
165165
},
166+
{
167+
name: "embedded-cluster from labels",
168+
args: args{
169+
clientset: mockClientsetForDistribution(&mockClientsetForDistributionOpts{
170+
objects: []runtime.Object{
171+
&corev1.Node{
172+
ObjectMeta: metav1.ObjectMeta{
173+
Labels: map[string]string{
174+
"kots.io/embedded-cluster-role": "total-1",
175+
},
176+
},
177+
},
178+
},
179+
}),
180+
},
181+
want: types.EmbeddedCluster,
182+
},
166183
{
167184
name: "gke from version",
168185
args: args{

pkg/report/types/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const (
1212
AKS
1313
DigitalOcean
1414
EKS
15+
EmbeddedCluster
1516
GKE
1617
K0s
1718
K3s
@@ -46,6 +47,8 @@ func (d Distribution) String() string {
4647
return "digital-ocean"
4748
case EKS:
4849
return "eks"
50+
case EmbeddedCluster:
51+
return "embedded-cluster"
4952
case GKE:
5053
return "gke"
5154
case K0s:

0 commit comments

Comments
 (0)