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 sub_path_expr to volume_mount #925

Open
wants to merge 3 commits into
base: main
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
2,243 changes: 2,243 additions & 0 deletions kubernetes/resource_kubernetes_deployment_test.go

Large diffs are not rendered by default.

2,078 changes: 2,078 additions & 0 deletions kubernetes/resource_kubernetes_pod_test.go

Large diffs are not rendered by default.

1,179 changes: 1,179 additions & 0 deletions kubernetes/resource_kubernetes_replication_controller_test.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions kubernetes/schema_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ func volumeMountFields() map[string]*schema.Schema {
Optional: true,
Description: `Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).`,
},
"sub_path_expr": {
Type: schema.TypeString,
Optional: true,
Description: `Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive.`,
},
"mount_propagation": {
Type: schema.TypeString,
Description: "Mount propagation mode. mount_propagation determines how mounts are propagated from the host to container and the other way around. Valid values are None (default), HostToContainer and Bidirectional.",
Expand Down
9 changes: 9 additions & 0 deletions kubernetes/structures_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,14 @@
if v.SubPath != "" {
m["sub_path"] = v.SubPath
}
<<<<<<< HEAD

Check failure on line 300 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / test

syntax error: unexpected <<, expected }

Check failure on line 300 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.0.11)

syntax error: unexpected <<, expected }

Check failure on line 300 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.1.9)

syntax error: unexpected <<, expected }

Check failure on line 300 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.2.9)

syntax error: unexpected <<, expected }

Check failure on line 300 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.3.9)

syntax error: unexpected <<, expected }
if v.SubPathExpr != "" {
m["sub_path_expr"] = v.SubPathExpr
}
=======

Check failure on line 304 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / test

syntax error: unexpected ==, expected }

Check failure on line 304 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.0.11)

syntax error: unexpected ==, expected }

Check failure on line 304 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.1.9)

syntax error: unexpected ==, expected }

Check failure on line 304 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.2.9)

syntax error: unexpected ==, expected }

Check failure on line 304 in kubernetes/structures_container.go

View workflow job for this annotation

GitHub Actions / check (1.3.9)

syntax error: unexpected ==, expected }

m["mount_propagation"] = string(v1.MountPropagationNone)
>>>>>>> main
if v.MountPropagation != nil {
m["mount_propagation"] = string(*v.MountPropagation)
}
Expand Down Expand Up @@ -803,6 +809,9 @@
if subPath, ok := p["sub_path"]; ok {
vmp[i].SubPath = subPath.(string)
}
if subPathExpr, ok := p["sub_path_expr"]; ok {
vmp[i].SubPathExpr = subPathExpr.(string)
}
if mountPropagation, ok := p["mount_propagation"]; ok {
mp := v1.MountPropagationMode(mountPropagation.(string))
vmp[i].MountPropagation = &mp
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/pod.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ The `items` block supports the following:
* `name` - This must match the Name of a Volume.
* `read_only` - Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.
* `sub_path` - Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).
* `sub_path_expr` - Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive.
* `mount_propagation` - Mount propagation mode. Defaults to "None". For more info see [Kubernetes reference](https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation)

## Argument Reference
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/daemonset.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ The `items` block supports the following:
* `name` - (Required) This must match the Name of a Volume.
* `read_only` - (Optional) Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.
* `sub_path` - (Optional) Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).
* `sub_path_expr` - (Optional) Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive.
* `mount_propagation` - (Optional) Mount propagation mode. Defaults to "None". For more info see [Kubernetes reference](https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation)

### `vsphere_volume`
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/deployment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ The `items` block supports the following:
* `name` - (Required) This must match the Name of a Volume.
* `read_only` - (Optional) Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.
* `sub_path` - (Optional) Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).
* `sub_path_expr` - (Optional) Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive.
* `mount_propagation` - (Optional) Mount propagation mode. Defaults to "None". For more info see [Kubernetes reference](https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation)

### `vsphere_volume`
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/pod.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ The `items` block supports the following:
* `name` - (Required) This must match the Name of a Volume.
* `read_only` - (Optional) Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.
* `sub_path` - (Optional) Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).
* `sub_path_expr` - (Optional) Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive.
* `mount_propagation` - (Optional) Mount propagation mode. Defaults to "None". For more info see [Kubernetes reference](https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation)

### `vsphere_volume`
Expand Down
Loading