Adopt controller-runtime braking changes: generics support PR2783

Adopt controller-runtime breaking changes: make decoder as interface. PR2736

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
This commit is contained in:
RainbowMango 2024-07-11 11:09:35 +08:00
parent 448b967421
commit e8164eeebd
24 changed files with 105 additions and 91 deletions

View File

@ -34,64 +34,63 @@ import (
remedyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1" remedyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1"
) )
func newClusterEventHandler() handler.EventHandler { func newClusterEventHandler() handler.TypedEventHandler[*clusterv1alpha1.Cluster] {
return &clusterEventHandler{} return &clusterEventHandler{}
} }
var _ handler.EventHandler = (*clusterEventHandler)(nil) var _ handler.TypedEventHandler[*clusterv1alpha1.Cluster] = &clusterEventHandler{}
type clusterEventHandler struct { type clusterEventHandler struct{}
}
func (h *clusterEventHandler) Create(_ context.Context, _ event.CreateEvent, _ workqueue.RateLimitingInterface) { func (h *clusterEventHandler) Create(context.Context, event.TypedCreateEvent[*clusterv1alpha1.Cluster], workqueue.RateLimitingInterface) {
// Don't care about cluster creation events // Don't care about cluster creation events
} }
func (h *clusterEventHandler) Update(_ context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) { func (h *clusterEventHandler) Update(_ context.Context, e event.TypedUpdateEvent[*clusterv1alpha1.Cluster], queue workqueue.RateLimitingInterface) {
oldCluster := e.ObjectOld.(*clusterv1alpha1.Cluster) if reflect.DeepEqual(e.ObjectOld.Status.Conditions, e.ObjectNew.Status.Conditions) {
newCluster := e.ObjectNew.(*clusterv1alpha1.Cluster)
if reflect.DeepEqual(oldCluster.Status.Conditions, newCluster.Status.Conditions) {
return return
} }
queue.Add(reconcile.Request{NamespacedName: types.NamespacedName{ queue.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Name: newCluster.Name, Name: e.ObjectNew.Name,
}}) }})
} }
func (h *clusterEventHandler) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) { func (h *clusterEventHandler) Delete(_ context.Context, _ event.TypedDeleteEvent[*clusterv1alpha1.Cluster], _ workqueue.RateLimitingInterface) {
// Don't care about cluster deletion events // Don't care about cluster deletion events
} }
func (h *clusterEventHandler) Generic(_ context.Context, e event.GenericEvent, queue workqueue.RateLimitingInterface) { func (h *clusterEventHandler) Generic(_ context.Context, e event.TypedGenericEvent[*clusterv1alpha1.Cluster], queue workqueue.RateLimitingInterface) {
queue.Add(reconcile.Request{NamespacedName: types.NamespacedName{ queue.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Name: e.Object.GetName(), Name: e.Object.GetName(),
}}) }})
} }
func newRemedyEventHandler(clusterChan chan<- event.GenericEvent, client client.Client) handler.EventHandler { func newRemedyEventHandler(clusterChan chan<- event.TypedGenericEvent[*clusterv1alpha1.Cluster], client client.Client) handler.TypedEventHandler[*remedyv1alpha1.Remedy] {
return &remedyEventHandler{ return &remedyEventHandler{
client: client, client: client,
clusterChan: clusterChan, clusterChan: clusterChan,
} }
} }
var _ handler.EventHandler = (*remedyEventHandler)(nil) var _ handler.TypedEventHandler[*remedyv1alpha1.Remedy] = &remedyEventHandler{}
type remedyEventHandler struct { type remedyEventHandler struct {
client client.Client client client.Client
clusterChan chan<- event.GenericEvent clusterChan chan<- event.TypedGenericEvent[*clusterv1alpha1.Cluster]
} }
func (h *remedyEventHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) { func (h *remedyEventHandler) Create(ctx context.Context, e event.TypedCreateEvent[*remedyv1alpha1.Remedy], _ workqueue.RateLimitingInterface) {
remedy := e.Object.(*remedyv1alpha1.Remedy) remedy := e.Object
if remedy.Spec.ClusterAffinity != nil { if remedy.Spec.ClusterAffinity != nil {
for _, clusterName := range remedy.Spec.ClusterAffinity.ClusterNames { for _, clusterName := range remedy.Spec.ClusterAffinity.ClusterNames {
h.clusterChan <- event.GenericEvent{Object: &clusterv1alpha1.Cluster{ h.clusterChan <- event.TypedGenericEvent[*clusterv1alpha1.Cluster]{
Object: &clusterv1alpha1.Cluster{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: clusterName, Name: clusterName,
}}} },
},
}
} }
return return
} }
@ -104,16 +103,19 @@ func (h *remedyEventHandler) Create(ctx context.Context, e event.CreateEvent, _
} }
for _, cluster := range clusterList.Items { for _, cluster := range clusterList.Items {
h.clusterChan <- event.GenericEvent{Object: &clusterv1alpha1.Cluster{ h.clusterChan <- event.TypedGenericEvent[*clusterv1alpha1.Cluster]{
Object: &clusterv1alpha1.Cluster{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cluster.Name, Name: cluster.Name,
}}} },
},
}
} }
} }
func (h *remedyEventHandler) Update(ctx context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) { func (h *remedyEventHandler) Update(ctx context.Context, e event.TypedUpdateEvent[*remedyv1alpha1.Remedy], _ workqueue.RateLimitingInterface) {
oldRemedy := e.ObjectOld.(*remedyv1alpha1.Remedy) oldRemedy := e.ObjectOld
newRemedy := e.ObjectNew.(*remedyv1alpha1.Remedy) newRemedy := e.ObjectNew
if oldRemedy.Spec.ClusterAffinity == nil || newRemedy.Spec.ClusterAffinity == nil { if oldRemedy.Spec.ClusterAffinity == nil || newRemedy.Spec.ClusterAffinity == nil {
clusterList := &clusterv1alpha1.ClusterList{} clusterList := &clusterv1alpha1.ClusterList{}
@ -124,10 +126,13 @@ func (h *remedyEventHandler) Update(ctx context.Context, e event.UpdateEvent, _
} }
for _, cluster := range clusterList.Items { for _, cluster := range clusterList.Items {
h.clusterChan <- event.GenericEvent{Object: &clusterv1alpha1.Cluster{ h.clusterChan <- event.TypedGenericEvent[*clusterv1alpha1.Cluster]{
Object: &clusterv1alpha1.Cluster{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cluster.Name, Name: cluster.Name,
}}} },
},
}
} }
return return
} }
@ -140,21 +145,27 @@ func (h *remedyEventHandler) Update(ctx context.Context, e event.UpdateEvent, _
clusters.Insert(clusterName) clusters.Insert(clusterName)
} }
for clusterName := range clusters { for clusterName := range clusters {
h.clusterChan <- event.GenericEvent{Object: &clusterv1alpha1.Cluster{ h.clusterChan <- event.TypedGenericEvent[*clusterv1alpha1.Cluster]{
Object: &clusterv1alpha1.Cluster{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: clusterName, Name: clusterName,
}}} },
},
}
} }
} }
func (h *remedyEventHandler) Delete(ctx context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) { func (h *remedyEventHandler) Delete(ctx context.Context, e event.TypedDeleteEvent[*remedyv1alpha1.Remedy], _ workqueue.RateLimitingInterface) {
remedy := e.Object.(*remedyv1alpha1.Remedy) remedy := e.Object
if remedy.Spec.ClusterAffinity != nil { if remedy.Spec.ClusterAffinity != nil {
for _, clusterName := range remedy.Spec.ClusterAffinity.ClusterNames { for _, clusterName := range remedy.Spec.ClusterAffinity.ClusterNames {
h.clusterChan <- event.GenericEvent{Object: &clusterv1alpha1.Cluster{ h.clusterChan <- event.TypedGenericEvent[*clusterv1alpha1.Cluster]{
Object: &clusterv1alpha1.Cluster{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: clusterName, Name: clusterName,
}}} },
},
}
} }
return return
} }
@ -167,12 +178,15 @@ func (h *remedyEventHandler) Delete(ctx context.Context, e event.DeleteEvent, _
} }
for _, cluster := range clusterList.Items { for _, cluster := range clusterList.Items {
h.clusterChan <- event.GenericEvent{Object: &clusterv1alpha1.Cluster{ h.clusterChan <- event.TypedGenericEvent[*clusterv1alpha1.Cluster]{
Object: &clusterv1alpha1.Cluster{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cluster.Name, Name: cluster.Name,
}}} },
},
}
} }
} }
func (h *remedyEventHandler) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) { func (h *remedyEventHandler) Generic(_ context.Context, _ event.TypedGenericEvent[*remedyv1alpha1.Remedy], _ workqueue.RateLimitingInterface) {
} }

View File

@ -36,8 +36,8 @@ func Test_clusterEventHandler(t *testing.T) {
type args struct { type args struct {
operation string operation string
q workqueue.RateLimitingInterface q workqueue.RateLimitingInterface
obj client.Object obj *clusterv1alpha1.Cluster
oldObj client.Object oldObj *clusterv1alpha1.Cluster
} }
tests := []struct { tests := []struct {
name string name string
@ -144,16 +144,16 @@ func Test_clusterEventHandler(t *testing.T) {
h := newClusterEventHandler() h := newClusterEventHandler()
switch tt.args.operation { switch tt.args.operation {
case "Create": case "Create":
createEvent := event.CreateEvent{Object: tt.args.obj} createEvent := event.TypedCreateEvent[*clusterv1alpha1.Cluster]{Object: tt.args.obj}
h.Create(context.TODO(), createEvent, queue) h.Create(context.TODO(), createEvent, queue)
case "Delete": case "Delete":
deleteEvent := event.DeleteEvent{Object: tt.args.obj} deleteEvent := event.TypedDeleteEvent[*clusterv1alpha1.Cluster]{Object: tt.args.obj}
h.Delete(context.TODO(), deleteEvent, queue) h.Delete(context.TODO(), deleteEvent, queue)
case "Update": case "Update":
updateEvent := event.UpdateEvent{ObjectNew: tt.args.obj, ObjectOld: tt.args.oldObj} updateEvent := event.TypedUpdateEvent[*clusterv1alpha1.Cluster]{ObjectNew: tt.args.obj, ObjectOld: tt.args.oldObj}
h.Update(context.TODO(), updateEvent, queue) h.Update(context.TODO(), updateEvent, queue)
case "Generic": case "Generic":
genericEvent := event.GenericEvent{Object: tt.args.obj} genericEvent := event.TypedGenericEvent[*clusterv1alpha1.Cluster]{Object: tt.args.obj}
h.Generic(context.TODO(), genericEvent, queue) h.Generic(context.TODO(), genericEvent, queue)
default: default:
t.Errorf("no support operation %v", tt.args.operation) t.Errorf("no support operation %v", tt.args.operation)
@ -170,8 +170,8 @@ func Test_clusterEventHandler(t *testing.T) {
func Test_remedyEventHandler(t *testing.T) { func Test_remedyEventHandler(t *testing.T) {
type args struct { type args struct {
operation string operation string
obj client.Object obj *remedyv1alpha1.Remedy
oldObj client.Object oldObj *remedyv1alpha1.Remedy
client client.Client client client.Client
} }
tests := []struct { tests := []struct {
@ -328,30 +328,30 @@ func Test_remedyEventHandler(t *testing.T) {
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
clusterChan := make(chan event.GenericEvent) clusterChan := make(chan event.TypedGenericEvent[*clusterv1alpha1.Cluster])
h := newRemedyEventHandler(clusterChan, tt.args.client) h := newRemedyEventHandler(clusterChan, tt.args.client)
switch tt.args.operation { switch tt.args.operation {
case "Create": case "Create":
go func() { go func() {
createEvent := event.CreateEvent{Object: tt.args.obj} createEvent := event.TypedCreateEvent[*remedyv1alpha1.Remedy]{Object: tt.args.obj}
h.Create(context.TODO(), createEvent, nil) h.Create(context.TODO(), createEvent, nil)
close(clusterChan) close(clusterChan)
}() }()
case "Delete": case "Delete":
go func() { go func() {
deleteEvent := event.DeleteEvent{Object: tt.args.obj} deleteEvent := event.TypedDeleteEvent[*remedyv1alpha1.Remedy]{Object: tt.args.obj}
h.Delete(context.TODO(), deleteEvent, nil) h.Delete(context.TODO(), deleteEvent, nil)
close(clusterChan) close(clusterChan)
}() }()
case "Update": case "Update":
go func() { go func() {
updateEvent := event.UpdateEvent{ObjectNew: tt.args.obj, ObjectOld: tt.args.oldObj} updateEvent := event.TypedUpdateEvent[*remedyv1alpha1.Remedy]{ObjectNew: tt.args.obj, ObjectOld: tt.args.oldObj}
h.Update(context.TODO(), updateEvent, nil) h.Update(context.TODO(), updateEvent, nil)
close(clusterChan) close(clusterChan)
}() }()
case "Generic": case "Generic":
go func() { go func() {
genericEvent := event.GenericEvent{Object: tt.args.obj} genericEvent := event.TypedGenericEvent[*remedyv1alpha1.Remedy]{Object: tt.args.obj}
h.Generic(context.TODO(), genericEvent, nil) h.Generic(context.TODO(), genericEvent, nil)
close(clusterChan) close(clusterChan)
}() }()

View File

@ -101,17 +101,17 @@ func (c *RemedyController) SetupWithManager(mgr controllerruntime.Manager) error
} }
func (c *RemedyController) setupWatches(remedyController controller.Controller, mgr controllerruntime.Manager) error { func (c *RemedyController) setupWatches(remedyController controller.Controller, mgr controllerruntime.Manager) error {
clusterChan := make(chan event.GenericEvent) clusterChan := make(chan event.TypedGenericEvent[*clusterv1alpha1.Cluster])
clusterHandler := newClusterEventHandler() clusterHandler := newClusterEventHandler()
remedyHandler := newRemedyEventHandler(clusterChan, c.Client) remedyHandler := newRemedyEventHandler(clusterChan, c.Client)
if err := remedyController.Watch(source.Kind(mgr.GetCache(), &clusterv1alpha1.Cluster{}), clusterHandler); err != nil { if err := remedyController.Watch(source.Kind[*clusterv1alpha1.Cluster](mgr.GetCache(), &clusterv1alpha1.Cluster{}, clusterHandler)); err != nil {
return err return err
} }
if err := remedyController.Watch(&source.Channel{Source: clusterChan}, clusterHandler); err != nil { if err := remedyController.Watch(source.Channel(clusterChan, clusterHandler)); err != nil {
return err return err
} }
if err := remedyController.Watch(source.Kind(mgr.GetCache(), &remedyv1alpha1.Remedy{}), remedyHandler); err != nil { if err := remedyController.Watch(source.Kind(mgr.GetCache(), &remedyv1alpha1.Remedy{}, remedyHandler)); err != nil {
return err return err
} }
return nil return nil

View File

@ -103,7 +103,7 @@ type DependenciesDistributor struct {
eventHandler cache.ResourceEventHandler eventHandler cache.ResourceEventHandler
resourceProcessor util.AsyncWorker resourceProcessor util.AsyncWorker
genericEvent chan event.GenericEvent genericEvent chan event.TypedGenericEvent[*workv1alpha2.ResourceBinding]
stopCh <-chan struct{} stopCh <-chan struct{}
} }
@ -184,7 +184,7 @@ func (d *DependenciesDistributor) reconcileResourceTemplate(key util.QueueKey) e
} }
klog.V(4).Infof("ResourceBinding(%s/%s) is matched for resource(%s/%s)", binding.Namespace, binding.Name, resourceTemplateKey.Namespace, resourceTemplateKey.Name) klog.V(4).Infof("ResourceBinding(%s/%s) is matched for resource(%s/%s)", binding.Namespace, binding.Name, resourceTemplateKey.Namespace, resourceTemplateKey.Name)
d.genericEvent <- event.GenericEvent{Object: binding} d.genericEvent <- event.TypedGenericEvent[*workv1alpha2.ResourceBinding]{Object: binding}
} }
return nil return nil
@ -610,7 +610,7 @@ func (d *DependenciesDistributor) Start(ctx context.Context) error {
// SetupWithManager creates a controller and register to controller manager. // SetupWithManager creates a controller and register to controller manager.
func (d *DependenciesDistributor) SetupWithManager(mgr controllerruntime.Manager) error { func (d *DependenciesDistributor) SetupWithManager(mgr controllerruntime.Manager) error {
d.genericEvent = make(chan event.GenericEvent) d.genericEvent = make(chan event.TypedGenericEvent[*workv1alpha2.ResourceBinding])
return utilerrors.NewAggregate([]error{ return utilerrors.NewAggregate([]error{
mgr.Add(d), mgr.Add(d),
controllerruntime.NewControllerManagedBy(mgr).For(&workv1alpha2.ResourceBinding{}). controllerruntime.NewControllerManagedBy(mgr).For(&workv1alpha2.ResourceBinding{}).
@ -650,7 +650,7 @@ func (d *DependenciesDistributor) SetupWithManager(mgr controllerruntime.Manager
RateLimiter: ratelimiterflag.DefaultControllerRateLimiter(d.RateLimiterOptions), RateLimiter: ratelimiterflag.DefaultControllerRateLimiter(d.RateLimiterOptions),
MaxConcurrentReconciles: 2, MaxConcurrentReconciles: 2,
}). }).
WatchesRawSource(&source.Channel{Source: d.genericEvent}, &handler.EnqueueRequestForObject{}). WatchesRawSource(source.Channel(d.genericEvent, &handler.TypedEnqueueRequestForObject[*workv1alpha2.ResourceBinding]{})).
Complete(d), Complete(d),
}) })
} }

View File

@ -29,7 +29,7 @@ import (
// ValidatingAdmission validates ClusterOverridePolicy object when creating/updating/deleting. // ValidatingAdmission validates ClusterOverridePolicy object when creating/updating/deleting.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -35,7 +35,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
DefaultNotReadyTolerationSeconds int64 DefaultNotReadyTolerationSeconds int64
DefaultUnreachableTolerationSeconds int64 DefaultUnreachableTolerationSeconds int64
@ -45,7 +45,7 @@ type MutatingAdmission struct {
var _ admission.Handler = &MutatingAdmission{} var _ admission.Handler = &MutatingAdmission{}
// NewMutatingHandler builds a new admission.Handler. // NewMutatingHandler builds a new admission.Handler.
func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds int64, decoder *admission.Decoder) admission.Handler { func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds int64, decoder admission.Decoder) admission.Handler {
return &MutatingAdmission{ return &MutatingAdmission{
DefaultNotReadyTolerationSeconds: notReadyTolerationSeconds, DefaultNotReadyTolerationSeconds: notReadyTolerationSeconds,
DefaultUnreachableTolerationSeconds: unreachableTolerationSeconds, DefaultUnreachableTolerationSeconds: unreachableTolerationSeconds,

View File

@ -31,7 +31,7 @@ import (
// ValidatingAdmission validates ClusterPropagationPolicy object when creating/updating/deleting. // ValidatingAdmission validates ClusterPropagationPolicy object when creating/updating/deleting.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -31,7 +31,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our MutatingAdmission implements necessary interface // Check if our MutatingAdmission implements necessary interface

View File

@ -34,7 +34,7 @@ import (
// ValidatingAdmission validates ResourceInterpreterWebhookConfiguration object when creating/updating. // ValidatingAdmission validates ResourceInterpreterWebhookConfiguration object when creating/updating.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -38,7 +38,7 @@ import (
// ValidatingAdmission validates CronFederatedHPA object when creating/updating. // ValidatingAdmission validates CronFederatedHPA object when creating/updating.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -30,7 +30,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our MutatingAdmission implements necessary interface // Check if our MutatingAdmission implements necessary interface

View File

@ -29,7 +29,7 @@ import (
// ValidatingAdmission validates FederatedHPA object when creating/updating. // ValidatingAdmission validates FederatedHPA object when creating/updating.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -34,7 +34,7 @@ import (
// ValidatingAdmission validates FederatedResourceQuota object when creating/updating. // ValidatingAdmission validates FederatedResourceQuota object when creating/updating.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -32,7 +32,7 @@ import (
// ValidatingAdmission validates MultiClusterIngress object when creating/updating. // ValidatingAdmission validates MultiClusterIngress object when creating/updating.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -30,7 +30,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our MutatingAdmission implements necessary interface // Check if our MutatingAdmission implements necessary interface

View File

@ -37,7 +37,7 @@ import (
// ValidatingAdmission validates MultiClusterService object when creating/updating. // ValidatingAdmission validates MultiClusterService object when creating/updating.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -29,7 +29,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our MutatingAdmission implements necessary interface // Check if our MutatingAdmission implements necessary interface

View File

@ -29,7 +29,7 @@ import (
// ValidatingAdmission validates OverridePolicy object when creating/updating/deleting. // ValidatingAdmission validates OverridePolicy object when creating/updating/deleting.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -36,7 +36,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
DefaultNotReadyTolerationSeconds int64 DefaultNotReadyTolerationSeconds int64
DefaultUnreachableTolerationSeconds int64 DefaultUnreachableTolerationSeconds int64
@ -46,7 +46,7 @@ type MutatingAdmission struct {
var _ admission.Handler = &MutatingAdmission{} var _ admission.Handler = &MutatingAdmission{}
// NewMutatingHandler builds a new admission.Handler. // NewMutatingHandler builds a new admission.Handler.
func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds int64, decoder *admission.Decoder) admission.Handler { func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds int64, decoder admission.Decoder) admission.Handler {
return &MutatingAdmission{ return &MutatingAdmission{
DefaultNotReadyTolerationSeconds: notReadyTolerationSeconds, DefaultNotReadyTolerationSeconds: notReadyTolerationSeconds,
DefaultUnreachableTolerationSeconds: unreachableTolerationSeconds, DefaultUnreachableTolerationSeconds: unreachableTolerationSeconds,

View File

@ -31,7 +31,7 @@ import (
// ValidatingAdmission validates PropagationPolicy object when creating/updating/deleting. // ValidatingAdmission validates PropagationPolicy object when creating/updating/deleting.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -31,7 +31,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our MutatingAdmission implements necessary interface // Check if our MutatingAdmission implements necessary interface

View File

@ -31,7 +31,7 @@ import (
// ValidatingAdmission validates resource templates to ensure those protected resources are not delectable. // ValidatingAdmission validates resource templates to ensure those protected resources are not delectable.
type ValidatingAdmission struct { type ValidatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -30,7 +30,7 @@ import (
// ValidatingAdmission validates ResourceInterpreterCustomization object when creating/updating. // ValidatingAdmission validates ResourceInterpreterCustomization object when creating/updating.
type ValidatingAdmission struct { type ValidatingAdmission struct {
client.Client client.Client
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our ValidatingAdmission implements necessary interface // Check if our ValidatingAdmission implements necessary interface

View File

@ -35,7 +35,7 @@ import (
// MutatingAdmission mutates API request if necessary. // MutatingAdmission mutates API request if necessary.
type MutatingAdmission struct { type MutatingAdmission struct {
Decoder *admission.Decoder Decoder admission.Decoder
} }
// Check if our MutatingAdmission implements necessary interface // Check if our MutatingAdmission implements necessary interface