@@ -34,6 +34,7 @@ import (
34
34
"k8s.io/client-go/util/retry"
35
35
"k8s.io/utils/ptr"
36
36
37
+ "github.com/kcp-dev/kcp/pkg/admission/initializers"
37
38
"github.com/kcp-dev/kcp/pkg/reconciler/apis/apibinding"
38
39
corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1"
39
40
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
@@ -67,12 +68,16 @@ type crdNoOverlappingGVRAdmission struct {
67
68
// Ensure that the required admission interfaces are implemented.
68
69
var _ = admission .ValidationInterface (& crdNoOverlappingGVRAdmission {})
69
70
var _ = admission .InitializationValidator (& crdNoOverlappingGVRAdmission {})
71
+ var _ = initializers .WantsKcpInformers (& crdNoOverlappingGVRAdmission {})
72
+ var _ = initializers .WantsKcpClusterClient (& crdNoOverlappingGVRAdmission {})
70
73
74
+ // SetKcpInformers sets the informer for kcp resources. It's part of WantsKcpInformers.
71
75
func (p * crdNoOverlappingGVRAdmission ) SetKcpInformers (local , global kcpinformers.SharedInformerFactory ) {
72
76
p .SetReadyFunc (local .Apis ().V1alpha1 ().APIBindings ().Informer ().HasSynced )
73
77
p .logicalclusterLister = local .Core ().V1alpha1 ().LogicalClusters ().Lister ()
74
78
}
75
79
80
+ // SetKcpClusterClient sets the client for kcp resources. It's part of WantsKcpClusterClient.
76
81
func (p * crdNoOverlappingGVRAdmission ) SetKcpClusterClient (c kcpclientset.ClusterInterface ) {
77
82
p .updateLogicalCluster = func (ctx context.Context , logicalCluster * corev1alpha1.LogicalCluster , opts metav1.UpdateOptions ) (* corev1alpha1.LogicalCluster , error ) {
78
83
return c .CoreV1alpha1 ().LogicalClusters ().Cluster (logicalcluster .From (logicalCluster ).Path ()).Update (ctx , logicalCluster , opts )
0 commit comments