Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument log_opt to rancher2_node_template #1316

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions docs/data-sources/node_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ The following attributes are exported:
* `id` - (Computed) The ID of the resource (string)
* `cloud_credential_id` - (Computed) Cloud credential ID for the Node Template. Required from Rancher v2.2.x (string)
* `description` - (Computed) Description for the Node Template (string)
* `driver` - (Computed) The driver of the node template (string)
* `engine_env` - (Computed) Engine environment for the node template (string)
* `engine_insecure_registry` - (Computed) Insecure registry for the node template (list)
* `engine_install_url` - (Computed) Docker engine install URL for the node template (string)
* `engine_label` - (Computed) Engine label for the node template (string)
* `engine_opt` - (Computed) Engine options for the node template (map)
* `engine_registry_mirror` - (Computed) Engine registry mirror for the node template (list)
* `engine_storage_driver` - (Computed) Engine storage driver for the node template (string)
* `driver` - (Computed) The driver of the Node Template (string)
* `engine_env` - (Computed) Engine environment for the Node Template (string)
* `engine_insecure_registry` - (Computed) Insecure registry for the Node Template (list)
* `engine_install_url` - (Computed) Docker engine install URL for the Node Template (string)
* `engine_label` - (Computed) Engine label for the Node Template (string)
* `engine_opt` - (Computed) Engine options for the Node Template (map)
* `engine_registry_mirror` - (Computed) Engine registry mirror for the Node Template (list)
* `engine_storage_driver` - (Computed) Engine storage driver for the Node Template (string)
* `log_opt` - (Computed) Log options for the Node Template (map)
* `node_taints` - (Computed) Node taints (List)
* `use_internal_ip_address` - (Computed) Engine storage driver for the node template (bool)
* `annotations` - (Computed) Annotations for Node Template object (map)
* `labels` - (Computed) Labels for Node Template object (map)

* `use_internal_ip_address` - (Computed) Engine storage driver for the Node Template (bool)
* `annotations` - (Computed) Annotations for the Node Template (map)
* `labels` - (Computed) Labels for the Node Template (map)
29 changes: 15 additions & 14 deletions docs/resources/node_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,26 @@ The following arguments are supported:
* `cloud_credential_id` - (Optional) Cloud credential ID for the Node Template. Required from Rancher v2.2.x (string)
* `description` - (Optional) Description for the Node Template (string)
* `digitalocean_config` - (Optional) Digitalocean config for the Node Template (list maxitems:1)
* `linode_config` - (Optional) Linode config for the Node Template (list maxitems:1)
* `driver_id` - (Optional/Computed) The node driver id used by the node template. It's required if the node driver isn't built in Rancher (string)
* `engine_env` - (Optional) Engine environment for the node template (string)
* `engine_insecure_registry` - (Optional) Insecure registry for the node template (list)
* `engine_install_url` - (Optional/Computed) Docker engine install URL for the node template. Available install docker versions at `https://github.com/rancher/install-docker` (string)
* `engine_label` - (Optional) Engine label for the node template (string)
* `engine_opt` - (Optional) Engine options for the node template (map)
* `engine_registry_mirror` - (Optional) Engine registry mirror for the node template (list)
* `engine_storage_driver` - (Optional) Engine storage driver for the node template (string)
* `node_taints` - (Optional) Node taints. For Rancher v2.3.3 and above (List)
* `driver_id` - (Optional/Computed) The node driver id used by the Node Template. It's required if the node driver isn't built in Rancher (string)
* `engine_env` - (Optional) Engine environment for the Node Template (string)
* `engine_insecure_registry` - (Optional) Insecure registry for the Node Template (list)
* `engine_install_url` - (Optional/Computed) Docker engine install URL for the Node Template. Available install docker versions at `https://github.com/rancher/install-docker` (string)
* `engine_label` - (Optional) Engine label for the Node Template (string)
* `engine_opt` - (Optional) Engine options for the Node Template (map)
* `engine_registry_mirror` - (Optional) Engine registry mirror for the Node Template (list)
* `engine_storage_driver` - (Optional) Engine storage driver for the Node Template (string)
* `harvester_config` - (Optional) Harvester config for the Node Template (list maxitems:1)
* `hetzner_config` - (Optional) Hetzner config for the Node Template (list maxitems:1)
* `linode_config` - (Optional) Linode config for the Node Template (list maxitems:1)
* `log_opt` - (Optional) Log options for the Node Template (map)
* `node_taints` - (Optional) Node taints. For Rancher v2.3.3 and above (List)
* `opennebula_config` - (Optional) Opennebula config for the Node Template (list maxitems:1)
* `openstack_config` - (Optional) Openstack config for the Node Template (list maxitems:1)
* `outscale_config` - (Optional) Outscale config for the Node Template (list maxitems:1)
* `use_internal_ip_address` - (Optional) Engine storage driver for the node template (bool)
* `use_internal_ip_address` - (Optional) Engine storage driver for the Node Template (bool)
* `vsphere_config` - (Optional) vSphere config for the Node Template (list maxitems:1)
* `annotations` - (Optional) Annotations for Node Template object (map)
* `labels` - (Optional/Computed) Labels for Node Template object (map)
* `annotations` - (Optional) Annotations for the Node Template (map)
* `labels` - (Optional/Computed) Labels for the Node Template (map)

**Note:** `labels` and `node_taints` will be applied to nodes deployed using the Node Template

Expand All @@ -178,7 +179,7 @@ The following arguments are supported:
The following attributes are exported:

* `id` - (Computed) The ID of the resource (string)
* `driver` - (Computed) The driver of the node template (string)
* `driver` - (Computed) The driver of the Node Template (string)

## Nested blocks

Expand Down
11 changes: 11 additions & 0 deletions rancher2/data_source_rancher2_node_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func dataSourceRancher2NodeTemplate() *schema.Resource {
Schema: taintFields(),
},
},
"log_opt": {
Type: schema.TypeMap,
Computed: true,
},
"use_internal_ip_address": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -183,6 +187,13 @@ func flattenDataSourceNodeTemplate(d *schema.ResourceData, in *managementClient.
d.Set("engine_storage_driver", in.EngineStorageDriver)
}

if len(in.LogOpt) > 0 {
err := d.Set("log_opt", toMapInterface(in.LogOpt))
if err != nil {
return err
}
}

d.Set("use_internal_ip_address", *in.UseInternalIPAddress)

if len(in.Annotations) > 0 {
Expand Down
1 change: 1 addition & 0 deletions rancher2/resource_rancher2_node_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func resourceRancher2NodeTemplateUpdate(d *schema.ResourceData, meta interface{}
"engineOpt": toMapString(d.Get("engine_opt").(map[string]interface{})),
"engineRegistryMirror": toArrayString(d.Get("engine_registry_mirror").([]interface{})),
"engineStorageDriver": d.Get("engine_storage_driver").(string),
"logOpt": toMapString(d.Get("log_opt").(map[string]interface{})),
"nodeTaints": expandTaints(d.Get("node_taints").([]interface{})),
"useInternalIpAddress": &useInternalIPAddress,
"annotations": toMapString(d.Get("annotations").(map[string]interface{})),
Expand Down
4 changes: 4 additions & 0 deletions rancher2/schema_node_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ func nodeTemplateFields() map[string]*schema.Schema {
Schema: linodeConfigFields(),
},
},
"log_opt": {
Type: schema.TypeMap,
Optional: true,
},
"node_taints": {
Type: schema.TypeList,
Optional: true,
Expand Down
11 changes: 11 additions & 0 deletions rancher2/structure_node_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ func flattenNodeTemplate(d *schema.ResourceData, in *NodeTemplate) error {
d.Set("engine_storage_driver", in.EngineStorageDriver)
}

if len(in.LogOpt) > 0 {
err := d.Set("log_opt", toMapInterface(in.LogOpt))
if err != nil {
return err
}
}

err := d.Set("node_taints", flattenTaints(in.NodeTaints))
if err != nil {
return err
Expand Down Expand Up @@ -213,6 +220,10 @@ func expandNodeTemplate(in *schema.ResourceData) *NodeTemplate {
obj.EngineStorageDriver = v
}

if v, ok := in.Get("log_opt").(map[string]interface{}); ok && len(v) > 0 {
obj.LogOpt = toMapString(v)
}

if v, ok := in.Get("node_taints").([]interface{}); ok && len(v) > 0 {
obj.NodeTaints = expandTaints(v)
}
Expand Down