Skip to content

Commit

Permalink
Add ClusterInfo
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Sep 25, 2024
1 parent fd4d939 commit 068e8f1
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
25 changes: 22 additions & 3 deletions api/v1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,26 @@ func (cm ClusterManager) String() string {
}

type CAPIClusterInfo struct {
Provider string `json:"provider,omitempty"`
Namespace string `json:"namespace,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
Provider CAPIProvider `json:"provider,omitempty"`
Namespace string `json:"namespace,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
}

// ClusterInfo used in ace-installer
type ClusterInfo struct {
UID string `json:"uid"`
Name string `json:"name"`
ClusterManagers []string `json:"clusterManagers"`
// +optional
CAPI CAPIClusterInfo `json:"capi"`
}

// +kubebuilder:validation:Enum=capa;capg;capz
type CAPIProvider string

const (
CAPIProviderDisabled CAPIProvider = ""
CAPIProviderCAPA CAPIProvider = "capa"
CAPIProviderCAPG CAPIProvider = "capg"
CAPIProviderCAPZ CAPIProvider = "capz"
)
22 changes: 22 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cluster/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ func getCAPIValues(values map[string]any) (string, string, string, error) {
return capiProvider, clusterName, ns, nil
}

func getProviderName(kind string) string {
func getProviderName(kind string) kmapi.CAPIProvider {
switch kind {
case "AWSManagedCluster", "AWSManagedControlPlane":
return "capa"
return kmapi.CAPIProviderCAPA
case "AzureManagedCluster":
return "capz"
return kmapi.CAPIProviderCAPZ
case "GCPManagedCluster":
return "capg"
return kmapi.CAPIProviderCAPG
}
return ""
}
Expand Down

0 comments on commit 068e8f1

Please sign in to comment.