Skip to content

Commit

Permalink
Remove GKE,AKS,EKS,OKE kontainer engine v1
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitsakala committed Jan 24, 2025
1 parent 3f7656e commit bdffa15
Show file tree
Hide file tree
Showing 20 changed files with 134 additions and 3,189 deletions.
32 changes: 0 additions & 32 deletions rancher2/data_source_rancher2_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ func dataSourceRancher2Cluster() *schema.Resource {
Schema: clusterK3SConfigFields(),
},
},
"eks_config": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: clusterEKSConfigFields(),
},
},
"eks_config_v2": {
Type: schema.TypeList,
MaxItems: 1,
Expand All @@ -76,14 +68,6 @@ func dataSourceRancher2Cluster() *schema.Resource {
Schema: clusterEKSConfigV2Fields(),
},
},
"aks_config": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: clusterAKSConfigFields(),
},
},
"aks_config_v2": {
Type: schema.TypeList,
MaxItems: 1,
Expand All @@ -92,14 +76,6 @@ func dataSourceRancher2Cluster() *schema.Resource {
Schema: clusterAKSConfigV2Fields(),
},
},
"gke_config": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: clusterGKEConfigFields(),
},
},
"gke_config_v2": {
Type: schema.TypeList,
MaxItems: 1,
Expand All @@ -108,14 +84,6 @@ func dataSourceRancher2Cluster() *schema.Resource {
Schema: clusterGKEConfigV2Fields(),
},
},
"oke_config": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: clusterOKEConfigFields(),
},
},
"default_project_id": {
Type: schema.TypeString,
Computed: true,
Expand Down
24 changes: 0 additions & 24 deletions rancher2/resource_rancher2_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,39 +290,15 @@ func resourceRancher2ClusterUpdate(d *schema.ResourceData, meta interface{}) err

replace := false
switch driver := ToLower(d.Get("driver").(string)); driver {
case clusterDriverAKS:
aksConfig, err := expandClusterAKSConfig(d.Get("aks_config").([]interface{}), d.Get("name").(string))
if err != nil {
return err
}
update["azureKubernetesServiceConfig"] = aksConfig
case ToLower(clusterDriverAKSV2):
aksConfigV2 := expandClusterAKSConfigV2(d.Get("aks_config_v2").([]interface{}))
update["aksConfig"] = aksConfigV2
case clusterDriverEKS:
eksConfig, err := expandClusterEKSConfig(d.Get("eks_config").([]interface{}), d.Get("name").(string))
if err != nil {
return err
}
update["amazonElasticContainerServiceConfig"] = eksConfig
case ToLower(clusterDriverEKSV2):
eksConfigV2 := expandClusterEKSConfigV2(d.Get("eks_config_v2").([]interface{}))
update["eksConfig"] = fixClusterEKSConfigV2(d.Get("eks_config_v2").([]interface{}), structToMap(eksConfigV2))
case clusterDriverGKE:
gkeConfig, err := expandClusterGKEConfig(d.Get("gke_config").([]interface{}), d.Get("name").(string))
if err != nil {
return err
}
update["googleKubernetesEngineConfig"] = gkeConfig
case ToLower(clusterDriverGKEV2):
gkeConfig := expandClusterGKEConfigV2(d.Get("gke_config_v2").([]interface{}))
update["gkeConfig"] = fixClusterGKEConfigV2(structToMap(gkeConfig))
case clusterOKEKind:
okeConfig, err := expandClusterOKEConfig(d.Get("oke_config").([]interface{}), d.Get("name").(string))
if err != nil {
return err
}
update["okeEngineConfig"] = okeConfig
case ToLower(clusterDriverRKE):
rkeConfig, err := expandClusterRKEConfig(d.Get("rke_config").([]interface{}), d.Get("name").(string))
if err != nil {
Expand Down
66 changes: 1 addition & 65 deletions rancher2/schema_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
)

var (
clusterDrivers = []string{clusterDriverImported, clusterDriverAKS, clusterDriverEKS, clusterDriverGKE, clusterDriverGKEV2, clusterDriverK3S, clusterDriverOKE, clusterDriverRKE, clusterDriverRKE2}
clusterDrivers = []string{clusterDriverImported, clusterDriverGKEV2, clusterDriverK3S, clusterDriverRKE, clusterDriverRKE2}
clusterRegistrationTokenNames = []string{clusterRegistrationTokenName, "system"}
)

Expand All @@ -25,7 +25,6 @@ type Cluster struct {
AmazonElasticContainerServiceConfig *AmazonElasticContainerServiceConfig `json:"amazonElasticContainerServiceConfig,omitempty" yaml:"amazonElasticContainerServiceConfig,omitempty"`
AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty" yaml:"azureKubernetesServiceConfig,omitempty"`
GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty" yaml:"googleKubernetesEngineConfig,omitempty"`
OracleKubernetesEngineConfig *OracleKubernetesEngineConfig `json:"okeEngineConfig,omitempty" yaml:"okeEngineConfig,omitempty"`
}

// Schemas
Expand Down Expand Up @@ -143,33 +142,6 @@ func clusterFieldsV0() map[string]*schema.Schema {
Schema: clusterK3SConfigFields(),
},
},
"eks_config": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: []string{"aks_config", "gke_config", "k3s_config", "rke_config"},
Elem: &schema.Resource{
Schema: clusterEKSConfigFields(),
},
},
"aks_config": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: []string{"eks_config", "gke_config", "k3s_config", "rke_config"},
Elem: &schema.Resource{
Schema: clusterAKSConfigFields(),
},
},
"gke_config": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: []string{"aks_config", "eks_config", "k3s_config", "rke_config"},
Elem: &schema.Resource{
Schema: clusterGKEConfigFields(),
},
},
"default_project_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -357,15 +329,6 @@ func clusterFields() map[string]*schema.Schema {
Schema: clusterK3SConfigFields(),
},
},
"eks_config": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: []string{"aks_config", "aks_config_v2", "eks_config_v2", "gke_config", "gke_config_v2", "k3s_config", "oke_config", "rke_config", "rke2_config"},
Elem: &schema.Resource{
Schema: clusterEKSConfigFields(),
},
},
"eks_config_v2": {
Type: schema.TypeList,
MaxItems: 1,
Expand All @@ -376,15 +339,6 @@ func clusterFields() map[string]*schema.Schema {
Schema: clusterEKSConfigV2Fields(),
},
},
"aks_config": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: []string{"eks_config", "aks_config_v2", "eks_config_v2", "gke_config", "gke_config_v2", "k3s_config", "oke_config", "rke_config", "rke2_config"},
Elem: &schema.Resource{
Schema: clusterAKSConfigFields(),
},
},
"aks_config_v2": {
Type: schema.TypeList,
MaxItems: 1,
Expand All @@ -394,15 +348,6 @@ func clusterFields() map[string]*schema.Schema {
Schema: clusterAKSConfigV2Fields(),
},
},
"gke_config": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: []string{"aks_config", "aks_config_v2", "eks_config", "eks_config_v2", "gke_config_v2", "k3s_config", "oke_config", "rke_config", "rke2_config"},
Elem: &schema.Resource{
Schema: clusterGKEConfigFields(),
},
},
"gke_config_v2": {
Type: schema.TypeList,
MaxItems: 1,
Expand All @@ -412,15 +357,6 @@ func clusterFields() map[string]*schema.Schema {
Schema: clusterGKEConfigV2Fields(),
},
},
"oke_config": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: []string{"aks_config", "aks_config_v2", "eks_config", "eks_config_v2", "gke_config", "gke_config_v2", "k3s_config", "rke_config", "rke2_config"},
Elem: &schema.Resource{
Schema: clusterOKEConfigFields(),
},
},
"default_project_id": {
Type: schema.TypeString,
Computed: true,
Expand Down
Loading

0 comments on commit bdffa15

Please sign in to comment.