Skip to content

Commit

Permalink
[WIP] provider/google: Update Container Engine features
Browse files Browse the repository at this point in the history
This change introduces support for subnetworks and addon configurations
in a Google Container Engine cluster:

1. Addons may only be customized at create time and may not be updated.
2. Vendored google.golang.org/api packages were updated
  • Loading branch information
evandbrown committed Mar 25, 2016
1 parent 07fee77 commit a52e56d
Show file tree
Hide file tree
Showing 20 changed files with 2,248 additions and 1,577 deletions.
29 changes: 15 additions & 14 deletions Godeps/Godeps.json

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

74 changes: 73 additions & 1 deletion builtin/providers/google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,56 @@ func resourceContainerCluster() *schema.Resource {
Default: "default",
ForceNew: true,
},

"subnetwork": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"addons_config": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"http_load_balancing": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"disabled": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
ForceNew: true,
},
},
},
},
"horizontal_pod_autoscaling": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"disabled": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
ForceNew: true,
},
},
},
},
},
},
},
"node_config": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -240,6 +289,28 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
cluster.Network = v.(string)
}

if v, ok := d.GetOk("subnetwork"); ok {
cluster.Subnetwork = v.(string)
}

if v, ok := d.GetOk("addons_config"); ok {
addonsConfig := v.([]interface{})[0].(map[string]interface{})
cluster.AddonsConfig = &container.AddonsConfig{}

if v, ok := addonsConfig["http_load_balancing"]; ok {
addon := v.([]interface{})[0].(map[string]interface{})
cluster.AddonsConfig.HttpLoadBalancing = &container.HttpLoadBalancing{
Disabled: addon["disabled"].(bool),
}
}

if v, ok := addonsConfig["horizontal_pod_autoscaling"]; ok {
addon := v.([]interface{})[0].(map[string]interface{})
cluster.AddonsConfig.HorizontalPodAutoscaling = &container.HorizontalPodAutoscaling{
Disabled: addon["disabled"].(bool),
}
}
}
if v, ok := d.GetOk("node_config"); ok {
nodeConfigs := v.([]interface{})
if len(nodeConfigs) > 1 {
Expand Down Expand Up @@ -346,6 +417,7 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
d.Set("logging_service", cluster.LoggingService)
d.Set("monitoring_service", cluster.MonitoringService)
d.Set("network", cluster.Network)
d.Set("subnetwork", cluster.Subnetwork)
d.Set("node_config", flattenClusterNodeConfig(cluster.NodeConfig))
d.Set("instance_group_urls", cluster.InstanceGroupUrls)

Expand Down
3 changes: 3 additions & 0 deletions vendor/golang.org/x/oauth2/internal/token.go

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

Loading

0 comments on commit a52e56d

Please sign in to comment.