Generated apply configurations

Kubernetes-commit: e5a98bba6144935279509ec4defbb120d387e3fb
This commit is contained in:
Joe Betz
2021-03-07 14:49:10 -08:00
committed by Kubernetes Publisher
parent 9e347785cf
commit 476d5f996a
98 changed files with 13428 additions and 0 deletions

View File

@@ -23,7 +23,9 @@ import (
v1beta1 "k8s.io/api/storage/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
applyconfigurationscorev1 "k8s.io/client-go/applyconfigurations/core/v1"
internal "k8s.io/client-go/applyconfigurations/internal"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
@@ -51,6 +53,30 @@ func StorageClass(name string) *StorageClassApplyConfiguration {
return b
}
// ExtractStorageClass extracts the applied configuration owned by fieldManager from
// storageClass. If no managedFields are found in storageClass for fieldManager, a
// StorageClassApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. Is is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// storageClass must be a unmodified StorageClass API object that was retrieved from the Kubernetes API.
// ExtractStorageClass provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
// Experimental!
func ExtractStorageClass(storageClass *v1beta1.StorageClass, fieldManager string) (*StorageClassApplyConfiguration, error) {
b := &StorageClassApplyConfiguration{}
err := managedfields.ExtractInto(storageClass, internal.Parser().Type("io.k8s.api.storage.v1beta1.StorageClass"), fieldManager, b)
if err != nil {
return nil, err
}
b.WithName(storageClass.Name)
b.WithKind("StorageClass")
b.WithAPIVersion("storage.k8s.io/v1beta1")
return b, nil
}
// WithKind sets the Kind 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 Kind field is set to the value of the last call.