Skip to content

Commit

Permalink
feat(kots): add embedded cluster distribution (#4605)
Browse files Browse the repository at this point in the history
  • Loading branch information
DexterYan committed May 9, 2024
1 parent de315f2 commit 6462a77
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/reporting/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func distributionFromLabels(clientset kubernetes.Interface) Distribution {
// Based on: https://docs.oracle.com/en-us/iaas/Content/ContEng/Reference/contengsupportedlabelsusecases.htm
return OKE
}
if k == "kots.io/embedded-cluster-role" {
return EmbeddedCluster
}
}
}
return UnknownDistribution
Expand Down
17 changes: 17 additions & 0 deletions pkg/reporting/distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ func TestGetDistribution(t *testing.T) {
},
want: Minikube,
},
{
name: "EmbeddedCluster from labels",
args: args{
clientset: mockClientsetForDistribution(&mockClientsetForDistributionOpts{
objects: []runtime.Object{
&corev1.Node{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"kots.io/embedded-cluster-role": "foo",
},
},
},
},
}),
},
want: EmbeddedCluster,
},
{
name: "OKE from labels",
args: args{
Expand Down
3 changes: 3 additions & 0 deletions pkg/reporting/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
OpenShift
RKE2
Tanzu
EmbeddedCluster
)

type Reporter interface {
Expand Down Expand Up @@ -79,6 +80,8 @@ func (d Distribution) String() string {
return "rke2"
case Tanzu:
return "tanzu"
case EmbeddedCluster:
return "embedded-cluster"
}
return "unknown"
}

0 comments on commit 6462a77

Please sign in to comment.