Skip to content

Commit

Permalink
Merge pull request rancher#21 from rawmind0/openstack
Browse files Browse the repository at this point in the history
Fix on cluster resource for rke_config argument openstack cloud_provider
  • Loading branch information
rawmind0 authored Jun 6, 2019
2 parents 46610b8 + 0e8b3d8 commit 525d5ad
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 26 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/go-ini/ini v1.23.1 // indirect
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
github.com/hashicorp/terraform v0.12.0
github.com/rancher/norman v0.0.0-20190411163419-01a996623771
github.com/rancher/types v0.0.0-20190419232237-0aaea5ae1a60
github.com/rancher/norman v0.0.0-20190503155902-ea122abac582
github.com/rancher/types v0.0.0-20190524211942-2361355c4c51
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734
k8s.io/apimachinery v0.0.0-20181022183627-f71dbbc36e12 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,14 @@ github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7q
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/rancher/norman v0.0.0-20190411163419-01a996623771 h1:1bTIw66/xfxn8YUk7YjdMKekP2D0oO+rKnzMv99E1xE=
github.com/rancher/norman v0.0.0-20190411163419-01a996623771/go.mod h1:CgWdUHi0tUimz2RgS6WoC/cDHFSLx9G7EBhlp6wE0ck=
github.com/rancher/norman v0.0.0-20190503155902-ea122abac582 h1:YqE0M4iq2pWwIUkqIhJhnTWXsAXwfcpmLwyYfq0VyMA=
github.com/rancher/norman v0.0.0-20190503155902-ea122abac582/go.mod h1:CgWdUHi0tUimz2RgS6WoC/cDHFSLx9G7EBhlp6wE0ck=
github.com/rancher/terraform-provider-rancher2 v0.2.0-rc5 h1:X+irwoAf9a/g+1+tkOel8ynedRKr7uZ7Yqe1d9TxOm4=
github.com/rancher/terraform-provider-rancher2 v0.2.0-rc5/go.mod h1:2RR5xWbkZ1VbWRjnJdV01FaCmlaNlffYNawteVsbfUg=
github.com/rancher/types v0.0.0-20190419232237-0aaea5ae1a60 h1:rd98DhPCZG4waQpCjJOc5u9iyOvpSgIVaeG31Q8B8gA=
github.com/rancher/types v0.0.0-20190419232237-0aaea5ae1a60/go.mod h1:ePTc7xKI37jRSwgLsg63ITTADceptutuNVG8Fj33QaE=
github.com/rancher/types v0.0.0-20190524211942-2361355c4c51 h1:+QdNZeRXDZ3EyydMo+UHOcU3mQntEQUAokLeVDx9EdQ=
github.com/rancher/types v0.0.0-20190524211942-2361355c4c51/go.mod h1:ePTc7xKI37jRSwgLsg63ITTADceptutuNVG8Fj33QaE=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/satori/go.uuid v0.0.0-20160927100844-b061729afc07 h1:DEZDfcCVq3xDJrjqdCgyN/dHYVoqR92MCsdqCdxmnhM=
github.com/satori/go.uuid v0.0.0-20160927100844-b061729afc07/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
)

const (
openstackLBMonitorDelay = 60
openstackLBMonitorDelay = "60s"
openstackLBMonitorMaxRetries = 5
openstackLBMonitorTimeout = 30
openstackLBMonitorTimeout = "30s"
cloudProviderOpenstackName = "openstack"
)

Expand Down Expand Up @@ -126,7 +126,7 @@ func clusterRKEConfigCloudProviderOpenstackLoadBalancerFields() map[string]*sche
Computed: true,
},
"monitor_delay": {
Type: schema.TypeInt,
Type: schema.TypeString,
Optional: true,
Default: openstackLBMonitorDelay,
},
Expand All @@ -136,7 +136,7 @@ func clusterRKEConfigCloudProviderOpenstackLoadBalancerFields() map[string]*sche
Default: openstackLBMonitorMaxRetries,
},
"monitor_timeout": {
Type: schema.TypeInt,
Type: schema.TypeString,
Optional: true,
Default: openstackLBMonitorTimeout,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ func flattenClusterRKEConfigCloudProviderOpenstackLoadBalancer(in *managementCli

obj["manage_security_groups"] = in.ManageSecurityGroups

if in.MonitorDelay > 0 {
obj["monitor_delay"] = int(in.MonitorDelay)
if len(in.MonitorDelay) > 0 {
obj["monitor_delay"] = in.MonitorDelay
}

if in.MonitorMaxRetries > 0 {
obj["monitor_max_retries"] = int(in.MonitorMaxRetries)
}

if in.MonitorTimeout > 0 {
obj["monitor_timeout"] = int(in.MonitorTimeout)
if len(in.MonitorTimeout) > 0 {
obj["monitor_timeout"] = in.MonitorTimeout
}

if len(in.SubnetID) > 0 {
Expand Down Expand Up @@ -318,16 +318,16 @@ func expandClusterRKEConfigCloudProviderOpenstackLoadBalancer(p []interface{}) (
obj.ManageSecurityGroups = v
}

if v, ok := in["monitor_delay"].(int); ok && v > 0 {
obj.MonitorDelay = int64(v)
if v, ok := in["monitor_delay"].(string); ok && len(v) > 0 {
obj.MonitorDelay = v
}

if v, ok := in["monitor_max_retries"].(int); ok && v > 0 {
obj.MonitorMaxRetries = int64(v)
}

if v, ok := in["monitor_timeout"].(int); ok && v > 0 {
obj.MonitorTimeout = int64(v)
if v, ok := in["monitor_timeout"].(string); ok && len(v) > 0 {
obj.MonitorTimeout = v
}

if v, ok := in["subnet_id"].(string); ok && len(v) > 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ func init() {
LBProvider: "provider",
LBVersion: "version",
ManageSecurityGroups: true,
MonitorDelay: 30,
MonitorDelay: "30s",
MonitorMaxRetries: 5,
MonitorTimeout: 10,
MonitorTimeout: "10s",
SubnetID: "subnet",
UseOctavia: true,
}
Expand All @@ -82,9 +82,9 @@ func init() {
"lb_provider": "provider",
"lb_version": "version",
"manage_security_groups": true,
"monitor_delay": 30,
"monitor_delay": "30s",
"monitor_max_retries": 5,
"monitor_timeout": 10,
"monitor_timeout": "10s",
"subnet_id": "subnet",
"use_octavia": true,
},
Expand Down
8 changes: 8 additions & 0 deletions vendor/github.com/rancher/norman/httperror/error.go

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

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

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

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

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

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

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ github.com/posener/complete
github.com/posener/complete/cmd/install
github.com/posener/complete/cmd
github.com/posener/complete/match
# github.com/rancher/norman v0.0.0-20190411163419-01a996623771
# github.com/rancher/norman v0.0.0-20190503155902-ea122abac582
github.com/rancher/norman/clientbase
github.com/rancher/norman/types
github.com/rancher/norman/httperror
Expand All @@ -227,7 +227,7 @@ github.com/rancher/norman/types/convert
github.com/rancher/norman/types/definition
github.com/rancher/norman/types/slice
github.com/rancher/norman/types/values
# github.com/rancher/types v0.0.0-20190419232237-0aaea5ae1a60
# github.com/rancher/types v0.0.0-20190524211942-2361355c4c51
github.com/rancher/types/client/cluster/v3
github.com/rancher/types/client/management/v3
github.com/rancher/types/client/project/v3
Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ The following attributes are exported:
* `lb_provider` - (Optional/Computed) (string)
* `lb_version` - (Optional/Computed) (string)
* `manage_security_groups` - (Optional/Computed) (bool)
* `monitor_delay` - (Optional/Computed) Default `60` (int)
* `monitor_max_retries` - (Optional/Computed) Default `5` (int)
* `monitor_timeout` - (Optional/Computed) Default `30` (int)
* `monitor_delay` - (Optional/Computed) Default `60s` (string)
* `monitor_max_retries` - (Optional/Computed) Default 5 (int)
* `monitor_timeout` - (Optional/Computed) Default `30s` (string)
* `subnet_id` - (Optional/Computed) (string)
* `use_octavia` - (Optional/Computed) (bool)

Expand Down

0 comments on commit 525d5ad

Please sign in to comment.