From c9b07e3a000badad0fe40988ae7fb9dcd9ec0d03 Mon Sep 17 00:00:00 2001 From: qingliu Date: Wed, 13 Jul 2022 14:23:49 +0800 Subject: [PATCH] feat: add method for multicluster used to start warming the client cache. --- apis/meta/v1alpha1/zz_generated.deepcopy.go | 17 +++++++++++++++++ multicluster/clusterregistry_client.go | 3 +++ multicluster/interface.go | 2 ++ .../katanomi/pkg/multicluster/interface.go | 12 ++++++++++++ 4 files changed, 34 insertions(+) diff --git a/apis/meta/v1alpha1/zz_generated.deepcopy.go b/apis/meta/v1alpha1/zz_generated.deepcopy.go index 83b57855..5e863a98 100644 --- a/apis/meta/v1alpha1/zz_generated.deepcopy.go +++ b/apis/meta/v1alpha1/zz_generated.deepcopy.go @@ -2700,6 +2700,23 @@ func (in *TriggeredBy) DeepCopy() *TriggeredBy { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UpdatePullRequestCommentPayload) DeepCopyInto(out *UpdatePullRequestCommentPayload) { + *out = *in + out.GitRepo = in.GitRepo + out.CreatePullRequestCommentParam = in.CreatePullRequestCommentParam +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdatePullRequestCommentPayload. +func (in *UpdatePullRequestCommentPayload) DeepCopy() *UpdatePullRequestCommentPayload { + if in == nil { + return nil + } + out := new(UpdatePullRequestCommentPayload) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *User) DeepCopyInto(out *User) { *out = *in diff --git a/multicluster/clusterregistry_client.go b/multicluster/clusterregistry_client.go index b00741e0..d3943da9 100644 --- a/multicluster/clusterregistry_client.go +++ b/multicluster/clusterregistry_client.go @@ -197,3 +197,6 @@ func (m *ClusterRegistryClient) GetConfigFromCluster(ctx context.Context, cluste func (m *ClusterRegistryClient) ListClustersNamespaces(ctx context.Context, namespace string) (clusterNamespaces map[*corev1.ObjectReference][]corev1.Namespace, err error) { return map[*corev1.ObjectReference][]corev1.Namespace{}, err } + +func (m *ClusterRegistryClient) StartWarmUpClientCache(ctx context.Context) { +} diff --git a/multicluster/interface.go b/multicluster/interface.go index 41e011d9..d6fec1bc 100644 --- a/multicluster/interface.go +++ b/multicluster/interface.go @@ -39,4 +39,6 @@ type Interface interface { // TODO: add this method to the interface and implementation ListClustersNamespaces(ctx context.Context, namespace string) (clusterNamespaces map[*corev1.ObjectReference][]corev1.Namespace, err error) + // StartWarmUpClientCache used to start warming the client cache, only needs to be called once. + StartWarmUpClientCache(ctx context.Context) } diff --git a/testing/mock/github.com/katanomi/pkg/multicluster/interface.go b/testing/mock/github.com/katanomi/pkg/multicluster/interface.go index 60e88e45..ec9c26b3 100644 --- a/testing/mock/github.com/katanomi/pkg/multicluster/interface.go +++ b/testing/mock/github.com/katanomi/pkg/multicluster/interface.go @@ -114,3 +114,15 @@ func (mr *MockInterfaceMockRecorder) ListClustersNamespaces(arg0, arg1 interface mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListClustersNamespaces", reflect.TypeOf((*MockInterface)(nil).ListClustersNamespaces), arg0, arg1) } + +// StartWarmUpClientCache mocks base method. +func (m *MockInterface) StartWarmUpClientCache(arg0 context.Context) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "StartWarmUpClientCache", arg0) +} + +// StartWarmUpClientCache indicates an expected call of StartWarmUpClientCache. +func (mr *MockInterfaceMockRecorder) StartWarmUpClientCache(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartWarmUpClientCache", reflect.TypeOf((*MockInterface)(nil).StartWarmUpClientCache), arg0) +}