Skip to content

Latest commit

 

History

History
509 lines (310 loc) · 32.2 KB

File metadata and controls

509 lines (310 loc) · 32.2 KB
subcategory page_title description
core/v1
Kubernetes: kubernetes_persistent_volume_v1
A Persistent Volume (PV) is a piece of networked storage in the cluster that has been provisioned by an administrator.

kubernetes_persistent_volume_v1

A PersistentVolume (PV) is a piece of networked storage in the cluster provisioned by an administrator. It is a resource in the cluster just like a node is a cluster resource. Persistent Volumes have a lifecycle independent of any individual pod that uses the PV. This data source retrieves information about the specified PV.

Schema

Required

Optional

Read-Only

  • id (String) The ID of this resource.

Nested Schema for metadata

Optional:

Read-Only:

Nested Schema for spec

Required:

Optional:

Nested Schema for spec.persistent_volume_source

Optional:

Nested Schema for spec.persistent_volume_source.aws_elastic_block_store

Required:

Optional:

  • fs_type (String) Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
  • partition (Number) The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).
  • read_only (Boolean) Whether to set the read-only property in VolumeMounts to "true". If omitted, the default is "false". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore

Nested Schema for spec.persistent_volume_source.azure_disk

Required:

  • caching_mode (String) Host Caching mode: None, Read Only, Read Write.
  • data_disk_uri (String) The URI the data disk in the blob storage
  • disk_name (String) The Name of the data disk in the blob storage

Optional:

  • fs_type (String) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
  • kind (String) The type for the data disk. Expected values: Shared, Dedicated, Managed. Defaults to Shared
  • read_only (Boolean) Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).

Nested Schema for spec.persistent_volume_source.azure_file

Required:

  • secret_name (String) The name of secret that contains Azure Storage Account Name and Key
  • share_name (String) Share Name

Optional:

  • read_only (Boolean) Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).
  • secret_namespace (String) The namespace of the secret that contains Azure Storage Account Name and Key. For Kubernetes up to 1.18.x the default is the same as the Pod. For Kubernetes 1.19.x and later the default is "default" namespace.

Nested Schema for spec.persistent_volume_source.ceph_fs

Required:

Optional:

Nested Schema for spec.persistent_volume_source.ceph_fs.secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.cinder

Required:

Optional:

Nested Schema for spec.persistent_volume_source.csi

Required:

Optional:

  • controller_expand_secret_ref (Block List, Max: 1) A reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerExpandVolume call. (see below for nested schema)
  • controller_publish_secret_ref (Block List, Max: 1) A reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerPublishVolume and ControllerUnpublishVolume calls. (see below for nested schema)
  • fs_type (String) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
  • node_publish_secret_ref (Block List, Max: 1) A reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. (see below for nested schema)
  • node_stage_secret_ref (Block List, Max: 1) A reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeStageVolume and NodeStageVolume and NodeUnstageVolume calls. (see below for nested schema)
  • read_only (Boolean) Whether to set the read-only property in VolumeMounts to "true". If omitted, the default is "false". More info: https://kubernetes.io/docs/concepts/storage/volumes#csi
  • volume_attributes (Map of String) Attributes of the volume to publish.

Nested Schema for spec.persistent_volume_source.csi.controller_expand_secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.csi.controller_publish_secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.csi.node_publish_secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.csi.node_stage_secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.fc

Required:

  • lun (Number) FC target lun number
  • target_ww_ns (Set of String) FC target worldwide names (WWNs)

Optional:

  • fs_type (String) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
  • read_only (Boolean) Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).

Nested Schema for spec.persistent_volume_source.flex_volume

Required:

  • driver (String) Driver is the name of the driver to use for this volume.

Optional:

  • fs_type (String) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script.
  • options (Map of String) Extra command options if any.
  • read_only (Boolean) Whether to force the ReadOnly setting in VolumeMounts. Defaults to false (read/write).
  • secret_ref (Block List, Max: 1) Reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts. (see below for nested schema)

Nested Schema for spec.persistent_volume_source.flex_volume.secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.flocker

Optional:

  • dataset_name (String) Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated
  • dataset_uuid (String) UUID of the dataset. This is unique identifier of a Flocker dataset

Nested Schema for spec.persistent_volume_source.gce_persistent_disk

Required:

Optional:

Nested Schema for spec.persistent_volume_source.glusterfs

Required:

Optional:

Nested Schema for spec.persistent_volume_source.host_path

Optional:

Nested Schema for spec.persistent_volume_source.iscsi

Required:

  • iqn (String) Target iSCSI Qualified Name.
  • target_portal (String) iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).

Optional:

  • chap_auth_discovery (Boolean) Whether target supports iSCSI Discovery CHAP authentication.
  • chap_auth_session (Boolean) Whether target supports iSCSI Session CHAP authentication.
  • fs_type (String) Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi
  • initiator_name (String) The custom iSCSI Initiator Name. If initiator_name is specified with iscsi_interface simultaneously, new iSCSI interface target portal:volume name will be created for the connection.
  • iscsi_interface (String) iSCSI interface name that uses an iSCSI transport. Defaults to 'default' (tcp).
  • lun (Number) iSCSI target lun number.
  • portals (List of String) The iSCSI Target Portal List. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).
  • read_only (Boolean) Whether to force the read-only setting in VolumeMounts. Defaults to false.
  • secret_ref (Block List, Max: 1) The CHAP Secret for iSCSI target and initiator authentication. Default is nil. More info: https://github.com/kubernetes/examples/tree/master/_archived/volumes/iscsi (see below for nested schema)

Nested Schema for spec.persistent_volume_source.iscsi.secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.local

Optional:

Nested Schema for spec.persistent_volume_source.nfs

Required:

Optional:

Nested Schema for spec.persistent_volume_source.photon_persistent_disk

Required:

  • pd_id (String) ID that identifies Photon Controller persistent disk

Optional:

  • fs_type (String) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.

Nested Schema for spec.persistent_volume_source.quobyte

Required:

  • registry (String) Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes
  • volume (String) Volume is a string that references an already created Quobyte volume by name.

Optional:

  • group (String) Group to map volume access to Default is no group
  • read_only (Boolean) Whether to force the Quobyte volume to be mounted with read-only permissions. Defaults to false.
  • user (String) User to map volume access to Defaults to serivceaccount user

Nested Schema for spec.persistent_volume_source.rbd

Required:

Optional:

Nested Schema for spec.persistent_volume_source.rbd.secret_ref

Optional:

Nested Schema for spec.persistent_volume_source.vsphere_volume

Required:

  • volume_path (String) Path that identifies vSphere volume vmdk

Optional:

  • fs_type (String) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.

Nested Schema for spec.claim_ref

Required:

  • name (String) The name of the PersistentVolumeClaim

Optional:

  • namespace (String) The namespace of the PersistentVolumeClaim. Uses 'default' namespace if none is specified.

Nested Schema for spec.node_affinity

Optional:

Nested Schema for spec.node_affinity.required

Required:

Nested Schema for spec.node_affinity.required.node_selector_term

Optional:

  • match_expressions (Block List) A list of node selector requirements by node's labels. The requirements are ANDed. (see below for nested schema)
  • match_fields (Block List) A list of node selector requirements by node's fields. The requirements are ANDed. (see below for nested schema)

Nested Schema for spec.node_affinity.required.node_selector_term.match_expressions

Required:

  • key (String) The label key that the selector applies to.
  • operator (String) A key's relationship to a set of values. Valid operators ard In, NotIn, Exists, DoesNotExist, Gt, and Lt.

Optional:

  • values (Set of String) An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

Nested Schema for spec.node_affinity.required.node_selector_term.match_fields

Required:

  • key (String) The label key that the selector applies to.
  • operator (String) A key's relationship to a set of values. Valid operators ard In, NotIn, Exists, DoesNotExist, Gt, and Lt.

Optional:

  • values (Set of String) An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

Example Usage

data "kubernetes_persistent_volume_v1" "example" {
  metadata {
    name = "terraform-example"
  }
}
data "kubernetes_secret" "example" {
  metadata {
    name = data.kubernetes_persistent_volume_v1.example.spec[0].persistent_volume_source[0].azure_file[0].secret_name
  }
}
output "azure_storageaccount_name" {
  value = data.kubernetes_secret.example.data.azurestorageaccountname
}
output "azure_storageaccount_key" {
  value = data.kubernetes_secret.example.data.azurestorageaccountkey
}