Skip to content

Commit 66868d2

Browse files
authored
Merge pull request #276 from rawmind0/mtu
Added mtu argument to rke_config.network argument on rancher2_cluster resource
2 parents d72a877 + 180244a commit 66868d2

41 files changed

Lines changed: 6749 additions & 113 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ ENHANCEMENTS:
88

99
* Added `plugin` optional value `none` to `rke_config` argument on `rancher2_cluster` resource
1010
* Updated multiline arguments to trim spaces by default and avoid false diff
11+
* Updated `rancher/types` go modules and vendor files
12+
* Added `mtu` argument to `rke_config.network` argument on `rancher2_cluster` resource
1113
* Added `custom_target_config` argument to `rancher2_cluster_logging` and `rancher2_project_logging` resources
1214

1315
BUG FIXES:

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ module github.com/terraform-providers/terraform-provider-rancher2
33
go 1.12
44

55
require (
6+
github.com/google/btree v1.0.0 // indirect
67
github.com/hashicorp/go-version v1.2.0
78
github.com/hashicorp/terraform-plugin-sdk v1.7.0
89
github.com/rancher/norman v0.0.0-20200206042542-ef3920abad1c
9-
github.com/rancher/types v0.0.0-20191126013101-de3dc217d60f
10+
github.com/rancher/types v0.0.0-20191220141556-ad31d6815bbd
1011
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
1112
)
1213

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ github.com/rancher/types v0.0.0-20191023170600-1563e7864c02 h1:KUkhl//mPmHN0wYGH
635635
github.com/rancher/types v0.0.0-20191023170600-1563e7864c02/go.mod h1:3k1KigFfdRBJhiE8EXTpoM0aPXAFuYuGxKtU93oNxAY=
636636
github.com/rancher/types v0.0.0-20191126013101-de3dc217d60f h1:Zt90hloFDzE9sK/eiNCDuJOinGUraZqZXMj+y/l7pOM=
637637
github.com/rancher/types v0.0.0-20191126013101-de3dc217d60f/go.mod h1:yYtjxRexsviS9aPO0qp1gqnMSLRRoe0JW6Mqu1EbJZM=
638+
github.com/rancher/types v0.0.0-20191220141556-ad31d6815bbd h1:7wlqMFfCZKvcsC7CMF1u0+3Lo7S5VE/SfN3k8CcLi8I=
639+
github.com/rancher/types v0.0.0-20191220141556-ad31d6815bbd/go.mod h1:yYtjxRexsviS9aPO0qp1gqnMSLRRoe0JW6Mqu1EbJZM=
638640
github.com/rancher/wrangler v0.1.5 h1:HiXOeP6Kci2DK+e04D1g6INT77xAYpAr54zmTTe0Spk=
639641
github.com/rancher/wrangler v0.1.5/go.mod h1:EYP7cqpg42YqElaCm+U9ieSrGQKAXxUH5xsr+XGpWyE=
640642
github.com/rancher/wrangler v0.4.1 h1:kQLE6syPbX4ciwU4OF+EHIPT9zj6r6pyN83u9Gsv5eg=
@@ -884,6 +886,7 @@ golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtn
884886
golang.org/x/tools v0.0.0-20190926165942-a8d5d34286bd/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
885887
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
886888
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
889+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
887890
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
888891
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
889892
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=

rancher2/schema_cluster_rke_config_network.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ func clusterRKEConfigNetworkFields() map[string]*schema.Schema {
103103
Schema: clusterRKEConfigNetworkWeaveFields(),
104104
},
105105
},
106+
"mtu": {
107+
Type: schema.TypeInt,
108+
Optional: true,
109+
Default: 0,
110+
ValidateFunc: validation.IntBetween(0, 9000),
111+
},
106112
"options": {
107113
Type: schema.TypeMap,
108114
Optional: true,

rancher2/structure_cluster_rke_config_network.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ func flattenClusterRKEConfigNetwork(in *managementClient.NetworkConfig) ([]inter
9696
obj["weave_network_provider"] = weaveNetwork
9797
}
9898

99+
if in.MTU > 0 {
100+
obj["mtu"] = int(in.MTU)
101+
}
102+
99103
if len(in.Options) > 0 {
100104
obj["options"] = toMapInterface(in.Options)
101105
}
@@ -205,6 +209,10 @@ func expandClusterRKEConfigNetwork(p []interface{}) (*managementClient.NetworkCo
205209
obj.WeaveNetworkProvider = weaveNetwork
206210
}
207211

212+
if v, ok := in["mtu"].(int); ok && v > 0 {
213+
obj.MTU = int64(v)
214+
}
215+
208216
if v, ok := in["options"].(map[string]interface{}); ok && len(v) > 0 {
209217
obj.Options = toMapString(v)
210218
}

rancher2/structure_cluster_rke_config_network_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func init() {
6161
}
6262
testClusterRKEConfigNetworkConfCalico = &managementClient.NetworkConfig{
6363
CalicoNetworkProvider: testClusterRKEConfigNetworkCalicoConf,
64+
MTU: 1500,
6465
Options: map[string]string{
6566
"option1": "value1",
6667
"option2": "value2",
@@ -70,6 +71,7 @@ func init() {
7071
testClusterRKEConfigNetworkInterfaceCalico = []interface{}{
7172
map[string]interface{}{
7273
"calico_network_provider": testClusterRKEConfigNetworkCalicoInterface,
74+
"mtu": 1500,
7375
"options": map[string]interface{}{
7476
"option1": "value1",
7577
"option2": "value2",
@@ -79,6 +81,7 @@ func init() {
7981
}
8082
testClusterRKEConfigNetworkConfCanal = &managementClient.NetworkConfig{
8183
CanalNetworkProvider: testClusterRKEConfigNetworkCanalConf,
84+
MTU: 1500,
8285
Options: map[string]string{
8386
"option1": "value1",
8487
"option2": "value2",
@@ -88,6 +91,7 @@ func init() {
8891
testClusterRKEConfigNetworkInterfaceCanal = []interface{}{
8992
map[string]interface{}{
9093
"canal_network_provider": testClusterRKEConfigNetworkCanalInterface,
94+
"mtu": 1500,
9195
"options": map[string]interface{}{
9296
"option1": "value1",
9397
"option2": "value2",
@@ -97,6 +101,7 @@ func init() {
97101
}
98102
testClusterRKEConfigNetworkConfFlannel = &managementClient.NetworkConfig{
99103
FlannelNetworkProvider: testClusterRKEConfigNetworkFlannelConf,
104+
MTU: 1500,
100105
Options: map[string]string{
101106
"option1": "value1",
102107
"option2": "value2",
@@ -106,6 +111,7 @@ func init() {
106111
testClusterRKEConfigNetworkInterfaceFlannel = []interface{}{
107112
map[string]interface{}{
108113
"flannel_network_provider": testClusterRKEConfigNetworkFlannelInterface,
114+
"mtu": 1500,
109115
"options": map[string]interface{}{
110116
"option1": "value1",
111117
"option2": "value2",
@@ -115,6 +121,7 @@ func init() {
115121
}
116122
testClusterRKEConfigNetworkConfWeave = &managementClient.NetworkConfig{
117123
WeaveNetworkProvider: testClusterRKEConfigNetworkWeaveConf,
124+
MTU: 1500,
118125
Options: map[string]string{
119126
"option1": "value1",
120127
"option2": "value2",
@@ -124,6 +131,7 @@ func init() {
124131
testClusterRKEConfigNetworkInterfaceWeave = []interface{}{
125132
map[string]interface{}{
126133
"weave_network_provider": testClusterRKEConfigNetworkWeaveInterface,
134+
"mtu": 1500,
127135
"options": map[string]interface{}{
128136
"option1": "value1",
129137
"option2": "value2",

0 commit comments

Comments
 (0)