normalized omitempty across volumes for all versions

pull/6/head
markturansky 2015-05-25 13:10:14 -04:00
parent f7ede60045
commit e15fd2b0e7
4 changed files with 44 additions and 46 deletions

View File

@ -183,30 +183,30 @@ type VolumeSource struct {
// machine. Most containers will NOT need this.
// TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not
// mount host directories as read/write.
HostPath *HostPathVolumeSource `json:"hostPath"`
HostPath *HostPathVolumeSource `json:"hostPath,omitempty"`
// EmptyDir represents a temporary directory that shares a pod's lifetime.
EmptyDir *EmptyDirVolumeSource `json:"emptyDir"`
EmptyDir *EmptyDirVolumeSource `json:"emptyDir,omitempty"`
// GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk"`
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk,omitempty"`
// AWSElasticBlockStore represents an AWS EBS disk that is attached to a
// kubelet's host machine and then exposed to the pod.
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore"`
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty"`
// GitRepo represents a git repository at a particular revision.
GitRepo *GitRepoVolumeSource `json:"gitRepo"`
GitRepo *GitRepoVolumeSource `json:"gitRepo,omitempty"`
// Secret represents a secret that should populate this volume.
Secret *SecretVolumeSource `json:"secret"`
Secret *SecretVolumeSource `json:"secret,omitempty"`
// NFS represents an NFS mount on the host that shares a pod's lifetime
NFS *NFSVolumeSource `json:"nfs"`
// ISCSIVolumeSource represents an ISCSI Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
ISCSI *ISCSIVolumeSource `json:"iscsi"`
ISCSI *ISCSIVolumeSource `json:"iscsi,omitempty"`
// Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime
Glusterfs *GlusterfsVolumeSource `json:"glusterfs"`
Glusterfs *GlusterfsVolumeSource `json:"glusterfs,omitempty"`
// PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace
PersistentVolumeClaimVolumeSource *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim"`
PersistentVolumeClaimVolumeSource *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"`
// RBD represents a Rados Block Device mount on the host that shares a pod's lifetime
RBD *RBDVolumeSource `json:"rbd"`
RBD *RBDVolumeSource `json:"rbd,omitempty"`
}
// Similar to VolumeSource but meant for the administrator who creates PVs.
@ -235,7 +235,7 @@ type PersistentVolumeSource struct {
type PersistentVolumeClaimVolumeSource struct {
// ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume
ClaimName string `json:"claimName,omitempty" description:"the name of the claim in the same namespace to be mounted as a volume"`
ClaimName string `json:"claimName" description:"the name of the claim in the same namespace to be mounted as a volume"`
// Optional: Defaults to false (read/write). ReadOnly here
// will force the ReadOnly setting in VolumeMounts
ReadOnly bool `json:"readOnly,omitempty"`

View File

@ -228,7 +228,7 @@ type VolumeSource struct {
type PersistentVolumeClaimVolumeSource struct {
// ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume
ClaimName string `json:"claimName,omitempty" description:"the name of the claim in the same namespace to be mounted as a volume"`
ClaimName string `json:"claimName" description:"the name of the claim in the same namespace to be mounted as a volume"`
// Optional: Defaults to false (read/write). ReadOnly here
// will force the ReadOnly setting in VolumeMounts
ReadOnly bool `json:"readOnly,omitempty" description:"mount volume as read-only when true; default false"`

View File

@ -111,30 +111,30 @@ type VolumeSource struct {
// things that are allowed to see the host machine. Most containers will NOT need this.
// TODO(jonesdl) We need to restrict who can use host directory mounts and
// who can/can not mount host directories as read/write.
HostDir *HostPathVolumeSource `json:"hostDir" description:"pre-existing host file or directory; generally for privileged system daemons or other agents tied to the host"`
HostDir *HostPathVolumeSource `json:"hostDir,omitempty" description:"pre-existing host file or directory; generally for privileged system daemons or other agents tied to the host"`
// EmptyDir represents a temporary directory that shares a pod's lifetime.
EmptyDir *EmptyDirVolumeSource `json:"emptyDir" description:"temporary directory that shares a pod's lifetime"`
EmptyDir *EmptyDirVolumeSource `json:"emptyDir,omitempty" description:"temporary directory that shares a pod's lifetime"`
// GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource attached to the host machine on demand"`
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk,omitempty" description:"GCE disk resource attached to the host machine on demand"`
// AWSElasticBlockStore represents an AWS Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource attached to the host machine on demand"`
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty" description:"AWS disk resource attached to the host machine on demand"`
// GitRepo represents a git repository at a particular revision.
GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"`
GitRepo *GitRepoVolumeSource `json:"gitRepo,omitempty" description:"git repository at a particular revision"`
// Secret represents a secret to populate the volume with
Secret *SecretVolumeSource `json:"secret" description:"secret to populate volume with"`
Secret *SecretVolumeSource `json:"secret,omitempty" description:"secret to populate volume with"`
// NFS represents an NFS mount on the host that shares a pod's lifetime
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume that will be mounted in the host machine "`
NFS *NFSVolumeSource `json:"nfs,omitempty" description:"NFS volume that will be mounted in the host machine "`
// ISCSI represents an ISCSI Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
ISCSI *ISCSIVolumeSource `json:"iscsi" description:"iSCSI disk attached to host machine on demand"`
ISCSI *ISCSIVolumeSource `json:"iscsi,omitempty" description:"iSCSI disk attached to host machine on demand"`
// Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume that will be mounted on the host machine "`
Glusterfs *GlusterfsVolumeSource `json:"glusterfs,omitempty" description:"Glusterfs volume that will be mounted on the host machine "`
// PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace
PersistentVolumeClaimVolumeSource *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty" description:"a reference to a PersistentVolumeClaim in the same namespace"`
// RBD represents a Rados Block Device mount on the host that shares a pod's lifetime
RBD *RBDVolumeSource `json:"rbd" description:"rados block volume that will be mounted on the host machine"`
RBD *RBDVolumeSource `json:"rbd,omitempty" description:"rados block volume that will be mounted on the host machine"`
}
// Similar to VolumeSource but meant for the administrator who creates PVs.
@ -142,18 +142,18 @@ type VolumeSource struct {
type PersistentVolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource provisioned by an admin"`
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk,omitempty" description:"GCE disk resource provisioned by an admin"`
// AWSElasticBlockStore represents an AWS EBS volume that is attached to a
// kubelet's host machine and then exposed to the pod.
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource provisioned by an admin"`
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty" description:"AWS disk resource provisioned by an admin"`
// HostPath represents a directory on the host.
// This is useful for development and testing only.
// on-host storage is not supported in any way.
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
HostPath *HostPathVolumeSource `json:"hostPath,omitempty" description:"a HostPath provisioned by a developer or tester; for develment use only"`
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
Glusterfs *GlusterfsVolumeSource `json:"glusterfs,omitempty" description:"Glusterfs volume resource provisioned by an admin"`
// NFS represents an NFS mount on the host
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume resource provisioned by an admin"`
NFS *NFSVolumeSource `json:"nfs,omitempty" description:"NFS volume resource provisioned by an admin"`
// RBD represents a Rados Block Device mount on the host that shares a pod's lifetime
RBD *RBDVolumeSource `json:"rbd" description:"rados block volume that will be mounted on the host machine"`
// ISCSI represents an ISCSI Disk resource that is attached to a
@ -163,7 +163,7 @@ type PersistentVolumeSource struct {
type PersistentVolumeClaimVolumeSource struct {
// ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume
ClaimName string `json:"claimName,omitempty" description:"the name of the claim in the same namespace to be mounted as a volume"`
ClaimName string `json:"claimName" description:"the name of the claim in the same namespace to be mounted as a volume"`
// Optional: Defaults to false (read/write). ReadOnly here
// will force the ReadOnly setting in VolumeMounts
ReadOnly bool `json:"readOnly,omitempty" description:"mount volume as read-only when true; default false"`

View File

@ -60,38 +60,36 @@ type Volume struct {
// VolumeSource represents the source location of a volume to mount.
// Only one of its members may be specified.
//
// http://docs.k8s.io/volumes.md#types-of-volumes
type VolumeSource struct {
// HostDir represents a pre-existing directory on the host machine that is directly
// exposed to the container. This is generally used for system agents or other privileged
// things that are allowed to see the host machine. Most containers will NOT need this.
// TODO(jonesdl) We need to restrict who can use host directory mounts and
// who can/can not mount host directories as read/write.
HostDir *HostPathVolumeSource `json:"hostDir" description:"pre-existing host file or directory; generally for privileged system daemons or other agents tied to the host"`
HostDir *HostPathVolumeSource `json:"hostDir,omitempty" description:"pre-existing host file or directory; generally for privileged system daemons or other agents tied to the host"`
// EmptyDir represents a temporary directory that shares a pod's lifetime.
EmptyDir *EmptyDirVolumeSource `json:"emptyDir" description:"temporary directory that shares a pod's lifetime"`
EmptyDir *EmptyDirVolumeSource `json:"emptyDir,omitempty" description:"temporary directory that shares a pod's lifetime"`
// A persistent disk that is mounted to the
// kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource attached to the host machine on demand"`
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk,omitempty" description:"GCE disk resource attached to the host machine on demand"`
// An AWS persistent disk that is mounted to the
// kubelet's host machine and then exposed to the pod.
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource attached to the host machine on demand"`
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty" description:"AWS disk resource attached to the host machine on demand"`
// GitRepo represents a git repository at a particular revision.
GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"`
GitRepo *GitRepoVolumeSource `json:"gitRepo,omitempty" description:"git repository at a particular revision"`
// Secret is a secret to populate the volume with
Secret *SecretVolumeSource `json:"secret" description:"secret to populate volume"`
Secret *SecretVolumeSource `json:"secret,omitempty" description:"secret to populate volume"`
// NFS represents an NFS mount on the host that shares a pod's lifetime
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume that will be mounted in the host machine"`
NFS *NFSVolumeSource `json:"nfs,omitempty" description:"NFS volume that will be mounted in the host machine"`
// ISCSI represents an ISCSI Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
ISCSI *ISCSIVolumeSource `json:"iscsi" description:"iSCSI disk attached to host machine on demand"`
ISCSI *ISCSIVolumeSource `json:"iscsi,omitempty" description:"iSCSI disk attached to host machine on demand"`
// Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume that will be mounted on the host machine "`
Glusterfs *GlusterfsVolumeSource `json:"glusterfs,omitempty" description:"Glusterfs volume that will be mounted on the host machine "`
// PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace
PersistentVolumeClaimVolumeSource *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty" description:"a reference to a PersistentVolumeClaim in the same namespace"`
// RBD represents a Rados Block Device mount on the host that shares a pod's lifetime
RBD *RBDVolumeSource `json:"rbd" description:"rados block volume that will be mounted on the host machine"`
RBD *RBDVolumeSource `json:"rbd,omitempty" description:"rados block volume that will be mounted on the host machine"`
}
// Similar to VolumeSource but meant for the administrator who creates PVs.
@ -99,18 +97,18 @@ type VolumeSource struct {
type PersistentVolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource provisioned by an admin"`
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk,omitempty" description:"GCE disk resource provisioned by an admin"`
// AWSElasticBlockStore represents an AWS Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod.
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource provisioned by an admin"`
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty" description:"AWS disk resource provisioned by an admin"`
// HostPath represents a directory on the host.
// This is useful for development and testing only.
// on-host storage is not supported in any way.
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
HostPath *HostPathVolumeSource `json:"hostPath,omitempty" description:"a HostPath provisioned by a developer or tester; for develment use only"`
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
Glusterfs *GlusterfsVolumeSource `json:"glusterfs,omitempty" description:"Glusterfs volume resource provisioned by an admin"`
// NFS represents an NFS mount on the host
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume resource provisioned by an admin"`
NFS *NFSVolumeSource `json:"nfs,omitempty" description:"NFS volume resource provisioned by an admin"`
// RBD represents a Rados Block Device mount on the host that shares a pod's lifetime
RBD *RBDVolumeSource `json:"rbd" description:"rados block volume that will be mounted on the host machine"`
// ISCSI represents an ISCSI Disk resource that is attached to a
@ -120,7 +118,7 @@ type PersistentVolumeSource struct {
type PersistentVolumeClaimVolumeSource struct {
// ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume
ClaimName string `json:"claimName,omitempty" description:"the name of the claim in the same namespace to be mounted as a volume"`
ClaimName string `json:"claimName" description:"the name of the claim in the same namespace to be mounted as a volume"`
// Optional: Defaults to false (read/write). ReadOnly here
// will force the ReadOnly setting in VolumeMounts
ReadOnly bool `json:"readOnly,omitempty" description:"mount volume as read-only when true; default false"`