Skip to content

Commit 2298ec3

Browse files
authored
Supports the Kubernetes distribution analyzer identifying VMware Tanzu (#766)
Adds a check to the Kubernetes distribution analyzer to identify VMware Tanzu using the same approach as identifying OpenShift.
1 parent afa2eb5 commit 2298ec3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/analyze/distribution.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type providers struct {
1818
gke bool
1919
digitalOcean bool
2020
openShift bool
21+
tanzu bool
2122
kurl bool
2223
aks bool
2324
ibm bool
@@ -36,6 +37,7 @@ const (
3637
gke Provider = iota
3738
digitalOcean Provider = iota
3839
openShift Provider = iota
40+
tanzu Provider = iota
3941
kurl Provider = iota
4042
aks Provider = iota
4143
ibm Provider = iota
@@ -44,12 +46,16 @@ const (
4446
k3s Provider = iota
4547
)
4648

47-
func CheckOpenShift(foundProviders *providers, apiResources []*metav1.APIResourceList, provider string) string {
49+
func CheckApiResourcesForProviders(foundProviders *providers, apiResources []*metav1.APIResourceList, provider string) string {
4850
for _, resource := range apiResources {
4951
if strings.HasPrefix(resource.GroupVersion, "apps.openshift.io/") {
5052
foundProviders.openShift = true
5153
return "openShift"
5254
}
55+
if strings.HasPrefix(resource.GroupVersion, "run.tanzu.vmware.com/") {
56+
foundProviders.tanzu = true
57+
return "tanzu"
58+
}
5359
}
5460

5561
return provider
@@ -157,8 +163,9 @@ func analyzeDistribution(analyzer *troubleshootv1beta2.Distribution, getCollecte
157163
if err := json.Unmarshal(apiResourcesBytes, &apiResources); err != nil {
158164
return nil, errors.Wrap(err, "failed to unmarshal api resource list")
159165
}
160-
_ = CheckOpenShift(&foundProviders, apiResources, "")
166+
_ = CheckApiResourcesForProviders(&foundProviders, apiResources, "")
161167
}
168+
162169
title := analyzer.CheckName
163170
if title == "" {
164171
title = "Kubernetes Distribution"
@@ -322,6 +329,8 @@ func mustNormalizeDistributionName(raw string) Provider {
322329
return digitalOcean
323330
case "openshift":
324331
return openShift
332+
case "tanzu":
333+
return tanzu
325334
case "kurl":
326335
return kurl
327336
case "aks":

0 commit comments

Comments
 (0)