Skip to content

Commit

Permalink
Update provider constants (#596)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Oct 8, 2024
1 parent 348a6be commit a32f7d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions api/v1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@ import (
"strings"
)

// +kubebuilder:validation:Enum=Aws;Azure;DigitalOcean;GoogleCloud;Linode;Packet;Scaleway;Vultr;BareMetal;KIND;Generic
// +kubebuilder:validation:Enum=AKS;DigitalOcean;EKS;Exoscale;Generic;GKE;Linode;Packet;Rancher;Scaleway;Vultr
type HostingProvider string

const (
HostingProviderAWS HostingProvider = "Aws"
HostingProviderAzure HostingProvider = "Azure"
HostingProviderAKS HostingProvider = "AKS"
HostingProviderDigitalOcean HostingProvider = "DigitalOcean"
HostingProviderGoogleCloud HostingProvider = "GoogleCloud"
HostingProviderEKS HostingProvider = "EKS"
HostingProviderExoscale HostingProvider = "Exoscale"
HostingProviderGeneric HostingProvider = "Generic"
HostingProviderGKE HostingProvider = "GKE"
HostingProviderLinode HostingProvider = "Linode"
HostingProviderPacket HostingProvider = "Packet"
HostingProviderRancher HostingProvider = "Rancher"
HostingProviderScaleway HostingProvider = "Scaleway"
HostingProviderVultr HostingProvider = "Vultr"
HostingProviderBareMetal HostingProvider = "BareMetal"
HostingProviderKIND HostingProvider = "KIND"
HostingProviderGeneric HostingProvider = "Generic"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions cluster/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ func DetectProvider(cfg *rest.Config, mapper meta.RESTMapper) (kmapi.HostingProv

for _, host := range crt.DNSNames {
if strings.HasSuffix(host, eksDomain) {
return kmapi.HostingProviderAWS, nil
return kmapi.HostingProviderEKS, nil
} else if strings.HasSuffix(host, aksDomain) {
return kmapi.HostingProviderAzure, nil
return kmapi.HostingProviderAKS, nil
} else if strings.HasSuffix(host, doDomain) {
return kmapi.HostingProviderDigitalOcean, nil
} else if strings.HasSuffix(host, exoscaleDomain) {
Expand All @@ -108,7 +108,7 @@ func DetectProvider(cfg *rest.Config, mapper meta.RESTMapper) (kmapi.HostingProv
Group: "networking.gke.io",
Kind: "Network",
}); err == nil {
return kmapi.HostingProviderGoogleCloud, nil
return kmapi.HostingProviderGKE, nil
}

return "", nil
Expand Down

0 comments on commit a32f7d2

Please sign in to comment.