Add DataSourceRef field to PVC spec

Modify the behavior of the AnyVolumeDataSource alpha feature gate to enable
a new field, DataSourceRef, rather than modifying the behavior of the
existing DataSource field. This allows addition Volume Populators in a way
that doesn't risk breaking backwards compatibility, although it will
result in eventually deprecating the DataSource field.

Kubernetes-commit: 00dba76918e8ce5b5cff6719bbd64c2cd38ad4e2
This commit is contained in:
Ben Swartzlander 2021-05-26 15:10:26 -04:00 committed by Kubernetes Publisher
parent 4339f1ba5f
commit 0cb2597950
2 changed files with 12 additions and 0 deletions

View File

@ -33,6 +33,7 @@ type PersistentVolumeClaimSpecApplyConfiguration struct {
StorageClassName *string `json:"storageClassName,omitempty"`
VolumeMode *v1.PersistentVolumeMode `json:"volumeMode,omitempty"`
DataSource *TypedLocalObjectReferenceApplyConfiguration `json:"dataSource,omitempty"`
DataSourceRef *TypedLocalObjectReferenceApplyConfiguration `json:"dataSourceRef,omitempty"`
}
// PersistentVolumeClaimSpecApplyConfiguration constructs an declarative configuration of the PersistentVolumeClaimSpec type for use with
@ -98,3 +99,11 @@ func (b *PersistentVolumeClaimSpecApplyConfiguration) WithDataSource(value *Type
b.DataSource = value
return b
}
// WithDataSourceRef sets the DataSourceRef field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DataSourceRef field is set to the value of the last call.
func (b *PersistentVolumeClaimSpecApplyConfiguration) WithDataSourceRef(value *TypedLocalObjectReferenceApplyConfiguration) *PersistentVolumeClaimSpecApplyConfiguration {
b.DataSourceRef = value
return b
}

View File

@ -4916,6 +4916,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: dataSource
type:
namedType: io.k8s.api.core.v1.TypedLocalObjectReference
- name: dataSourceRef
type:
namedType: io.k8s.api.core.v1.TypedLocalObjectReference
- name: resources
type:
namedType: io.k8s.api.core.v1.ResourceRequirements