Skip to content

Commit

Permalink
Add extra_args_array Field rancher#1209
Browse files Browse the repository at this point in the history
  • Loading branch information
khrisrichardson authored and Shane Riddell committed Oct 13, 2023
1 parent 148cbd6 commit b7fa733
Show file tree
Hide file tree
Showing 20 changed files with 434 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,7 @@ The following attributes are exported:
* `creation` - (Optional/Computed) Creation option for etcd service (string)
* `external_urls` - (Optional) External urls for etcd service (list)
* `extra_args` - (Optional/Computed) Extra arguments for etcd service (map)
* `extra_args_array` - (Optional/Computed) Extra arguments array for etcd service (list)
* `extra_binds` - (Optional) Extra binds for etcd service (list)
* `extra_env` - (Optional) Extra environment for etcd service (list)
* `gid` - (Optional) Etcd service GID. Default: `0`. For Rancher v2.3.x and above (int)
Expand Down Expand Up @@ -1269,6 +1270,7 @@ The following attributes are exported:
* `audit_log` - (Optional) K8s audit log configuration. (list maxitems: 1)
* `event_rate_limit` - (Optional) K8s event rate limit configuration. (list maxitems: 1)
* `extra_args` - (Optional/Computed) Extra arguments for kube API service (map)
* `extra_args_array` - (Optional/Computed) Extra arguments array for kube API service (list)
* `extra_binds` - (Optional) Extra binds for kube API service (list)
* `extra_env` - (Optional) Extra environment for kube API service (list)
* `image` - (Optional/Computed) Docker image for kube API service (string)
Expand Down Expand Up @@ -1391,6 +1393,7 @@ EOF

* `cluster_cidr` - (Optional/Computed) Cluster CIDR option for kube controller service (string)
* `extra_args` - (Optional/Computed) Extra arguments for kube controller service (map)
* `extra_args_array` - (Optional/Computed) Extra arguments array for kube controller service (list)
* `extra_binds` - (Optional) Extra binds for kube controller service (list)
* `extra_env` - (Optional) Extra environment for kube controller service (list)
* `image` - (Optional/Computed) Docker image for kube controller service (string)
Expand All @@ -1403,6 +1406,7 @@ EOF
* `cluster_dns_server` - (Optional/Computed) Cluster DNS Server option for kubelet service (string)
* `cluster_domain` - (Optional/Computed) Cluster Domain option for kubelet service (string)
* `extra_args` - (Optional/Computed) Extra arguments for kubelet service (map)
* `extra_args_array` - (Optional/Computed) Extra arguments array for kubelet service (list)
* `extra_binds` - (Optional) Extra binds for kubelet service (list)
* `extra_env` - (Optional) Extra environment for kubelet service (list)
* `fail_swap_on` - (Optional/Computed) Enable or disable failing when swap on is not supported (bool)
Expand All @@ -1415,6 +1419,7 @@ EOF
###### Arguments

* `extra_args` - (Optional/Computed) Extra arguments for kubeproxy service (map)
* `extra_args_array` - (Optional/Computed) Extra arguments array for kubeproxy service (list)
* `extra_binds` - (Optional) Extra binds for kubeproxy service (list)
* `extra_env` - (Optional) Extra environment for kubeproxy service (list)
* `image` - (Optional/Computed) Docker image for kubeproxy service (string)
Expand All @@ -1424,6 +1429,7 @@ EOF
###### Arguments

* `extra_args` - (Optional/Computed) Extra arguments for scheduler service (map)
* `extra_args_array` - (Optional/Computed) Extra arguments array for scheduler service (list)
* `extra_binds` - (Optional) Extra binds for scheduler service (list)
* `extra_env` - (Optional) Extra environment for scheduler service (list)
* `image` - (Optional/Computed) Docker image for scheduler service (string)
Expand Down
33 changes: 33 additions & 0 deletions rancher2/schema_cluster_rke_config_services_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ func clusterRKEConfigServicesEtcdBackupConfigFields() map[string]*schema.Schema
return s
}

func clusterRKEConfigServicesEtcdExtraArgsArrayFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"extra_arg": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"argument": {
Required: true,
Type: schema.TypeString,
},
"values": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
}
}

func clusterRKEConfigServicesEtcdFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"backup_config": {
Expand Down Expand Up @@ -120,6 +144,15 @@ func clusterRKEConfigServicesEtcdFields() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to etcd services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesEtcdExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down
51 changes: 51 additions & 0 deletions rancher2/schema_cluster_rke_config_services_kube_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,30 @@ func clusterRKEConfigServicesKubeAPIEventRateLimitFieldsData() map[string]*schem
return s
}

func clusterRKEConfigServicesKubeAPIExtraArgsArrayFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"extra_arg": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"argument": {
Required: true,
Type: schema.TypeString,
},
"values": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
}
}

func clusterRKEConfigServicesKubeAPISecretsEncryptionConfigFieldsV0() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"custom_config": {
Expand Down Expand Up @@ -517,6 +541,15 @@ func clusterRKEConfigServicesKubeAPIFieldsV0() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to kube-api services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesKubeAPIExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -600,6 +633,15 @@ func clusterRKEConfigServicesKubeAPIFields() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to kube-api services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesKubeAPIExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -684,6 +726,15 @@ func clusterRKEConfigServicesKubeAPIFieldsData() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to kube-api services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesKubeAPIExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down
33 changes: 33 additions & 0 deletions rancher2/schema_cluster_rke_config_services_kube_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ import (

//Schemas

func clusterRKEConfigServicesKubeControllerExtraArgsArrayFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"extra_arg": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"argument": {
Required: true,
Type: schema.TypeString,
},
"values": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
}
}

func clusterRKEConfigServicesKubeControllerFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"cluster_cidr": {
Expand All @@ -18,6 +42,15 @@ func clusterRKEConfigServicesKubeControllerFields() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to kube-controller services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesKubeControllerExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down
33 changes: 33 additions & 0 deletions rancher2/schema_cluster_rke_config_services_kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ import (

//Schemas

func clusterRKEConfigServicesKubeletExtraArgsArrayFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"extra_arg": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"argument": {
Required: true,
Type: schema.TypeString,
},
"values": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
}
}

func clusterRKEConfigServicesKubeletFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"cluster_dns_server": {
Expand All @@ -23,6 +47,15 @@ func clusterRKEConfigServicesKubeletFields() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to kubelet services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesKubeletExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down
33 changes: 33 additions & 0 deletions rancher2/schema_cluster_rke_config_services_kubeproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,46 @@ import (

//Schemas

func clusterRKEConfigServicesKubeproxyExtraArgsArrayFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"extra_arg": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"argument": {
Required: true,
Type: schema.TypeString,
},
"values": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
}
}

func clusterRKEConfigServicesKubeproxyFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"extra_args": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to kubeproxy services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesKubeproxyExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down
33 changes: 33 additions & 0 deletions rancher2/schema_cluster_rke_config_services_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,46 @@ import (

//Schemas

func clusterRKEConfigServicesSchedulerExtraArgsArrayFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"extra_arg": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"argument": {
Required: true,
Type: schema.TypeString,
},
"values": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
}
}

func clusterRKEConfigServicesSchedulerFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"extra_args": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
},
"extra_args_array": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Extra Arguments that can be specified multiple times which are added to scheduler services",
Elem: &schema.Resource{
Schema: clusterRKEConfigServicesSchedulerExtraArgsArrayFields(),
},
},
"extra_binds": {
Type: schema.TypeList,
Optional: true,
Expand Down
8 changes: 8 additions & 0 deletions rancher2/structure_cluster_rke_config_services_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ func flattenClusterRKEConfigServicesEtcd(in *managementClient.ETCDService, p []i
obj["extra_args"] = toMapInterface(in.ExtraArgs)
}

if len(in.ExtraArgsArray) > 0 {
obj["extra_args_array"] = flattenExtraArgsArray(in.ExtraArgsArray)
}

if len(in.ExtraBinds) > 0 {
obj["extra_binds"] = toArrayInterface(in.ExtraBinds)
}
Expand Down Expand Up @@ -277,6 +281,10 @@ func expandClusterRKEConfigServicesEtcd(p []interface{}) (*managementClient.ETCD
obj.ExtraArgs = toMapString(v)
}

if v, ok := in["extra_args_array"].([]interface{}); ok && len(v) > 0 {
obj.ExtraArgsArray = expandExtraArgsArray(v)
}

if v, ok := in["extra_binds"].([]interface{}); ok && len(v) > 0 {
obj.ExtraBinds = toArrayString(v)
}
Expand Down
Loading

0 comments on commit b7fa733

Please sign in to comment.