Skip to content

Commit

Permalink
Support for spot node pool
Browse files Browse the repository at this point in the history
- Support for spot node pool in azurerm_kubernetes_cluster

Fixes hashicorp#6086
  • Loading branch information
rajalokan committed Mar 23, 2020
1 parent 8416bfc commit dbfd83d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ func dataSourceArmKubernetesCluster() *schema.Resource {
Type: schema.TypeBool,
Optional: true,
},

"priority": {
Type: schema.TypeString,
Optional: true,
},

"eviction_policy": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions azurerm/internal/services/containers/kubernetes_nodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ func ExpandDefaultNodePool(d *schema.ResourceData) (*[]containerservice.ManagedC

// // TODO: support these in time
// OrchestratorVersion: nil,
// ScaleSetEvictionPolicy: "",
// ScaleSetPriority: "",
ScaleSetEvictionPolicy: containerservice.ScaleSetEvictionPolicy(raw["eviction_policy"].(string)),
ScaleSetPriority: containerservice.ScaleSetPriority(raw["priority"].(string)),
}

availabilityZonesRaw := raw["availability_zones"].([]interface{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ func resourceArmKubernetesClusterNodePool() *schema.Resource {
ForceNew: true,
ValidateFunc: azure.ValidateResourceID,
},

"priority": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: azure.ValidateResourceID,
},

"eviction_policy": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: azure.ValidateResourceID,
},
},
}
}
Expand Down Expand Up @@ -245,6 +259,14 @@ func resourceArmKubernetesClusterNodePoolCreate(d *schema.ResourceData, meta int
profile.VnetSubnetID = utils.String(vnetSubnetID)
}

// if priority := d.Get("priority").(string); priority != "" {
// profile.ScaleSetPriority = utils.String(priority)
// }

// if eviction_policy := d.Get("eviction_policy").(string); eviction_policy != "" {
// profile.ScaleSetEvictionPolicy = utils.String(eviction_policy)
// }

maxCount := d.Get("max_count").(int)
minCount := d.Get("min_count").(int)

Expand Down Expand Up @@ -500,6 +522,8 @@ func resourceArmKubernetesClusterNodePoolRead(d *schema.ResourceData, meta inter
d.Set("os_type", string(props.OsType))
d.Set("vnet_subnet_id", props.VnetSubnetID)
d.Set("vm_size", string(props.VMSize))
d.Set("priority", string(props.ScaleSetPriority))
d.Set("eviction_policy", string(props.ScaleSetEvictionPolicy))
}

return tags.FlattenAndSet(d, resp.Tags)
Expand Down

0 comments on commit dbfd83d

Please sign in to comment.