Skip to content

Commit

Permalink
detect embedded-cluster distribution for reporting (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
diamonwiggins authored Aug 12, 2024
1 parent 49b4b6e commit 8d0fa11
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/report/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func distributionFromLabels(clientset kubernetes.Interface) types.Distribution {
if k == "minikube.k8s.io/version" {
return types.Minikube
}
if k == "kots.io/embedded-cluster-role" {
return types.EmbeddedCluster
}
}
}
return types.UnknownDistribution
Expand Down
17 changes: 17 additions & 0 deletions pkg/report/distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ func TestGetDistribution(t *testing.T) {
},
want: types.Minikube,
},
{
name: "embedded-cluster from labels",
args: args{
clientset: mockClientsetForDistribution(&mockClientsetForDistributionOpts{
objects: []runtime.Object{
&corev1.Node{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"kots.io/embedded-cluster-role": "total-1",
},
},
},
},
}),
},
want: types.EmbeddedCluster,
},
{
name: "gke from version",
args: args{
Expand Down
3 changes: 3 additions & 0 deletions pkg/report/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const (
AKS
DigitalOcean
EKS
EmbeddedCluster
GKE
K0s
K3s
Expand Down Expand Up @@ -46,6 +47,8 @@ func (d Distribution) String() string {
return "digital-ocean"
case EKS:
return "eks"
case EmbeddedCluster:
return "embedded-cluster"
case GKE:
return "gke"
case K0s:
Expand Down

0 comments on commit 8d0fa11

Please sign in to comment.