Skip to content

Commit

Permalink
PLT-1471: Fixed VIP and dns_server hash set (#535)
Browse files Browse the repository at this point in the history
* PLT-1471: Fixed VIP and dns_server has set

* fixing aws example for PLT-1129
  • Loading branch information
SivaanandM authored Nov 6, 2024
1 parent 6ca4f10 commit f5d27fc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/e2e/aws/resource_cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ resource "spectrocloud_cluster_aws" "cluster" {
count = 1
instance_type = "t3.large"
disk_size_gb = 62
azs = [var.aws_region_az]
azs = var.aws_region_az
}

machine_pool {
name = "worker-basic"
count = 1
instance_type = "t3.large"
azs = [var.aws_region_az]
azs = var.aws_region_az
}

}
24 changes: 24 additions & 0 deletions spectrocloud/cluster_common_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,30 @@ func resourceMachinePoolEdgeNativeHash(v interface{}) int {
if staticIP, ok := hostMap["static_ip"]; ok {
buf.WriteString(fmt.Sprintf("static_ip:%s-", staticIP.(string)))
}

if nicName, ok := hostMap["nic_name"]; ok {
buf.WriteString(fmt.Sprintf("nic_name:%s-", nicName.(string)))
}

if defaultGateway, ok := hostMap["default_gateway"]; ok {
buf.WriteString(fmt.Sprintf("default_gateway:%s-", defaultGateway.(string)))
}

if subnetMask, ok := hostMap["subnet_mask"]; ok {
buf.WriteString(fmt.Sprintf("subnet_mask:%s-", subnetMask.(string)))
}

if dnsServers, ok := hostMap["dns_servers"]; ok {
var dns []string
for _, v := range dnsServers.(*schema.Set).List() {
dns = append(dns, v.(string))
}
buf.WriteString(fmt.Sprintf("dns_servers:%s-", strings.Join(dns, ",")))
}

if twoNodeRole, ok := hostMap["two_node_role"]; ok {
buf.WriteString(fmt.Sprintf("two_node_role:%s-", twoNodeRole.(string)))
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions spectrocloud/resource_cluster_edge_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ func flattenClusterConfigsEdgeNative(cloudConfig map[string]interface{}, config
if config.Spec.ClusterConfig.ControlPlaneEndpoint.Host != "" {
if v, ok := cloudConfig["vip"]; ok && v.(string) != "" {
m["vip"] = config.Spec.ClusterConfig.ControlPlaneEndpoint.Host
} else {
m["vip"] = config.Spec.ClusterConfig.ControlPlaneEndpoint.Host
}
}
if config.Spec.ClusterConfig.NtpServers != nil {
Expand Down

0 comments on commit f5d27fc

Please sign in to comment.