Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
  • Loading branch information
sttts committed Feb 23, 2025
1 parent b3408c3 commit c132269
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"k8s.io/client-go/util/retry"
"k8s.io/utils/ptr"

"github.com/kcp-dev/kcp/pkg/admission/initializers"
"github.com/kcp-dev/kcp/pkg/reconciler/apis/apibinding"
corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1"
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
Expand Down Expand Up @@ -67,12 +68,16 @@ type crdNoOverlappingGVRAdmission struct {
// Ensure that the required admission interfaces are implemented.
var _ = admission.ValidationInterface(&crdNoOverlappingGVRAdmission{})
var _ = admission.InitializationValidator(&crdNoOverlappingGVRAdmission{})
var _ = initializers.WantsKcpInformers(&crdNoOverlappingGVRAdmission{})
var _ = initializers.WantsKcpClusterClient(&crdNoOverlappingGVRAdmission{})

// SetKcpInformers sets the informer for kcp resources. It's part of WantsKcpInformers.
func (p *crdNoOverlappingGVRAdmission) SetKcpInformers(local, global kcpinformers.SharedInformerFactory) {
p.SetReadyFunc(local.Apis().V1alpha1().APIBindings().Informer().HasSynced)
p.logicalclusterLister = local.Core().V1alpha1().LogicalClusters().Lister()
}

// SetKcpClusterClient sets the client for kcp resources. It's part of WantsKcpClusterClient.
func (p *crdNoOverlappingGVRAdmission) SetKcpClusterClient(c kcpclientset.ClusterInterface) {
p.updateLogicalCluster = func(ctx context.Context, logicalCluster *corev1alpha1.LogicalCluster, opts metav1.UpdateOptions) (*corev1alpha1.LogicalCluster, error) {
return c.CoreV1alpha1().LogicalClusters().Cluster(logicalcluster.From(logicalCluster).Path()).Update(ctx, logicalCluster, opts)
Expand Down

0 comments on commit c132269

Please sign in to comment.