Merge pull request #127134 from jpbetz/mutating-admission

KEP-3962: MutatingAdmissionPolicy Alpha

Kubernetes-commit: 2d6c8a129df97caf5bda3a186a8f7f3e41591352
This commit is contained in:
Kubernetes Publisher 2024-11-05 17:31:38 +00:00
commit 6d45801000
29 changed files with 1738 additions and 3 deletions

View File

@ -0,0 +1,39 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
// ApplyConfigurationApplyConfiguration represents a declarative configuration of the ApplyConfiguration type for use
// with apply.
type ApplyConfigurationApplyConfiguration struct {
Expression *string `json:"expression,omitempty"`
}
// ApplyConfigurationApplyConfiguration constructs a declarative configuration of the ApplyConfiguration type for use with
// apply.
func ApplyConfiguration() *ApplyConfigurationApplyConfiguration {
return &ApplyConfigurationApplyConfiguration{}
}
// WithExpression sets the Expression 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 Expression field is set to the value of the last call.
func (b *ApplyConfigurationApplyConfiguration) WithExpression(value string) *ApplyConfigurationApplyConfiguration {
b.Expression = &value
return b
}

View File

@ -0,0 +1,39 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
// JSONPatchApplyConfiguration represents a declarative configuration of the JSONPatch type for use
// with apply.
type JSONPatchApplyConfiguration struct {
Expression *string `json:"expression,omitempty"`
}
// JSONPatchApplyConfiguration constructs a declarative configuration of the JSONPatch type for use with
// apply.
func JSONPatch() *JSONPatchApplyConfiguration {
return &JSONPatchApplyConfiguration{}
}
// WithExpression sets the Expression 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 Expression field is set to the value of the last call.
func (b *JSONPatchApplyConfiguration) WithExpression(value string) *JSONPatchApplyConfiguration {
b.Expression = &value
return b
}

View File

@ -0,0 +1,253 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
import (
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
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"
)
// MutatingAdmissionPolicyApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicy type for use
// with apply.
type MutatingAdmissionPolicyApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
Spec *MutatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"`
}
// MutatingAdmissionPolicy constructs a declarative configuration of the MutatingAdmissionPolicy type for use with
// apply.
func MutatingAdmissionPolicy(name string) *MutatingAdmissionPolicyApplyConfiguration {
b := &MutatingAdmissionPolicyApplyConfiguration{}
b.WithName(name)
b.WithKind("MutatingAdmissionPolicy")
b.WithAPIVersion("admissionregistration.k8s.io/v1alpha1")
return b
}
// ExtractMutatingAdmissionPolicy extracts the applied configuration owned by fieldManager from
// mutatingAdmissionPolicy. If no managedFields are found in mutatingAdmissionPolicy for fieldManager, a
// MutatingAdmissionPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It 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.
// mutatingAdmissionPolicy must be a unmodified MutatingAdmissionPolicy API object that was retrieved from the Kubernetes API.
// ExtractMutatingAdmissionPolicy 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 ExtractMutatingAdmissionPolicy(mutatingAdmissionPolicy *admissionregistrationv1alpha1.MutatingAdmissionPolicy, fieldManager string) (*MutatingAdmissionPolicyApplyConfiguration, error) {
return extractMutatingAdmissionPolicy(mutatingAdmissionPolicy, fieldManager, "")
}
// ExtractMutatingAdmissionPolicyStatus is the same as ExtractMutatingAdmissionPolicy except
// that it extracts the status subresource applied configuration.
// Experimental!
func ExtractMutatingAdmissionPolicyStatus(mutatingAdmissionPolicy *admissionregistrationv1alpha1.MutatingAdmissionPolicy, fieldManager string) (*MutatingAdmissionPolicyApplyConfiguration, error) {
return extractMutatingAdmissionPolicy(mutatingAdmissionPolicy, fieldManager, "status")
}
func extractMutatingAdmissionPolicy(mutatingAdmissionPolicy *admissionregistrationv1alpha1.MutatingAdmissionPolicy, fieldManager string, subresource string) (*MutatingAdmissionPolicyApplyConfiguration, error) {
b := &MutatingAdmissionPolicyApplyConfiguration{}
err := managedfields.ExtractInto(mutatingAdmissionPolicy, internal.Parser().Type("io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicy"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(mutatingAdmissionPolicy.Name)
b.WithKind("MutatingAdmissionPolicy")
b.WithAPIVersion("admissionregistration.k8s.io/v1alpha1")
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.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithKind(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithAPIVersion(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
// WithName sets the Name 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 Name field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithName(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
}
// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithGenerateName(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
}
// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithNamespace(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
}
// WithUID sets the UID 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 UID field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithUID(value types.UID) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithResourceVersion(value string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation 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 Generation field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithGeneration(value int64) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithLabels(entries map[string]string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithAnnotations(entries map[string]string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithFinalizers(values ...string) *MutatingAdmissionPolicyApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
}
return b
}
func (b *MutatingAdmissionPolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec 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 Spec field is set to the value of the last call.
func (b *MutatingAdmissionPolicyApplyConfiguration) WithSpec(value *MutatingAdmissionPolicySpecApplyConfiguration) *MutatingAdmissionPolicyApplyConfiguration {
b.Spec = value
return b
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *MutatingAdmissionPolicyApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}

View File

@ -0,0 +1,253 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
import (
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
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"
)
// MutatingAdmissionPolicyBindingApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicyBinding type for use
// with apply.
type MutatingAdmissionPolicyBindingApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
Spec *MutatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"`
}
// MutatingAdmissionPolicyBinding constructs a declarative configuration of the MutatingAdmissionPolicyBinding type for use with
// apply.
func MutatingAdmissionPolicyBinding(name string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b := &MutatingAdmissionPolicyBindingApplyConfiguration{}
b.WithName(name)
b.WithKind("MutatingAdmissionPolicyBinding")
b.WithAPIVersion("admissionregistration.k8s.io/v1alpha1")
return b
}
// ExtractMutatingAdmissionPolicyBinding extracts the applied configuration owned by fieldManager from
// mutatingAdmissionPolicyBinding. If no managedFields are found in mutatingAdmissionPolicyBinding for fieldManager, a
// MutatingAdmissionPolicyBindingApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It 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.
// mutatingAdmissionPolicyBinding must be a unmodified MutatingAdmissionPolicyBinding API object that was retrieved from the Kubernetes API.
// ExtractMutatingAdmissionPolicyBinding 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 ExtractMutatingAdmissionPolicyBinding(mutatingAdmissionPolicyBinding *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, fieldManager string) (*MutatingAdmissionPolicyBindingApplyConfiguration, error) {
return extractMutatingAdmissionPolicyBinding(mutatingAdmissionPolicyBinding, fieldManager, "")
}
// ExtractMutatingAdmissionPolicyBindingStatus is the same as ExtractMutatingAdmissionPolicyBinding except
// that it extracts the status subresource applied configuration.
// Experimental!
func ExtractMutatingAdmissionPolicyBindingStatus(mutatingAdmissionPolicyBinding *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, fieldManager string) (*MutatingAdmissionPolicyBindingApplyConfiguration, error) {
return extractMutatingAdmissionPolicyBinding(mutatingAdmissionPolicyBinding, fieldManager, "status")
}
func extractMutatingAdmissionPolicyBinding(mutatingAdmissionPolicyBinding *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, fieldManager string, subresource string) (*MutatingAdmissionPolicyBindingApplyConfiguration, error) {
b := &MutatingAdmissionPolicyBindingApplyConfiguration{}
err := managedfields.ExtractInto(mutatingAdmissionPolicyBinding, internal.Parser().Type("io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicyBinding"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(mutatingAdmissionPolicyBinding.Name)
b.WithKind("MutatingAdmissionPolicyBinding")
b.WithAPIVersion("admissionregistration.k8s.io/v1alpha1")
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.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithKind(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithAPIVersion(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
// WithName sets the Name 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 Name field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithName(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
}
// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithGenerateName(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
}
// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithNamespace(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
}
// WithUID sets the UID 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 UID field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithUID(value types.UID) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithResourceVersion(value string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation 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 Generation field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithGeneration(value int64) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithLabels(entries map[string]string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithAnnotations(entries map[string]string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithFinalizers(values ...string) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
}
return b
}
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec 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 Spec field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithSpec(value *MutatingAdmissionPolicyBindingSpecApplyConfiguration) *MutatingAdmissionPolicyBindingApplyConfiguration {
b.Spec = value
return b
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}

View File

@ -0,0 +1,57 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
// MutatingAdmissionPolicyBindingSpecApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicyBindingSpec type for use
// with apply.
type MutatingAdmissionPolicyBindingSpecApplyConfiguration struct {
PolicyName *string `json:"policyName,omitempty"`
ParamRef *ParamRefApplyConfiguration `json:"paramRef,omitempty"`
MatchResources *MatchResourcesApplyConfiguration `json:"matchResources,omitempty"`
}
// MutatingAdmissionPolicyBindingSpecApplyConfiguration constructs a declarative configuration of the MutatingAdmissionPolicyBindingSpec type for use with
// apply.
func MutatingAdmissionPolicyBindingSpec() *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
return &MutatingAdmissionPolicyBindingSpecApplyConfiguration{}
}
// WithPolicyName sets the PolicyName 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 PolicyName field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithPolicyName(value string) *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
b.PolicyName = &value
return b
}
// WithParamRef sets the ParamRef 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 ParamRef field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithParamRef(value *ParamRefApplyConfiguration) *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
b.ParamRef = value
return b
}
// WithMatchResources sets the MatchResources 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 MatchResources field is set to the value of the last call.
func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithMatchResources(value *MatchResourcesApplyConfiguration) *MutatingAdmissionPolicyBindingSpecApplyConfiguration {
b.MatchResources = value
return b
}

View File

@ -0,0 +1,113 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
import (
v1 "k8s.io/api/admissionregistration/v1"
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
)
// MutatingAdmissionPolicySpecApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicySpec type for use
// with apply.
type MutatingAdmissionPolicySpecApplyConfiguration struct {
ParamKind *ParamKindApplyConfiguration `json:"paramKind,omitempty"`
MatchConstraints *MatchResourcesApplyConfiguration `json:"matchConstraints,omitempty"`
Variables []VariableApplyConfiguration `json:"variables,omitempty"`
Mutations []MutationApplyConfiguration `json:"mutations,omitempty"`
FailurePolicy *admissionregistrationv1alpha1.FailurePolicyType `json:"failurePolicy,omitempty"`
MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"`
ReinvocationPolicy *v1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"`
}
// MutatingAdmissionPolicySpecApplyConfiguration constructs a declarative configuration of the MutatingAdmissionPolicySpec type for use with
// apply.
func MutatingAdmissionPolicySpec() *MutatingAdmissionPolicySpecApplyConfiguration {
return &MutatingAdmissionPolicySpecApplyConfiguration{}
}
// WithParamKind sets the ParamKind 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 ParamKind field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithParamKind(value *ParamKindApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
b.ParamKind = value
return b
}
// WithMatchConstraints sets the MatchConstraints 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 MatchConstraints field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMatchConstraints(value *MatchResourcesApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
b.MatchConstraints = value
return b
}
// WithVariables adds the given value to the Variables field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Variables field.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithVariables(values ...*VariableApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithVariables")
}
b.Variables = append(b.Variables, *values[i])
}
return b
}
// WithMutations adds the given value to the Mutations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Mutations field.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMutations(values ...*MutationApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithMutations")
}
b.Mutations = append(b.Mutations, *values[i])
}
return b
}
// WithFailurePolicy sets the FailurePolicy 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 FailurePolicy field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithFailurePolicy(value admissionregistrationv1alpha1.FailurePolicyType) *MutatingAdmissionPolicySpecApplyConfiguration {
b.FailurePolicy = &value
return b
}
// WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the MatchConditions field.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithMatchConditions")
}
b.MatchConditions = append(b.MatchConditions, *values[i])
}
return b
}
// WithReinvocationPolicy sets the ReinvocationPolicy 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 ReinvocationPolicy field is set to the value of the last call.
func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithReinvocationPolicy(value v1.ReinvocationPolicyType) *MutatingAdmissionPolicySpecApplyConfiguration {
b.ReinvocationPolicy = &value
return b
}

View File

@ -0,0 +1,61 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
import (
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
)
// MutationApplyConfiguration represents a declarative configuration of the Mutation type for use
// with apply.
type MutationApplyConfiguration struct {
PatchType *admissionregistrationv1alpha1.PatchType `json:"patchType,omitempty"`
ApplyConfiguration *ApplyConfigurationApplyConfiguration `json:"applyConfiguration,omitempty"`
JSONPatch *JSONPatchApplyConfiguration `json:"jsonPatch,omitempty"`
}
// MutationApplyConfiguration constructs a declarative configuration of the Mutation type for use with
// apply.
func Mutation() *MutationApplyConfiguration {
return &MutationApplyConfiguration{}
}
// WithPatchType sets the PatchType 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 PatchType field is set to the value of the last call.
func (b *MutationApplyConfiguration) WithPatchType(value admissionregistrationv1alpha1.PatchType) *MutationApplyConfiguration {
b.PatchType = &value
return b
}
// WithApplyConfiguration sets the ApplyConfiguration 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 ApplyConfiguration field is set to the value of the last call.
func (b *MutationApplyConfiguration) WithApplyConfiguration(value *ApplyConfigurationApplyConfiguration) *MutationApplyConfiguration {
b.ApplyConfiguration = value
return b
}
// WithJSONPatch sets the JSONPatch 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 JSONPatch field is set to the value of the last call.
func (b *MutationApplyConfiguration) WithJSONPatch(value *JSONPatchApplyConfiguration) *MutationApplyConfiguration {
b.JSONPatch = value
return b
}

View File

@ -512,6 +512,12 @@ var schemaYAML = typed.YAMLObject(`types:
- name: url
type:
scalar: string
- name: io.k8s.api.admissionregistration.v1alpha1.ApplyConfiguration
map:
fields:
- name: expression
type:
scalar: string
- name: io.k8s.api.admissionregistration.v1alpha1.AuditAnnotation
map:
fields:
@ -534,6 +540,12 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: io.k8s.api.admissionregistration.v1alpha1.JSONPatch
map:
fields:
- name: expression
type:
scalar: string
- name: io.k8s.api.admissionregistration.v1alpha1.MatchCondition
map:
fields:
@ -570,6 +582,100 @@ var schemaYAML = typed.YAMLObject(`types:
namedType: io.k8s.api.admissionregistration.v1alpha1.NamedRuleWithOperations
elementRelationship: atomic
elementRelationship: atomic
- name: io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicy
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicySpec
default: {}
- name: io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicyBinding
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicyBindingSpec
default: {}
- name: io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicyBindingSpec
map:
fields:
- name: matchResources
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.MatchResources
- name: paramRef
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.ParamRef
- name: policyName
type:
scalar: string
- name: io.k8s.api.admissionregistration.v1alpha1.MutatingAdmissionPolicySpec
map:
fields:
- name: failurePolicy
type:
scalar: string
- name: matchConditions
type:
list:
elementType:
namedType: io.k8s.api.admissionregistration.v1alpha1.MatchCondition
elementRelationship: associative
keys:
- name
- name: matchConstraints
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.MatchResources
- name: mutations
type:
list:
elementType:
namedType: io.k8s.api.admissionregistration.v1alpha1.Mutation
elementRelationship: atomic
- name: paramKind
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.ParamKind
- name: reinvocationPolicy
type:
scalar: string
- name: variables
type:
list:
elementType:
namedType: io.k8s.api.admissionregistration.v1alpha1.Variable
elementRelationship: atomic
- name: io.k8s.api.admissionregistration.v1alpha1.Mutation
map:
fields:
- name: applyConfiguration
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.ApplyConfiguration
- name: jsonPatch
type:
namedType: io.k8s.api.admissionregistration.v1alpha1.JSONPatch
- name: patchType
type:
scalar: string
default: ""
- name: io.k8s.api.admissionregistration.v1alpha1.NamedRuleWithOperations
map:
fields:

View File

@ -178,14 +178,28 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &admissionregistrationv1.WebhookClientConfigApplyConfiguration{}
// Group=admissionregistration.k8s.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithKind("ApplyConfiguration"):
return &admissionregistrationv1alpha1.ApplyConfigurationApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("AuditAnnotation"):
return &admissionregistrationv1alpha1.AuditAnnotationApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("ExpressionWarning"):
return &admissionregistrationv1alpha1.ExpressionWarningApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("JSONPatch"):
return &admissionregistrationv1alpha1.JSONPatchApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("MatchCondition"):
return &admissionregistrationv1alpha1.MatchConditionApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("MatchResources"):
return &admissionregistrationv1alpha1.MatchResourcesApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"):
return &admissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"):
return &admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBindingSpec"):
return &admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingSpecApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicySpec"):
return &admissionregistrationv1alpha1.MutatingAdmissionPolicySpecApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("Mutation"):
return &admissionregistrationv1alpha1.MutationApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("NamedRuleWithOperations"):
return &admissionregistrationv1alpha1.NamedRuleWithOperationsApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("ParamKind"):

2
go.mod
View File

@ -26,7 +26,7 @@ require (
golang.org/x/time v0.7.0
google.golang.org/protobuf v1.35.1
gopkg.in/evanphx/json-patch.v4 v4.12.0
k8s.io/api v0.0.0-20241105070142-433e4b64e6cd
k8s.io/api v0.0.0-20241105190151-6b396ee7a66d
k8s.io/apimachinery v0.0.0-20241104225908-9500acc2d964
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2

4
go.sum
View File

@ -152,8 +152,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20241105070142-433e4b64e6cd h1:bv8oW58STfMydUY5pCrXH0DPrEURaT30WA3kBDuZhgA=
k8s.io/api v0.0.0-20241105070142-433e4b64e6cd/go.mod h1:mp+gO7jvg9YbSvPU5PHKqKtHXwF5DBApTCw7TFflWqU=
k8s.io/api v0.0.0-20241105190151-6b396ee7a66d h1:DcmOsMYw00ItwqkOSFpvpYntQkXjPI+4U45td0EfvxE=
k8s.io/api v0.0.0-20241105190151-6b396ee7a66d/go.mod h1:mp+gO7jvg9YbSvPU5PHKqKtHXwF5DBApTCw7TFflWqU=
k8s.io/apimachinery v0.0.0-20241104225908-9500acc2d964 h1:kNmV/yxcgj6VWL2DDn4jANbDt7vjHTd342ZmSQG3xi4=
k8s.io/apimachinery v0.0.0-20241104225908-9500acc2d964/go.mod h1:RBz1atosgwQyw4A8TzwjTQDnBVo/eak+3xLfOQr/By8=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=

View File

@ -24,6 +24,10 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer.
MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer
// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer.
MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer
// ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer.
ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer
// ValidatingAdmissionPolicyBindings returns a ValidatingAdmissionPolicyBindingInformer.
@ -41,6 +45,16 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer.
func (v *version) MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer {
return &mutatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer.
func (v *version) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer {
return &mutatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer.
func (v *version) ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInformer {
return &validatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}

View File

@ -0,0 +1,89 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
context "context"
time "time"
apiadmissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
admissionregistrationv1alpha1 "k8s.io/client-go/listers/admissionregistration/v1alpha1"
cache "k8s.io/client-go/tools/cache"
)
// MutatingAdmissionPolicyInformer provides access to a shared informer and lister for
// MutatingAdmissionPolicies.
type MutatingAdmissionPolicyInformer interface {
Informer() cache.SharedIndexInformer
Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyLister
}
type mutatingAdmissionPolicyInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredMutatingAdmissionPolicyInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().Watch(context.TODO(), options)
},
},
&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy{},
resyncPeriod,
indexers,
)
}
func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredMutatingAdmissionPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy{}, f.defaultInformer)
}
func (f *mutatingAdmissionPolicyInformer) Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyLister {
return admissionregistrationv1alpha1.NewMutatingAdmissionPolicyLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,89 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
context "context"
time "time"
apiadmissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
admissionregistrationv1alpha1 "k8s.io/client-go/listers/admissionregistration/v1alpha1"
cache "k8s.io/client-go/tools/cache"
)
// MutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for
// MutatingAdmissionPolicyBindings.
type MutatingAdmissionPolicyBindingInformer interface {
Informer() cache.SharedIndexInformer
Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingLister
}
type mutatingAdmissionPolicyBindingInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredMutatingAdmissionPolicyBindingInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().Watch(context.TODO(), options)
},
},
&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding{},
resyncPeriod,
indexers,
)
}
func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredMutatingAdmissionPolicyBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding{}, f.defaultInformer)
}
func (f *mutatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingLister {
return admissionregistrationv1alpha1.NewMutatingAdmissionPolicyBindingLister(f.Informer().GetIndexer())
}

View File

@ -110,6 +110,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingWebhookConfigurations().Informer()}, nil
// Group=admissionregistration.k8s.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().MutatingAdmissionPolicies().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().MutatingAdmissionPolicyBindings().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().ValidatingAdmissionPolicies().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("validatingadmissionpolicybindings"):

View File

@ -28,6 +28,8 @@ import (
type AdmissionregistrationV1alpha1Interface interface {
RESTClient() rest.Interface
MutatingAdmissionPoliciesGetter
MutatingAdmissionPolicyBindingsGetter
ValidatingAdmissionPoliciesGetter
ValidatingAdmissionPolicyBindingsGetter
}
@ -37,6 +39,14 @@ type AdmissionregistrationV1alpha1Client struct {
restClient rest.Interface
}
func (c *AdmissionregistrationV1alpha1Client) MutatingAdmissionPolicies() MutatingAdmissionPolicyInterface {
return newMutatingAdmissionPolicies(c)
}
func (c *AdmissionregistrationV1alpha1Client) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInterface {
return newMutatingAdmissionPolicyBindings(c)
}
func (c *AdmissionregistrationV1alpha1Client) ValidatingAdmissionPolicies() ValidatingAdmissionPolicyInterface {
return newValidatingAdmissionPolicies(c)
}

View File

@ -28,6 +28,14 @@ type FakeAdmissionregistrationV1alpha1 struct {
*testing.Fake
}
func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicies() v1alpha1.MutatingAdmissionPolicyInterface {
return &FakeMutatingAdmissionPolicies{c}
}
func (c *FakeAdmissionregistrationV1alpha1) MutatingAdmissionPolicyBindings() v1alpha1.MutatingAdmissionPolicyBindingInterface {
return &FakeMutatingAdmissionPolicyBindings{c}
}
func (c *FakeAdmissionregistrationV1alpha1) ValidatingAdmissionPolicies() v1alpha1.ValidatingAdmissionPolicyInterface {
return &FakeValidatingAdmissionPolicies{c}
}

View File

@ -0,0 +1,151 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
testing "k8s.io/client-go/testing"
)
// FakeMutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface
type FakeMutatingAdmissionPolicies struct {
Fake *FakeAdmissionregistrationV1alpha1
}
var mutatingadmissionpoliciesResource = v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies")
var mutatingadmissionpoliciesKind = v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy")
// Get takes name of the mutatingAdmissionPolicy, and returns the corresponding mutatingAdmissionPolicy object, and an error if there is any.
func (c *FakeMutatingAdmissionPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootGetActionWithOptions(mutatingadmissionpoliciesResource, name, options), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// List takes label and field selectors, and returns the list of MutatingAdmissionPolicies that match those selectors.
func (c *FakeMutatingAdmissionPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MutatingAdmissionPolicyList, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(mutatingadmissionpoliciesResource, mutatingadmissionpoliciesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.MutatingAdmissionPolicyList{ListMeta: obj.(*v1alpha1.MutatingAdmissionPolicyList).ListMeta}
for _, item := range obj.(*v1alpha1.MutatingAdmissionPolicyList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested mutatingAdmissionPolicies.
func (c *FakeMutatingAdmissionPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(mutatingadmissionpoliciesResource, opts))
}
// Create takes the representation of a mutatingAdmissionPolicy and creates it. Returns the server's representation of the mutatingAdmissionPolicy, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicies) Create(ctx context.Context, mutatingAdmissionPolicy *v1alpha1.MutatingAdmissionPolicy, opts v1.CreateOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(mutatingadmissionpoliciesResource, mutatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// Update takes the representation of a mutatingAdmissionPolicy and updates it. Returns the server's representation of the mutatingAdmissionPolicy, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicies) Update(ctx context.Context, mutatingAdmissionPolicy *v1alpha1.MutatingAdmissionPolicy, opts v1.UpdateOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(mutatingadmissionpoliciesResource, mutatingAdmissionPolicy, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// Delete takes name of the mutatingAdmissionPolicy and deletes it. Returns an error if one occurs.
func (c *FakeMutatingAdmissionPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(mutatingadmissionpoliciesResource, name, opts), &v1alpha1.MutatingAdmissionPolicy{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMutatingAdmissionPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(mutatingadmissionpoliciesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.MutatingAdmissionPolicyList{})
return err
}
// Patch applies the patch and returns the patched mutatingAdmissionPolicy.
func (c *FakeMutatingAdmissionPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpoliciesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingAdmissionPolicy.
func (c *FakeMutatingAdmissionPolicies) Apply(ctx context.Context, mutatingAdmissionPolicy *admissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MutatingAdmissionPolicy, err error) {
if mutatingAdmissionPolicy == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicy provided to Apply must not be nil")
}
data, err := json.Marshal(mutatingAdmissionPolicy)
if err != nil {
return nil, err
}
name := mutatingAdmissionPolicy.Name
if name == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicy.Name must be provided to Apply")
}
emptyResult := &v1alpha1.MutatingAdmissionPolicy{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpoliciesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicy), err
}

View File

@ -0,0 +1,151 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
context "context"
json "encoding/json"
fmt "fmt"
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
admissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
testing "k8s.io/client-go/testing"
)
// FakeMutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface
type FakeMutatingAdmissionPolicyBindings struct {
Fake *FakeAdmissionregistrationV1alpha1
}
var mutatingadmissionpolicybindingsResource = v1alpha1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings")
var mutatingadmissionpolicybindingsKind = v1alpha1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding")
// Get takes name of the mutatingAdmissionPolicyBinding, and returns the corresponding mutatingAdmissionPolicyBinding object, and an error if there is any.
func (c *FakeMutatingAdmissionPolicyBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootGetActionWithOptions(mutatingadmissionpolicybindingsResource, name, options), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// List takes label and field selectors, and returns the list of MutatingAdmissionPolicyBindings that match those selectors.
func (c *FakeMutatingAdmissionPolicyBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MutatingAdmissionPolicyBindingList, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBindingList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(mutatingadmissionpolicybindingsResource, mutatingadmissionpolicybindingsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.MutatingAdmissionPolicyBindingList{ListMeta: obj.(*v1alpha1.MutatingAdmissionPolicyBindingList).ListMeta}
for _, item := range obj.(*v1alpha1.MutatingAdmissionPolicyBindingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested mutatingAdmissionPolicyBindings.
func (c *FakeMutatingAdmissionPolicyBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(mutatingadmissionpolicybindingsResource, opts))
}
// Create takes the representation of a mutatingAdmissionPolicyBinding and creates it. Returns the server's representation of the mutatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicyBindings) Create(ctx context.Context, mutatingAdmissionPolicyBinding *v1alpha1.MutatingAdmissionPolicyBinding, opts v1.CreateOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(mutatingadmissionpolicybindingsResource, mutatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// Update takes the representation of a mutatingAdmissionPolicyBinding and updates it. Returns the server's representation of the mutatingAdmissionPolicyBinding, and an error, if there is any.
func (c *FakeMutatingAdmissionPolicyBindings) Update(ctx context.Context, mutatingAdmissionPolicyBinding *v1alpha1.MutatingAdmissionPolicyBinding, opts v1.UpdateOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(mutatingadmissionpolicybindingsResource, mutatingAdmissionPolicyBinding, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// Delete takes name of the mutatingAdmissionPolicyBinding and deletes it. Returns an error if one occurs.
func (c *FakeMutatingAdmissionPolicyBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(mutatingadmissionpolicybindingsResource, name, opts), &v1alpha1.MutatingAdmissionPolicyBinding{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMutatingAdmissionPolicyBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(mutatingadmissionpolicybindingsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.MutatingAdmissionPolicyBindingList{})
return err
}
// Patch applies the patch and returns the patched mutatingAdmissionPolicyBinding.
func (c *FakeMutatingAdmissionPolicyBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpolicybindingsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingAdmissionPolicyBinding.
func (c *FakeMutatingAdmissionPolicyBindings) Apply(ctx context.Context, mutatingAdmissionPolicyBinding *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MutatingAdmissionPolicyBinding, err error) {
if mutatingAdmissionPolicyBinding == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicyBinding provided to Apply must not be nil")
}
data, err := json.Marshal(mutatingAdmissionPolicyBinding)
if err != nil {
return nil, err
}
name := mutatingAdmissionPolicyBinding.Name
if name == nil {
return nil, fmt.Errorf("mutatingAdmissionPolicyBinding.Name must be provided to Apply")
}
emptyResult := &v1alpha1.MutatingAdmissionPolicyBinding{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(mutatingadmissionpolicybindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1alpha1.MutatingAdmissionPolicyBinding), err
}

View File

@ -18,6 +18,10 @@ limitations under the License.
package v1alpha1
type MutatingAdmissionPolicyExpansion interface{}
type MutatingAdmissionPolicyBindingExpansion interface{}
type ValidatingAdmissionPolicyExpansion interface{}
type ValidatingAdmissionPolicyBindingExpansion interface{}

View File

@ -0,0 +1,75 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
context "context"
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
applyconfigurationsadmissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme"
)
// MutatingAdmissionPoliciesGetter has a method to return a MutatingAdmissionPolicyInterface.
// A group's client should implement this interface.
type MutatingAdmissionPoliciesGetter interface {
MutatingAdmissionPolicies() MutatingAdmissionPolicyInterface
}
// MutatingAdmissionPolicyInterface has methods to work with MutatingAdmissionPolicy resources.
type MutatingAdmissionPolicyInterface interface {
Create(ctx context.Context, mutatingAdmissionPolicy *admissionregistrationv1alpha1.MutatingAdmissionPolicy, opts v1.CreateOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicy, error)
Update(ctx context.Context, mutatingAdmissionPolicy *admissionregistrationv1alpha1.MutatingAdmissionPolicy, opts v1.UpdateOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicy, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicy, error)
List(ctx context.Context, opts v1.ListOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicyList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *admissionregistrationv1alpha1.MutatingAdmissionPolicy, err error)
Apply(ctx context.Context, mutatingAdmissionPolicy *applyconfigurationsadmissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration, opts v1.ApplyOptions) (result *admissionregistrationv1alpha1.MutatingAdmissionPolicy, err error)
MutatingAdmissionPolicyExpansion
}
// mutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface
type mutatingAdmissionPolicies struct {
*gentype.ClientWithListAndApply[*admissionregistrationv1alpha1.MutatingAdmissionPolicy, *admissionregistrationv1alpha1.MutatingAdmissionPolicyList, *applyconfigurationsadmissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration]
}
// newMutatingAdmissionPolicies returns a MutatingAdmissionPolicies
func newMutatingAdmissionPolicies(c *AdmissionregistrationV1alpha1Client) *mutatingAdmissionPolicies {
return &mutatingAdmissionPolicies{
gentype.NewClientWithListAndApply[*admissionregistrationv1alpha1.MutatingAdmissionPolicy, *admissionregistrationv1alpha1.MutatingAdmissionPolicyList, *applyconfigurationsadmissionregistrationv1alpha1.MutatingAdmissionPolicyApplyConfiguration](
"mutatingadmissionpolicies",
c.RESTClient(),
scheme.ParameterCodec,
"",
func() *admissionregistrationv1alpha1.MutatingAdmissionPolicy {
return &admissionregistrationv1alpha1.MutatingAdmissionPolicy{}
},
func() *admissionregistrationv1alpha1.MutatingAdmissionPolicyList {
return &admissionregistrationv1alpha1.MutatingAdmissionPolicyList{}
},
gentype.PrefersProtobuf[*admissionregistrationv1alpha1.MutatingAdmissionPolicy](),
),
}
}

View File

@ -0,0 +1,75 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
context "context"
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
applyconfigurationsadmissionregistrationv1alpha1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1"
gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme"
)
// MutatingAdmissionPolicyBindingsGetter has a method to return a MutatingAdmissionPolicyBindingInterface.
// A group's client should implement this interface.
type MutatingAdmissionPolicyBindingsGetter interface {
MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInterface
}
// MutatingAdmissionPolicyBindingInterface has methods to work with MutatingAdmissionPolicyBinding resources.
type MutatingAdmissionPolicyBindingInterface interface {
Create(ctx context.Context, mutatingAdmissionPolicyBinding *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, opts v1.CreateOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, error)
Update(ctx context.Context, mutatingAdmissionPolicyBinding *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, opts v1.UpdateOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, error)
List(ctx context.Context, opts v1.ListOptions) (*admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, err error)
Apply(ctx context.Context, mutatingAdmissionPolicyBinding *applyconfigurationsadmissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration, opts v1.ApplyOptions) (result *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, err error)
MutatingAdmissionPolicyBindingExpansion
}
// mutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface
type mutatingAdmissionPolicyBindings struct {
*gentype.ClientWithListAndApply[*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingList, *applyconfigurationsadmissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration]
}
// newMutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindings
func newMutatingAdmissionPolicyBindings(c *AdmissionregistrationV1alpha1Client) *mutatingAdmissionPolicyBindings {
return &mutatingAdmissionPolicyBindings{
gentype.NewClientWithListAndApply[*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingList, *applyconfigurationsadmissionregistrationv1alpha1.MutatingAdmissionPolicyBindingApplyConfiguration](
"mutatingadmissionpolicybindings",
c.RESTClient(),
scheme.ParameterCodec,
"",
func() *admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding {
return &admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding{}
},
func() *admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingList {
return &admissionregistrationv1alpha1.MutatingAdmissionPolicyBindingList{}
},
gentype.PrefersProtobuf[*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding](),
),
}
}

View File

@ -18,6 +18,14 @@ limitations under the License.
package v1alpha1
// MutatingAdmissionPolicyListerExpansion allows custom methods to be added to
// MutatingAdmissionPolicyLister.
type MutatingAdmissionPolicyListerExpansion interface{}
// MutatingAdmissionPolicyBindingListerExpansion allows custom methods to be added to
// MutatingAdmissionPolicyBindingLister.
type MutatingAdmissionPolicyBindingListerExpansion interface{}
// ValidatingAdmissionPolicyListerExpansion allows custom methods to be added to
// ValidatingAdmissionPolicyLister.
type ValidatingAdmissionPolicyListerExpansion interface{}

View File

@ -0,0 +1,48 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
labels "k8s.io/apimachinery/pkg/labels"
listers "k8s.io/client-go/listers"
cache "k8s.io/client-go/tools/cache"
)
// MutatingAdmissionPolicyLister helps list MutatingAdmissionPolicies.
// All objects returned here must be treated as read-only.
type MutatingAdmissionPolicyLister interface {
// List lists all MutatingAdmissionPolicies in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*admissionregistrationv1alpha1.MutatingAdmissionPolicy, err error)
// Get retrieves the MutatingAdmissionPolicy from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*admissionregistrationv1alpha1.MutatingAdmissionPolicy, error)
MutatingAdmissionPolicyListerExpansion
}
// mutatingAdmissionPolicyLister implements the MutatingAdmissionPolicyLister interface.
type mutatingAdmissionPolicyLister struct {
listers.ResourceIndexer[*admissionregistrationv1alpha1.MutatingAdmissionPolicy]
}
// NewMutatingAdmissionPolicyLister returns a new MutatingAdmissionPolicyLister.
func NewMutatingAdmissionPolicyLister(indexer cache.Indexer) MutatingAdmissionPolicyLister {
return &mutatingAdmissionPolicyLister{listers.New[*admissionregistrationv1alpha1.MutatingAdmissionPolicy](indexer, admissionregistrationv1alpha1.Resource("mutatingadmissionpolicy"))}
}

View File

@ -0,0 +1,48 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
labels "k8s.io/apimachinery/pkg/labels"
listers "k8s.io/client-go/listers"
cache "k8s.io/client-go/tools/cache"
)
// MutatingAdmissionPolicyBindingLister helps list MutatingAdmissionPolicyBindings.
// All objects returned here must be treated as read-only.
type MutatingAdmissionPolicyBindingLister interface {
// List lists all MutatingAdmissionPolicyBindings in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, err error)
// Get retrieves the MutatingAdmissionPolicyBinding from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding, error)
MutatingAdmissionPolicyBindingListerExpansion
}
// mutatingAdmissionPolicyBindingLister implements the MutatingAdmissionPolicyBindingLister interface.
type mutatingAdmissionPolicyBindingLister struct {
listers.ResourceIndexer[*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding]
}
// NewMutatingAdmissionPolicyBindingLister returns a new MutatingAdmissionPolicyBindingLister.
func NewMutatingAdmissionPolicyBindingLister(indexer cache.Indexer) MutatingAdmissionPolicyBindingLister {
return &mutatingAdmissionPolicyBindingLister{listers.New[*admissionregistrationv1alpha1.MutatingAdmissionPolicyBinding](indexer, admissionregistrationv1alpha1.Resource("mutatingadmissionpolicybinding"))}
}

View File

@ -56,3 +56,7 @@ func (g *groupversion) Schema(contentType string) ([]byte, error) {
return cachedInfo.data, cachedInfo.err
}
func (c *groupversion) ServerRelativeURL() string {
return c.delegate.ServerRelativeURL()
}

View File

@ -27,6 +27,12 @@ const ContentTypeOpenAPIV3PB = "application/com.github.proto-openapi.spec.v3@v1.
type GroupVersion interface {
Schema(contentType string) ([]byte, error)
// ServerRelativeURL. Returns the path and parameters used to fetch the schema.
// You should use the Schema method to fetch it, but this value can be used
// to key the current version of the schema in a cache since it contains a
// hash string which changes upon schema update.
ServerRelativeURL() string
}
type groupversion struct {
@ -68,3 +74,9 @@ func (g *groupversion) Schema(contentType string) ([]byte, error) {
return path.Do(context.TODO()).Raw()
}
// URL used for fetching the schema. The URL includes a hash and can be used
// to key the current version of the schema in a cache.
func (g *groupversion) ServerRelativeURL() string {
return g.item.ServerRelativeURL
}

View File

@ -77,3 +77,8 @@ func (f FakeGroupVersion) Schema(contentType string) ([]byte, error) {
}
return f.GVSpec, nil
}
// ServerRelativeURL returns an empty string.
func (f FakeGroupVersion) ServerRelativeURL() string {
panic("unimplemented")
}

View File

@ -94,3 +94,8 @@ func (f *fileGroupVersion) Schema(contentType string) ([]byte, error) {
}
return fs.ReadFile(f.f, f.filename)
}
// ServerRelativeURL returns an empty string.
func (f *fileGroupVersion) ServerRelativeURL() string {
return f.filename
}