From d6d2cf002fd91c7bc94f2822661dca03722381a5 Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Wed, 3 Mar 2021 09:48:51 +0800 Subject: [PATCH] resolve conversation Signed-off-by: wanjunlei --- hack/generate_client.sh | 2 +- pkg/apiserver/apiserver.go | 46 +++++++++---------- pkg/client/clientset/versioned/clientset.go | 4 +- .../versioned/fake/clientset_generated.go | 9 +--- .../clientset/versioned/fake/register.go | 12 +---- .../clientset/versioned/scheme/register.go | 12 +---- .../informers/externalversions/generic.go | 6 +-- 7 files changed, 33 insertions(+), 58 deletions(-) diff --git a/hack/generate_client.sh b/hack/generate_client.sh index ceca0445a..d48b7a8c5 100755 --- a/hack/generate_client.sh +++ b/hack/generate_client.sh @@ -2,7 +2,7 @@ set -e -GV="network:v1alpha1 servicemesh:v1alpha2 tenant:v1alpha1 tenant:v1alpha2 devops:v1alpha1 iam:v1alpha2 devops:v1alpha3 cluster:v1alpha1 storage:v1alpha1 auditing:v1alpha1 types:v1beta1 quota:v1alpha2 application:v1alpha1" +GV="network:v1alpha1 servicemesh:v1alpha2 tenant:v1alpha1 tenant:v1alpha2 devops:v1alpha1 iam:v1alpha2 devops:v1alpha3 cluster:v1alpha1 storage:v1alpha1 auditing:v1alpha1 types:v1beta1 quota:v1alpha2 application:v1alpha1 notification:v2alpha1" rm -rf ./pkg/client ./hack/generate_group.sh "client,lister,informer" kubesphere.io/kubesphere/pkg/client kubesphere.io/kubesphere/pkg/apis "$GV" --output-base=./ -h "$PWD/hack/boilerplate.go.txt" diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index cdef0d6b0..1fbbb06dd 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -37,7 +37,7 @@ import ( "k8s.io/klog" clusterv1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1" iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2" - notificationcrd "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" audit "kubesphere.io/kubesphere/pkg/apiserver/auditing" @@ -69,7 +69,7 @@ import ( monitoringv1alpha3 "kubesphere.io/kubesphere/pkg/kapis/monitoring/v1alpha3" networkv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/network/v1alpha2" notificationv1 "kubesphere.io/kubesphere/pkg/kapis/notification/v1" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/kapis/notification/v2alpha1" + notificationkapisv2alpha1 "kubesphere.io/kubesphere/pkg/kapis/notification/v2alpha1" "kubesphere.io/kubesphere/pkg/kapis/oauth" openpitrixv1 "kubesphere.io/kubesphere/pkg/kapis/openpitrix/v1" operationsv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/operations/v1alpha2" @@ -272,7 +272,7 @@ func (s *APIServer) installKubeSphereAPIs() { s.KubernetesClient.Prometheus(), s.AlertingClient, s.Config.AlertingOptions)) urlruntime.Must(version.AddToContainer(s.container, s.KubernetesClient.Discovery())) urlruntime.Must(kubeedgev1alpha1.AddToContainer(s.container, s.Config.KubeEdgeOptions.Endpoint)) - urlruntime.Must(notificationv2alpha1.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), + urlruntime.Must(notificationkapisv2alpha1.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), s.KubernetesClient.KubeSphere())) } @@ -314,16 +314,16 @@ func (s *APIServer) buildHandlerChain(stopCh <-chan struct{}) { tenantv1alpha2.Resource(clusterv1alpha1.ResourcesPluralCluster), clusterv1alpha1.Resource(clusterv1alpha1.ResourcesPluralCluster), resourcev1alpha3.Resource(clusterv1alpha1.ResourcesPluralCluster), - notificationcrd.Resource(notificationcrd.ResourcesPluralDingTalkConfig), - notificationcrd.Resource(notificationcrd.ResourcesPluralDingTalkReceiver), - notificationcrd.Resource(notificationcrd.ResourcesPluralEmailReceiver), - notificationcrd.Resource(notificationcrd.ResourcesPluralEmailConfig), - notificationcrd.Resource(notificationcrd.ResourcesPluralSlackConfig), - notificationcrd.Resource(notificationcrd.ResourcesPluralSlackReceiver), - notificationcrd.Resource(notificationcrd.ResourcesPluralWebhookConfig), - notificationcrd.Resource(notificationcrd.ResourcesPluralWebhookReceiver), - notificationcrd.Resource(notificationcrd.ResourcesPluralWechatConfig), - notificationcrd.Resource(notificationcrd.ResourcesPluralWechatReceiver), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralDingTalkConfig), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralDingTalkReceiver), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralEmailReceiver), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralEmailConfig), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralSlackConfig), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralSlackReceiver), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralWebhookConfig), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralWebhookReceiver), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralWechatConfig), + notificationv2alpha1.Resource(notificationv2alpha1.ResourcesPluralWechatReceiver), }, } @@ -457,16 +457,16 @@ func (s *APIServer) waitForResourceSync(stopCh <-chan struct{}) error { {Group: "cluster.kubesphere.io", Version: "v1alpha1", Resource: "clusters"}, {Group: "devops.kubesphere.io", Version: "v1alpha3", Resource: "devopsprojects"}, {Group: "network.kubesphere.io", Version: "v1alpha1", Resource: "ippools"}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralDingTalkConfig}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralDingTalkReceiver}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralEmailConfig}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralEmailReceiver}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralSlackConfig}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralSlackReceiver}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralWebhookConfig}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralWebhookReceiver}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralWechatConfig}, - {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationcrd.ResourcesPluralWechatReceiver}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralDingTalkConfig}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralDingTalkReceiver}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralEmailConfig}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralEmailReceiver}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralSlackConfig}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralSlackReceiver}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralWebhookConfig}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralWebhookReceiver}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralWechatConfig}, + {Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: notificationv2alpha1.ResourcesPluralWechatReceiver}, } devopsGVRs := []schema.GroupVersionResource{ diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index d898df682..14401b8d0 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -31,8 +31,8 @@ import ( devopsv1alpha3 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha3" iamv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/iam/v1alpha2" networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1" - quotav1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/quota/v1alpha2" notificationv2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1" + quotav1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/storage/v1alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1" @@ -49,8 +49,8 @@ type Interface interface { DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface IamV1alpha2() iamv1alpha2.IamV1alpha2Interface NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface - QuotaV1alpha2() quotav1alpha2.QuotaV1alpha2Interface NotificationV2alpha1() notificationv2alpha1.NotificationV2alpha1Interface + QuotaV1alpha2() quotav1alpha2.QuotaV1alpha2Interface ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index c7aeb6234..fe3db3eea 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -39,15 +39,10 @@ import ( fakeiamv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/iam/v1alpha2/fake" networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1" fakenetworkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1/fake" -<<<<<<< HEAD - notificationv2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2" - fakenotificationv2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2/fake" - quotav1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/quota/v1alpha2" - fakequotav1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/quota/v1alpha2/fake" -======= notificationv2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1" fakenotificationv2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake" ->>>>>>> change notification crd version to v2alpha1 + quotav1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/quota/v1alpha2" + fakequotav1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/quota/v1alpha2/fake" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2" fakeservicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2/fake" storagev1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/storage/v1alpha1" diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index cf2870887..02793faa8 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -31,12 +31,8 @@ import ( devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3" iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2" networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1" -<<<<<<< HEAD - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" - quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" -======= notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ->>>>>>> change notification crd version to v2alpha1 + quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" @@ -55,12 +51,8 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, -<<<<<<< HEAD - notificationv2.AddToScheme, - quotav1alpha2.AddToScheme, -======= notificationv2alpha1.AddToScheme, ->>>>>>> change notification crd version to v2alpha1 + quotav1alpha2.AddToScheme, servicemeshv1alpha2.AddToScheme, storagev1alpha1.AddToScheme, tenantv1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index cd42e779c..8c6a3241b 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -31,12 +31,8 @@ import ( devopsv1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3" iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2" networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1" -<<<<<<< HEAD - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" - quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" -======= notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ->>>>>>> change notification crd version to v2alpha1 + quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" @@ -55,12 +51,8 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, -<<<<<<< HEAD - notificationv2.AddToScheme, - quotav1alpha2.AddToScheme, -======= notificationv2alpha1.AddToScheme, ->>>>>>> change notification crd version to v2alpha1 + quotav1alpha2.AddToScheme, servicemeshv1alpha2.AddToScheme, storagev1alpha1.AddToScheme, tenantv1alpha1.AddToScheme, diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 03d3fa0e9..79ef62068 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -30,12 +30,8 @@ import ( v1alpha3 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3" v1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2" networkv1alpha1 "kubesphere.io/kubesphere/pkg/apis/network/v1alpha1" -<<<<<<< HEAD - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" - quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" -======= v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ->>>>>>> change notification crd version to v2alpha1 + quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"