Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/telemetry/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,27 @@ const (
openshift = "Openshift"
rke = "RKE"
rke2 = "RKE2"
evg = "Evergreen"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for those new flavours in TestDetectKubernetesFlavour (+ already missing ones 🙏 )

minikube = "Minikube"
k3s = "K3s"
microk8s = "MicroK8s"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am missing the context around adding these, where does this requirement come from?

If we want to cover all the possible flavors then there are some names still missing.

)

var kubernetesFlavourLabelsMapping = map[string]string{
"eks.amazonaws.com/nodegroup": eks,
"cloud.google.com/gke-nodepool": gke,
"kubernetes.azure.com/agentpool": aks,
"node.openshift.io/os_id": openshift,
"mongodb.com/evergreen": evg,
"minikube.k8s.io/name": minikube,
"microk8s.io/cluster": microk8s,
}

var kubernetesFlavourAnnotationsMapping = map[string]string{
"rke.cattle.io/external-ip": rke,
"rke.cattle.io/internal-ip": rke,
"k3s.io/hostname": k3s,
"k3s.io/internal-ip": k3s,
}

// detectClusterInfo detects the Kubernetes version and cluster flavor
Expand Down Expand Up @@ -101,6 +110,8 @@ func detectKubernetesFlavour(ctx context.Context, uncachedClient kubeclient.Read
return eks
case strings.Contains(kubeGitApiVersion, "+vmware"):
return vmware
case strings.Contains(kubeGitApiVersion, "+k3s"):
return k3s
}

// Limit is propagated to the apiserver which propagates to etcd as it is. Thus, there is not a lot of
Expand Down
2 changes: 1 addition & 1 deletion pkg/telemetry/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func collectOperatorSnapshot(ctx context.Context, memberClusterMap map[string]Co
KubernetesClusterIDs: kubeClusterUUIDList,
OperatorID: operatorUUID,
OperatorVersion: versionutil.StaticContainersOperatorVersion(),
OperatorType: MEKO,
OperatorType: MCK,
OperatorArchitecture: runtime.GOARCH,
OperatorOS: runtime.GOOS,
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/telemetry/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ func TestCollectOperatorSnapshot(t *testing.T) {
},
expectedProps: OperatorUsageSnapshotProperties{
OperatorID: testOperatorUUID,
OperatorType: MEKO,
OperatorType: MCK,
OperatorArchitecture: runtime.GOARCH,
OperatorOS: runtime.GOOS,
},
Expand Down Expand Up @@ -1423,7 +1423,7 @@ func TestCollectOperatorSnapshot(t *testing.T) {
assert.Equal(t, runtime.GOARCH, event.Properties["operatorArchitecture"])
assert.Equal(t, runtime.GOOS, event.Properties["operatorOS"])
assert.Equal(t, testOperatorUUID, event.Properties["operatorID"])
assert.Equal(t, string(MEKO), event.Properties["operatorType"])
assert.Equal(t, string(MCK), event.Properties["operatorType"])

assert.Contains(t, event.Properties, "kubernetesClusterID")
assert.Contains(t, event.Properties, "kubernetesClusterIDs")
Expand Down
14 changes: 14 additions & 0 deletions scripts/dev/setup_kind_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,43 @@ apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: ${kind_image}
labels:
mongodb.com/evergreen: true
extraMounts:
- containerPath: /var/lib/kubelet/config.json
hostPath: ${HOME}/.docker/config.json
- role: control-plane
image: ${kind_image}
labels:
mongodb.com/evergreen: true
extraMounts:
- containerPath: /var/lib/kubelet/config.json
hostPath: ${HOME}/.docker/config.json
- role: control-plane
image: ${kind_image}
labels:
mongodb.com/evergreen: true
extraMounts:
- containerPath: /var/lib/kubelet/config.json
hostPath: ${HOME}/.docker/config.json
- role: worker
image: ${kind_image}
labels:
mongodb.com/evergreen: true
extraMounts:
- containerPath: /var/lib/kubelet/config.json
hostPath: ${HOME}/.docker/config.json
- role: worker
image: ${kind_image}
labels:
mongodb.com/evergreen: true
extraMounts:
- containerPath: /var/lib/kubelet/config.json
hostPath: ${HOME}/.docker/config.json
- role: worker
image: ${kind_image}
labels:
mongodb.com/evergreen: true
extraMounts:
- containerPath: /var/lib/kubelet/config.json
hostPath: ${HOME}/.docker/config.json
Expand All @@ -133,6 +145,8 @@ apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: ${kind_image}
labels:
mongodb.com/evergreen: true
extraMounts:
- containerPath: /var/lib/kubelet/config.json
hostPath: ${HOME}/.docker/config.json
Expand Down