mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-26 07:10:41 +00:00
Generated apply configurations
Kubernetes-commit: e5a98bba6144935279509ec4defbb120d387e3fb
This commit is contained in:
committed by
Kubernetes Publisher
parent
9e347785cf
commit
476d5f996a
@@ -19,8 +19,11 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
internal "k8s.io/client-go/applyconfigurations/internal"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
@@ -44,6 +47,31 @@ func Ingress(name, namespace string) *IngressApplyConfiguration {
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractIngress extracts the applied configuration owned by fieldManager from
|
||||
// ingress. If no managedFields are found in ingress for fieldManager, a
|
||||
// IngressApplyConfiguration 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.
|
||||
// ingress must be a unmodified Ingress API object that was retrieved from the Kubernetes API.
|
||||
// ExtractIngress 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 ExtractIngress(ingress *extensionsv1beta1.Ingress, fieldManager string) (*IngressApplyConfiguration, error) {
|
||||
b := &IngressApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(ingress, internal.Parser().Type("io.k8s.api.extensions.v1beta1.Ingress"), fieldManager, b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(ingress.Name)
|
||||
b.WithNamespace(ingress.Namespace)
|
||||
|
||||
b.WithKind("Ingress")
|
||||
b.WithAPIVersion("extensions/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.
|
||||
|
Reference in New Issue
Block a user