From 0cb2597950e967b7b499f271d998486d072d43d2 Mon Sep 17 00:00:00 2001 From: Ben Swartzlander Date: Wed, 26 May 2021 15:10:26 -0400 Subject: [PATCH] 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 --- applyconfigurations/core/v1/persistentvolumeclaimspec.go | 9 +++++++++ applyconfigurations/internal/internal.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/applyconfigurations/core/v1/persistentvolumeclaimspec.go b/applyconfigurations/core/v1/persistentvolumeclaimspec.go index ac4d64c7..e22d04b0 100644 --- a/applyconfigurations/core/v1/persistentvolumeclaimspec.go +++ b/applyconfigurations/core/v1/persistentvolumeclaimspec.go @@ -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 +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 10914dd8..d665b3de 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -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