From f9213fcdc883518e0a0aac55687d84e7a98fc34b Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Wed, 27 Jan 2021 14:37:44 +0800 Subject: [PATCH 1/7] support customize notification receiver Signed-off-by: wanjunlei --- cmd/controller-manager/app/controllers.go | 6 + ...ication.kubesphere.io_dingtalkconfigs.yaml | 83 + ...ation.kubesphere.io_dingtalkreceivers.yaml | 158 ++ ...tification.kubesphere.io_emailconfigs.yaml | 167 ++ ...fication.kubesphere.io_emailreceivers.yaml | 116 ++ ...on.kubesphere.io_notificationmanagers.yaml | 1519 +++++++++++++++ ...tification.kubesphere.io_slackconfigs.yaml | 64 + ...fication.kubesphere.io_slackreceivers.yaml | 114 ++ ...fication.kubesphere.io_webhookconfigs.yaml | 48 + ...cation.kubesphere.io_webhookreceivers.yaml | 239 +++ ...ification.kubesphere.io_wechatconfigs.yaml | 77 + ...ication.kubesphere.io_wechatreceivers.yaml | 115 ++ ...s.kubefed.io_federateddingtalkconfigs.yaml | 197 ++ ...kubefed.io_federateddingtalkreceivers.yaml | 272 +++ ...ypes.kubefed.io_federatedemailconfigs.yaml | 281 +++ ...es.kubefed.io_federatedemailreceivers.yaml | 230 +++ .../types.kubefed.io_federatednamespaces.yaml | 164 ++ .../types.kubefed.io_federatedsecrets.yaml | 165 ++ ...ypes.kubefed.io_federatedslackconfigs.yaml | 178 ++ ...es.kubefed.io_federatedslackreceivers.yaml | 228 +++ ...es.kubefed.io_federatedwebhookconfigs.yaml | 162 ++ ....kubefed.io_federatedwebhookreceivers.yaml | 353 ++++ ...pes.kubefed.io_federatedwechatconfigs.yaml | 191 ++ ...s.kubefed.io_federatedwechatreceivers.yaml | 229 +++ hack/generate_client.sh | 1 - pkg/apis/addtoscheme_notification_v2.go | 25 + pkg/apis/notification/group.go | 18 + .../notification/v2/dingtalkconfig_types.go | 65 + .../notification/v2/dingtalkreceiver_types.go | 80 + pkg/apis/notification/v2/doc.go | 21 + pkg/apis/notification/v2/emailconfig_types.go | 77 + .../notification/v2/emailreceiver_types.go | 61 + .../v2/notificationmanager_types.go | 210 +++ pkg/apis/notification/v2/register.go | 41 + pkg/apis/notification/v2/slackconfig_types.go | 57 + .../notification/v2/slackreceiver_types.go | 61 + pkg/apis/notification/v2/types.go | 41 + pkg/apis/notification/v2/v2_suite_test.go | 54 + .../notification/v2/webhookconfig_types.go | 55 + .../notification/v2/webhookreceiver_types.go | 159 ++ .../notification/v2/wechatconfig_types.go | 63 + .../notification/v2/wechatreceiver_types.go | 63 + .../notification/v2/zz_generated.deepcopy.go | 1651 +++++++++++++++++ .../v1beta1/federateddingtalkconfig_types.go | 63 + .../federateddingtalkreceiver_types.go | 62 + .../v1beta1/federatedemailconfig_types.go | 62 + .../v1beta1/federatedemailreceiver_types.go | 62 + .../v1beta1/federatedslackconfig_types.go | 62 + .../v1beta1/federatedslackreceiver_types.go | 62 + .../v1beta1/federatedwebhookconfig_types.go | 62 + .../v1beta1/federatedwebhookreceiver_types.go | 62 + .../v1beta1/federatedwechatconfig_types.go | 62 + .../v1beta1/federatedwechatreceiver_types.go | 62 + pkg/apis/types/v1beta1/register.go | 20 + .../types/v1beta1/zz_generated.deepcopy.go | 1080 +++++++++++ pkg/apiserver/apiserver.go | 24 + pkg/client/clientset/versioned/clientset.go | 14 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../typed/notification/v2/dingtalkconfig.go | 184 ++ .../typed/notification/v2/dingtalkreceiver.go | 184 ++ .../versioned/typed/notification/v2/doc.go | 20 + .../typed/notification/v2/emailconfig.go | 184 ++ .../typed/notification/v2/emailreceiver.go | 184 ++ .../typed/notification/v2/fake/doc.go | 20 + .../v2/fake/fake_dingtalkconfig.go | 133 ++ .../v2/fake/fake_dingtalkreceiver.go | 133 ++ .../notification/v2/fake/fake_emailconfig.go | 133 ++ .../v2/fake/fake_emailreceiver.go | 133 ++ .../v2/fake/fake_notification_client.go | 76 + .../notification/v2/fake/fake_slackconfig.go | 133 ++ .../v2/fake/fake_slackreceiver.go | 133 ++ .../v2/fake/fake_webhookconfig.go | 133 ++ .../v2/fake/fake_webhookreceiver.go | 133 ++ .../notification/v2/fake/fake_wechatconfig.go | 133 ++ .../v2/fake/fake_wechatreceiver.go | 133 ++ .../notification/v2/generated_expansion.go | 39 + .../notification/v2/notification_client.go | 134 ++ .../typed/notification/v2/slackconfig.go | 184 ++ .../typed/notification/v2/slackreceiver.go | 184 ++ .../typed/notification/v2/webhookconfig.go | 184 ++ .../typed/notification/v2/webhookreceiver.go | 184 ++ .../typed/notification/v2/wechatconfig.go | 184 ++ .../typed/notification/v2/wechatreceiver.go | 184 ++ .../informers/externalversions/factory.go | 6 + .../informers/externalversions/generic.go | 23 + .../notification/interface.go | 46 + .../notification/v2/dingtalkconfig.go | 89 + .../notification/v2/dingtalkreceiver.go | 89 + .../notification/v2/emailconfig.go | 89 + .../notification/v2/emailreceiver.go | 89 + .../notification/v2/interface.go | 108 ++ .../notification/v2/slackconfig.go | 89 + .../notification/v2/slackreceiver.go | 89 + .../notification/v2/webhookconfig.go | 89 + .../notification/v2/webhookreceiver.go | 89 + .../notification/v2/wechatconfig.go | 89 + .../notification/v2/wechatreceiver.go | 89 + .../listers/notification/v2/dingtalkconfig.go | 65 + .../notification/v2/dingtalkreceiver.go | 65 + .../listers/notification/v2/emailconfig.go | 65 + .../listers/notification/v2/emailreceiver.go | 65 + .../notification/v2/expansion_generated.go | 59 + .../listers/notification/v2/slackconfig.go | 65 + .../listers/notification/v2/slackreceiver.go | 65 + .../listers/notification/v2/webhookconfig.go | 65 + .../notification/v2/webhookreceiver.go | 65 + .../listers/notification/v2/wechatconfig.go | 65 + .../listers/notification/v2/wechatreceiver.go | 65 + pkg/constants/constants.go | 4 + .../notification/notification_controller.go | 985 ++++++++++ .../notification_controller_suite_test.go | 83 + .../notification_controller_test.go | 202 ++ pkg/kapis/notification/v2/handler.go | 177 ++ pkg/kapis/notification/v2/register.go | 188 ++ pkg/models/notification/notification.go | 383 ++++ pkg/models/notification/notification_test.go | 206 ++ .../v1alpha3/notification/notification.go | 302 +++ .../notification/notification_test.go | 204 ++ .../resources/v1alpha3/resource/resource.go | 15 + .../resources/v1alpha3/secret/secrets.go | 77 + .../pkg/cache/informertest/fake_cache.go | 141 ++ .../pkg/client/fake/client.go | 409 ++++ .../controller-runtime/pkg/client/fake/doc.go | 33 + .../pkg/controller/controllertest/doc.go | 20 + .../pkg/controller/controllertest/testing.go | 62 + .../unconventionallisttypecrd.go | 60 + .../pkg/controller/controllertest/util.go | 108 ++ .../pkg/internal/objectutil/filter.go | 42 + 130 files changed, 18870 insertions(+), 1 deletion(-) create mode 100644 config/crds/notification.kubesphere.io_dingtalkconfigs.yaml create mode 100644 config/crds/notification.kubesphere.io_dingtalkreceivers.yaml create mode 100644 config/crds/notification.kubesphere.io_emailconfigs.yaml create mode 100644 config/crds/notification.kubesphere.io_emailreceivers.yaml create mode 100644 config/crds/notification.kubesphere.io_notificationmanagers.yaml create mode 100644 config/crds/notification.kubesphere.io_slackconfigs.yaml create mode 100644 config/crds/notification.kubesphere.io_slackreceivers.yaml create mode 100644 config/crds/notification.kubesphere.io_webhookconfigs.yaml create mode 100644 config/crds/notification.kubesphere.io_webhookreceivers.yaml create mode 100644 config/crds/notification.kubesphere.io_wechatconfigs.yaml create mode 100644 config/crds/notification.kubesphere.io_wechatreceivers.yaml create mode 100644 config/crds/types.kubefed.io_federateddingtalkconfigs.yaml create mode 100644 config/crds/types.kubefed.io_federateddingtalkreceivers.yaml create mode 100644 config/crds/types.kubefed.io_federatedemailconfigs.yaml create mode 100644 config/crds/types.kubefed.io_federatedemailreceivers.yaml create mode 100644 config/crds/types.kubefed.io_federatednamespaces.yaml create mode 100644 config/crds/types.kubefed.io_federatedsecrets.yaml create mode 100644 config/crds/types.kubefed.io_federatedslackconfigs.yaml create mode 100644 config/crds/types.kubefed.io_federatedslackreceivers.yaml create mode 100644 config/crds/types.kubefed.io_federatedwebhookconfigs.yaml create mode 100644 config/crds/types.kubefed.io_federatedwebhookreceivers.yaml create mode 100644 config/crds/types.kubefed.io_federatedwechatconfigs.yaml create mode 100644 config/crds/types.kubefed.io_federatedwechatreceivers.yaml create mode 100644 pkg/apis/addtoscheme_notification_v2.go create mode 100644 pkg/apis/notification/group.go create mode 100644 pkg/apis/notification/v2/dingtalkconfig_types.go create mode 100644 pkg/apis/notification/v2/dingtalkreceiver_types.go create mode 100644 pkg/apis/notification/v2/doc.go create mode 100644 pkg/apis/notification/v2/emailconfig_types.go create mode 100644 pkg/apis/notification/v2/emailreceiver_types.go create mode 100644 pkg/apis/notification/v2/notificationmanager_types.go create mode 100644 pkg/apis/notification/v2/register.go create mode 100644 pkg/apis/notification/v2/slackconfig_types.go create mode 100644 pkg/apis/notification/v2/slackreceiver_types.go create mode 100644 pkg/apis/notification/v2/types.go create mode 100644 pkg/apis/notification/v2/v2_suite_test.go create mode 100644 pkg/apis/notification/v2/webhookconfig_types.go create mode 100644 pkg/apis/notification/v2/webhookreceiver_types.go create mode 100644 pkg/apis/notification/v2/wechatconfig_types.go create mode 100644 pkg/apis/notification/v2/wechatreceiver_types.go create mode 100644 pkg/apis/notification/v2/zz_generated.deepcopy.go create mode 100644 pkg/apis/types/v1beta1/federateddingtalkconfig_types.go create mode 100644 pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go create mode 100644 pkg/apis/types/v1beta1/federatedemailconfig_types.go create mode 100644 pkg/apis/types/v1beta1/federatedemailreceiver_types.go create mode 100644 pkg/apis/types/v1beta1/federatedslackconfig_types.go create mode 100644 pkg/apis/types/v1beta1/federatedslackreceiver_types.go create mode 100644 pkg/apis/types/v1beta1/federatedwebhookconfig_types.go create mode 100644 pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go create mode 100644 pkg/apis/types/v1beta1/federatedwechatconfig_types.go create mode 100644 pkg/apis/types/v1beta1/federatedwechatreceiver_types.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/dingtalkconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/dingtalkreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/doc.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/emailconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/emailreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_notification_client.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/notification_client.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/slackconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/slackreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/webhookconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/webhookreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/wechatconfig.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2/wechatreceiver.go create mode 100644 pkg/client/informers/externalversions/notification/interface.go create mode 100644 pkg/client/informers/externalversions/notification/v2/dingtalkconfig.go create mode 100644 pkg/client/informers/externalversions/notification/v2/dingtalkreceiver.go create mode 100644 pkg/client/informers/externalversions/notification/v2/emailconfig.go create mode 100644 pkg/client/informers/externalversions/notification/v2/emailreceiver.go create mode 100644 pkg/client/informers/externalversions/notification/v2/interface.go create mode 100644 pkg/client/informers/externalversions/notification/v2/slackconfig.go create mode 100644 pkg/client/informers/externalversions/notification/v2/slackreceiver.go create mode 100644 pkg/client/informers/externalversions/notification/v2/webhookconfig.go create mode 100644 pkg/client/informers/externalversions/notification/v2/webhookreceiver.go create mode 100644 pkg/client/informers/externalversions/notification/v2/wechatconfig.go create mode 100644 pkg/client/informers/externalversions/notification/v2/wechatreceiver.go create mode 100644 pkg/client/listers/notification/v2/dingtalkconfig.go create mode 100644 pkg/client/listers/notification/v2/dingtalkreceiver.go create mode 100644 pkg/client/listers/notification/v2/emailconfig.go create mode 100644 pkg/client/listers/notification/v2/emailreceiver.go create mode 100644 pkg/client/listers/notification/v2/expansion_generated.go create mode 100644 pkg/client/listers/notification/v2/slackconfig.go create mode 100644 pkg/client/listers/notification/v2/slackreceiver.go create mode 100644 pkg/client/listers/notification/v2/webhookconfig.go create mode 100644 pkg/client/listers/notification/v2/webhookreceiver.go create mode 100644 pkg/client/listers/notification/v2/wechatconfig.go create mode 100644 pkg/client/listers/notification/v2/wechatreceiver.go create mode 100644 pkg/controller/notification/notification_controller.go create mode 100644 pkg/controller/notification/notification_controller_suite_test.go create mode 100644 pkg/controller/notification/notification_controller_test.go create mode 100644 pkg/kapis/notification/v2/handler.go create mode 100644 pkg/kapis/notification/v2/register.go create mode 100644 pkg/models/notification/notification.go create mode 100644 pkg/models/notification/notification_test.go create mode 100644 pkg/models/resources/v1alpha3/notification/notification.go create mode 100644 pkg/models/resources/v1alpha3/notification/notification_test.go create mode 100644 pkg/models/resources/v1alpha3/secret/secrets.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/cache/informertest/fake_cache.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/doc.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/doc.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/testing.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/unconventionallisttypecrd.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/util.go create mode 100644 vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go diff --git a/cmd/controller-manager/app/controllers.go b/cmd/controller-manager/app/controllers.go index d792f5928..0b1fb520f 100644 --- a/cmd/controller-manager/app/controllers.go +++ b/cmd/controller-manager/app/controllers.go @@ -37,6 +37,7 @@ import ( "kubesphere.io/kubesphere/pkg/controller/network/ippool" "kubesphere.io/kubesphere/pkg/controller/network/nsnetworkpolicy" "kubesphere.io/kubesphere/pkg/controller/network/nsnetworkpolicy/provider" + "kubesphere.io/kubesphere/pkg/controller/notification" "kubesphere.io/kubesphere/pkg/controller/pipeline" "kubesphere.io/kubesphere/pkg/controller/s2ibinary" "kubesphere.io/kubesphere/pkg/controller/s2irun" @@ -284,6 +285,11 @@ func addControllers( if multiClusterEnabled { controllers["globalrole-controller"] = globalRoleController + notificationController, err := notification.NewController(client.Kubernetes(), mgr.GetClient(), mgr.GetCache()) + if err != nil { + return err + } + controllers["notification-controller"] = notificationController } for name, ctrl := range controllers { diff --git a/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml b/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml new file mode 100644 index 000000000..f072525eb --- /dev/null +++ b/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml @@ -0,0 +1,83 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: dingtalkconfigs.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: DingTalkConfig + listKind: DingTalkConfigList + plural: dingtalkconfigs + shortNames: + - dc + singular: dingtalkconfig + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: DingTalkConfig is the Schema for the dingtalkconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: DingTalkConfigSpec defines the desired state of DingTalkConfig + properties: + conversation: + description: Only needed when send alerts to the conversation. + properties: + appkey: + description: The key of the application with which to send messages. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + appsecret: + description: The key in the secret to be used. Must be a valid secret key. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + type: object + status: + description: DingTalkConfigStatus defines the observed state of DingTalkConfig + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml b/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml new file mode 100644 index 000000000..e7a7a4d27 --- /dev/null +++ b/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml @@ -0,0 +1,158 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: dingtalkreceivers.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: DingTalkReceiver + listKind: DingTalkReceiverList + plural: dingtalkreceivers + shortNames: + - dr + singular: dingtalkreceiver + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: DingTalkReceiver is the Schema for the dingtalkreceivers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: DingTalkReceiverSpec defines the desired state of DingTalkReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + chatbot: + description: Be careful, a ChatBot only can send 20 message per minute. + properties: + keywords: + description: Custom keywords of ChatBot + items: + type: string + type: array + secret: + description: Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + webhook: + description: The webhook of ChatBot which the message will send to. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + required: + - webhook + type: object + conversation: + description: The conversation which message will send to. + properties: + chatid: + type: string + required: + - chatid + type: object + dingtalkConfigSelector: + description: DingTalkConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + status: + description: DingTalkReceiverStatus defines the observed state of DingTalkReceiver + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_emailconfigs.yaml b/config/crds/notification.kubesphere.io_emailconfigs.yaml new file mode 100644 index 000000000..1cf3d019d --- /dev/null +++ b/config/crds/notification.kubesphere.io_emailconfigs.yaml @@ -0,0 +1,167 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: emailconfigs.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: EmailConfig + listKind: EmailConfigList + plural: emailconfigs + shortNames: + - ec + singular: emailconfig + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: EmailConfig is the Schema for the emailconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: EmailConfigSpec defines the desired state of EmailConfig + properties: + authIdentify: + description: The identity for PLAIN authentication. + type: string + authPassword: + description: The secret contains the SMTP password for LOGIN and PLAIN authentications. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + authSecret: + description: The secret contains the SMTP secret for CRAM-MD5 authentication. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + authUsername: + description: The username for CRAM-MD5, LOGIN and PLAIN authentications. + type: string + from: + description: The sender address. + type: string + hello: + description: The hostname to use when identifying to the SMTP server. + type: string + requireTLS: + description: The default SMTP TLS requirement. + type: boolean + smartHost: + description: The address of the SMTP server. + properties: + host: + type: string + port: + type: string + required: + - host + - port + type: object + tls: + description: TLSConfig configures the options for TLS connections. + properties: + clientCertificate: + description: The certificate of the client. + properties: + cert: + description: The client cert file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + key: + description: The client key file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + insecureSkipVerify: + description: Disable target certificate validation. + type: boolean + rootCA: + description: RootCA defines the root certificate authorities that clients use when verifying server certificates. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + serverName: + description: Used to verify the hostname for the targets. + type: string + type: object + required: + - from + - smartHost + type: object + status: + description: EmailConfigStatus defines the observed state of EmailConfig + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_emailreceivers.yaml b/config/crds/notification.kubesphere.io_emailreceivers.yaml new file mode 100644 index 000000000..cc2c923b7 --- /dev/null +++ b/config/crds/notification.kubesphere.io_emailreceivers.yaml @@ -0,0 +1,116 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: emailreceivers.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: EmailReceiver + listKind: EmailReceiverList + plural: emailreceivers + shortNames: + - er + singular: emailreceiver + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: EmailReceiver is the Schema for the emailreceivers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: EmailReceiverSpec defines the desired state of EmailReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + emailConfigSelector: + description: EmailConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + to: + description: Receivers' email addresses + items: + type: string + type: array + required: + - to + type: object + status: + description: EmailReceiverStatus defines the observed state of EmailReceiver + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_notificationmanagers.yaml b/config/crds/notification.kubesphere.io_notificationmanagers.yaml new file mode 100644 index 000000000..395a0e5d8 --- /dev/null +++ b/config/crds/notification.kubesphere.io_notificationmanagers.yaml @@ -0,0 +1,1519 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: notificationmanagers.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: NotificationManager + listKind: NotificationManagerList + plural: notificationmanagers + shortNames: + - nm + singular: notificationmanager + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: NotificationManager is the Schema for the notificationmanagers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: NotificationManagerSpec defines the desired state of NotificationManager + properties: + affinity: + description: Pod's scheduling constraints. + properties: + nodeAffinity: + description: Describes node affinity scheduling rules for the pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred. + items: + description: An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated with the corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements by node's labels. + items: + description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: The label key that the selector applies to. + type: string + operator: + description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements by node's fields. + items: + description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: The label key that the selector applies to. + type: string + operator: + description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + weight: + description: Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. The terms are ORed. + items: + description: A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements by node's labels. + items: + description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: The label key that the selector applies to. + type: string + operator: + description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements by node's fields. + items: + description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: The label key that the selector applies to. + type: string + operator: + description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + type: array + required: + - nodeSelectorTerms + type: object + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + namespaces: + description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching the corresponding podAffinityTerm, in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + namespaces: + description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + namespaces: + description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching the corresponding podAffinityTerm, in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + namespaces: + description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + args: + description: 'Arguments to the entrypoint. The docker image''s CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container''s environment. If a variable cannot be resolved, the reference in the input string will remain unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated.' + items: + type: string + type: array + defaultConfigSelector: + description: Default Email/Wechat/Slack/Webhook Config to be selected + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + image: + description: Docker Image used to start Notification Manager container, for example kubesphere/notification-manager:v0.1.0 + type: string + imagePullPolicy: + description: Image pull policy. One of Always, Never, IfNotPresent. Defaults to IfNotPresent if not specified + type: string + nodeSelector: + additionalProperties: + type: string + description: Define which Nodes the Pods will be scheduled to. + type: object + portName: + description: Port name used for the pods and service, defaults to webhook + type: string + receivers: + description: Receivers to send notifications to + properties: + globalReceiverSelector: + description: Selector to find global notification receivers which will be used when tenant receivers cannot be found. Only matchLabels expression is allowed. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + options: + description: Various receiver options + properties: + dingtalk: + properties: + chatBotThrottle: + description: The flow control fo chatbot. + properties: + maxWaitTime: + description: The maximum tolerable waiting time when the calls trigger flow control, if the actual waiting time is more than this time, it will return a error, else it will wait for the flow restriction lifted, and send the message. Nil means do not wait, the maximum value is `Unit`. + format: int64 + type: integer + threshold: + description: The maximum calls in `Unit`. + type: integer + unit: + description: A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years. + format: int64 + type: integer + type: object + chatbotMessageMaxSize: + description: The maximum message size that can be sent to chatbot in a request. + type: integer + conversationMessageMaxSize: + description: The maximum message size that can be sent to conversation in a request. + type: integer + conversationThrottle: + description: The flow control fo conversation. + properties: + maxWaitTime: + description: The maximum tolerable waiting time when the calls trigger flow control, if the actual waiting time is more than this time, it will return a error, else it will wait for the flow restriction lifted, and send the message. Nil means do not wait, the maximum value is `Unit`. + format: int64 + type: integer + threshold: + description: The maximum calls in `Unit`. + type: integer + unit: + description: A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years. + format: int64 + type: integer + type: object + notificationTimeout: + description: Notification Sending Timeout + format: int32 + type: integer + template: + description: The name of the template to generate DingTalk message. If the global template is not set, it will use default. + type: string + tokenExpires: + description: The time of token expired. + format: int64 + type: integer + type: object + email: + properties: + deliveryType: + description: Type of sending email, bulk or single + type: string + maxEmailReceivers: + description: The maximum size of receivers in one email. + type: integer + notificationTimeout: + description: Notification Sending Timeout + format: int32 + type: integer + subjectTemplate: + description: The name of the template to generate email subject + type: string + template: + description: The name of the template to generate email message. If the global template is not set, it will use default. + type: string + type: object + global: + properties: + cluster: + description: The name of the cluster in which the notification manager is deployed. + type: string + template: + description: The name of the template to generate message. If the receiver dose not setup template, it will use this. + type: string + templateFile: + description: Template file path, must be a absolute path. + items: + type: string + type: array + type: object + slack: + properties: + notificationTimeout: + description: Notification Sending Timeout + format: int32 + type: integer + template: + description: The name of the template to generate slack message. If the global template is not set, it will use default. + type: string + type: object + webhook: + properties: + notificationTimeout: + description: Notification Sending Timeout + format: int32 + type: integer + template: + description: The name of the template to generate webhook message. If the global template is not set, it will use default. + type: string + type: object + wechat: + properties: + messageMaxSize: + description: The maximum message size that can be sent in a request. + type: integer + notificationTimeout: + description: Notification Sending Timeout + format: int32 + type: integer + template: + description: The name of the template to generate wechat message. + type: string + tokenExpires: + description: The time of token expired. + format: int64 + type: integer + type: object + type: object + tenantKey: + description: Key used to identify tenant, default to be "namespace" if not specified + type: string + tenantReceiverSelector: + description: Selector to find tenant notification receivers. Only matchLabels expression is allowed. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + required: + - globalReceiverSelector + - tenantKey + - tenantReceiverSelector + type: object + replicas: + description: Number of instances to deploy for Notification Manager deployment. + format: int32 + type: integer + resources: + description: Compute Resources required by container. + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + type: object + type: object + serviceAccountName: + description: ServiceAccountName is the name of the ServiceAccount to use to run Notification Manager Pods. ServiceAccount 'default' in notification manager's namespace will be used if not specified. + type: string + tolerations: + description: Pod's tolerations. + items: + description: The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . + properties: + effect: + description: Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + description: Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category. + type: string + tolerationSeconds: + description: TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's filesystem. Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume within a container. + properties: + mountPath: + description: Path within the container at which the volume should be mounted. Must not contain ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false. + type: boolean + subPath: + description: Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + volumes: + description: List of volumes that can be mounted by containers belonging to the pod. + items: + description: Volume represents a named volume in a pod that may be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: 'AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet''s host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + properties: + fsType: + description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore TODO: how do we prevent errors in the filesystem from compromising the machine' + type: string + partition: + description: 'The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).' + format: int32 + type: integer + readOnly: + description: 'Specify "true" to force and set the ReadOnly property in VolumeMounts to "true". If omitted, the default is "false". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + type: boolean + volumeID: + description: 'Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + type: string + required: + - volumeID + type: object + azureDisk: + description: AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. + properties: + cachingMode: + description: 'Host Caching mode: None, Read Only, Read Write.' + type: string + diskName: + description: The Name of the data disk in the blob storage + type: string + diskURI: + description: The URI the data disk in the blob storage + type: string + fsType: + description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + kind: + description: 'Expected values Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared' + type: string + readOnly: + description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: AzureFile represents an Azure File Service mount on the host and bind mount to the pod. + properties: + readOnly: + description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + type: boolean + secretName: + description: the name of secret that contains Azure Storage Account Name and Key + type: string + shareName: + description: Share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: CephFS represents a Ceph FS mount on the host that shares a pod's lifetime + properties: + monitors: + description: 'Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + items: + type: string + type: array + path: + description: 'Optional: Used as the mounted root, rather than the full Ceph tree, default is /' + type: string + readOnly: + description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + type: boolean + secretFile: + description: 'Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + type: string + secretRef: + description: 'Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + user: + description: 'Optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + type: string + required: + - monitors + type: object + cinder: + description: 'Cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + properties: + fsType: + description: 'Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + type: string + readOnly: + description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + type: boolean + secretRef: + description: 'Optional: points to a secret object containing parameters used to connect to OpenStack.' + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + volumeID: + description: 'volume id used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + type: string + required: + - volumeID + type: object + configMap: + description: ConfigMap represents a configMap that should populate this volume + properties: + defaultMode: + description: 'Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + items: + description: If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: The key to project. + type: string + mode: + description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + path: + description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap or its keys must be defined + type: boolean + type: object + csi: + description: CSI (Container Storage Interface) represents storage that is handled by an external CSI driver (Alpha feature). + properties: + driver: + description: Driver is the name of the CSI driver that handles this volume. Consult with your admin for the correct name as registered in the cluster. + type: string + fsType: + description: Filesystem type to mount. Ex. "ext4", "xfs", "ntfs". If not provided, the empty value is passed to the associated CSI driver which will determine the default filesystem to apply. + type: string + nodePublishSecretRef: + description: NodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + readOnly: + description: Specifies a read-only configuration for the volume. Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: VolumeAttributes stores driver-specific properties that are passed to the CSI driver. Consult your driver's documentation for supported values. + type: object + required: + - driver + type: object + downwardAPI: + description: DownwardAPI represents downward API about the pod that should populate this volume + properties: + defaultMode: + description: 'Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + items: + description: Items is a list of downward API volume file + items: + description: DownwardAPIVolumeFile represents information to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the pod: only annotations, labels, name and namespace are supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the specified API version. + type: string + required: + - fieldPath + type: object + mode: + description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + path: + description: 'Required: Path is the relative path name of the file to be created. Must not be absolute or contain the ''..'' path. Must be utf-8 encoded. The first item of the relative path must not start with ''..''' + type: string + resourceFieldRef: + description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + required: + - path + type: object + type: array + type: object + emptyDir: + description: 'EmptyDir represents a temporary directory that shares a pod''s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + properties: + medium: + description: 'What type of storage medium should back this directory. The default is "" which means to use the node''s default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: 'Total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + fc: + description: FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. + properties: + fsType: + description: 'Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. TODO: how do we prevent errors in the filesystem from compromising the machine' + type: string + lun: + description: 'Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.' + type: boolean + targetWWNs: + description: 'Optional: FC target worldwide names (WWNs)' + items: + type: string + type: array + wwids: + description: 'Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.' + items: + type: string + type: array + type: object + flexVolume: + description: FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. + properties: + driver: + description: Driver is the name of the driver to use for this volume. + type: string + fsType: + description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'Optional: Extra command options if any.' + type: object + readOnly: + description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.' + type: boolean + secretRef: + description: 'Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.' + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + required: + - driver + type: object + flocker: + description: Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running + properties: + datasetName: + description: Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated + type: string + datasetUUID: + description: UUID of the dataset. This is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: 'GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet''s host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + properties: + fsType: + description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk TODO: how do we prevent errors in the filesystem from compromising the machine' + type: string + partition: + description: 'The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + format: int32 + type: integer + pdName: + description: 'Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + type: string + readOnly: + description: 'ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + type: boolean + required: + - pdName + type: object + gitRepo: + description: 'GitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod''s container.' + properties: + directory: + description: Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. + type: string + repository: + description: Repository URL + type: string + revision: + description: Commit hash for the specified revision. + type: string + required: + - repository + type: object + glusterfs: + description: 'Glusterfs represents a Glusterfs mount on the host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md' + properties: + endpoints: + description: 'EndpointsName is the endpoint name that details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + type: string + path: + description: 'Path is the Glusterfs volume path. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + type: string + readOnly: + description: 'ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: 'HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath --- TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not mount host directories as read/write.' + properties: + path: + description: 'Path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + type: string + type: + description: 'Type for HostPath Volume Defaults to "" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + type: string + required: + - path + type: object + iscsi: + description: 'ISCSI represents an ISCSI Disk resource that is attached to a kubelet''s host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md' + properties: + chapAuthDiscovery: + description: whether support iSCSI Discovery CHAP authentication + type: boolean + chapAuthSession: + description: whether support iSCSI Session CHAP authentication + type: boolean + fsType: + description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi TODO: how do we prevent errors in the filesystem from compromising the machine' + type: string + initiatorName: + description: Custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection. + type: string + iqn: + description: Target iSCSI Qualified Name. + type: string + iscsiInterface: + description: iSCSI Interface Name that uses an iSCSI transport. Defaults to 'default' (tcp). + type: string + lun: + description: iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + items: + type: string + type: array + readOnly: + description: ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. + type: boolean + secretRef: + description: CHAP Secret for iSCSI target and initiator authentication + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + targetPortal: + description: iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: 'Volume''s name. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + nfs: + description: 'NFS represents an NFS mount on the host that shares a pod''s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + properties: + path: + description: 'Path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + type: string + readOnly: + description: 'ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + type: boolean + server: + description: 'Server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: 'PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + properties: + claimName: + description: 'ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + type: string + readOnly: + description: Will force the ReadOnly setting in VolumeMounts. Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine + properties: + fsType: + description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + pdID: + description: ID that identifies Photon Controller persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: PortworxVolume represents a portworx volume attached and mounted on kubelets host machine + properties: + fsType: + description: FSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + type: boolean + volumeID: + description: VolumeID uniquely identifies a Portworx volume + type: string + required: + - volumeID + type: object + projected: + description: Items for all in one resources secrets, configmaps, and downward API + properties: + defaultMode: + description: Mode bits to use on created files by default. Must be a value between 0 and 0777. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + sources: + description: list of volume projections + items: + description: Projection that may be projected along with other supported volume types + properties: + configMap: + description: information about the configMap data to project + properties: + items: + description: If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: The key to project. + type: string + mode: + description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + path: + description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap or its keys must be defined + type: boolean + type: object + downwardAPI: + description: information about the downwardAPI data to project + properties: + items: + description: Items is a list of DownwardAPIVolume file + items: + description: DownwardAPIVolumeFile represents information to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the pod: only annotations, labels, name and namespace are supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the specified API version. + type: string + required: + - fieldPath + type: object + mode: + description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + path: + description: 'Required: Path is the relative path name of the file to be created. Must not be absolute or contain the ''..'' path. Must be utf-8 encoded. The first item of the relative path must not start with ''..''' + type: string + resourceFieldRef: + description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + required: + - path + type: object + type: array + type: object + secret: + description: information about the secret data to project + properties: + items: + description: If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: The key to project. + type: string + mode: + description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + path: + description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret or its key must be defined + type: boolean + type: object + serviceAccountToken: + description: information about the serviceAccountToken data to project + properties: + audience: + description: Audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver. + type: string + expirationSeconds: + description: ExpirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes. + format: int64 + type: integer + path: + description: Path is the path relative to the mount point of the file to project the token into. + type: string + required: + - path + type: object + type: object + type: array + required: + - sources + type: object + quobyte: + description: Quobyte represents a Quobyte mount on the host that shares a pod's lifetime + properties: + group: + description: Group to map volume access to Default is no group + type: string + readOnly: + description: ReadOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false. + type: boolean + registry: + description: Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes + type: string + tenant: + description: Tenant owning the given Quobyte volume in the Backend Used with dynamically provisioned Quobyte volumes, value is set by the plugin + type: string + user: + description: User to map volume access to Defaults to serivceaccount user + type: string + volume: + description: Volume is a string that references an already created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: 'RBD represents a Rados Block Device mount on the host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md' + properties: + fsType: + description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd TODO: how do we prevent errors in the filesystem from compromising the machine' + type: string + image: + description: 'The rados image name. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + keyring: + description: 'Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + monitors: + description: 'A collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + items: + type: string + type: array + pool: + description: 'The rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + readOnly: + description: 'ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: boolean + secretRef: + description: 'SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + user: + description: 'The rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + type: string + required: + - image + - monitors + type: object + scaleIO: + description: ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. + properties: + fsType: + description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs". + type: string + gateway: + description: The host address of the ScaleIO API Gateway. + type: string + protectionDomain: + description: The name of the ScaleIO Protection Domain for the configured storage. + type: string + readOnly: + description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + sslEnabled: + description: Flag to enable/disable SSL communication with Gateway, default false + type: boolean + storageMode: + description: Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. + type: string + storagePool: + description: The ScaleIO Storage Pool associated with the protection domain. + type: string + system: + description: The name of the storage system as configured in ScaleIO. + type: string + volumeName: + description: The name of a volume already created in the ScaleIO system that is associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: 'Secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + properties: + defaultMode: + description: 'Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + items: + description: If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: The key to project. + type: string + mode: + description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' + format: int32 + type: integer + path: + description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + optional: + description: Specify whether the Secret or its keys must be defined + type: boolean + secretName: + description: 'Name of the secret in the pod''s namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + type: string + type: object + storageos: + description: StorageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. + properties: + fsType: + description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + volumeName: + description: VolumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace. + type: string + volumeNamespace: + description: VolumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to "default" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine + properties: + fsType: + description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: Storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName. + type: string + storagePolicyName: + description: Storage Policy Based Management (SPBM) profile name. + type: string + volumePath: + description: Path that identifies vSphere volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + required: + - receivers + type: object + status: + description: NotificationManagerStatus defines the observed state of NotificationManager + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_slackconfigs.yaml b/config/crds/notification.kubesphere.io_slackconfigs.yaml new file mode 100644 index 000000000..58770ef38 --- /dev/null +++ b/config/crds/notification.kubesphere.io_slackconfigs.yaml @@ -0,0 +1,64 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: slackconfigs.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: SlackConfig + listKind: SlackConfigList + plural: slackconfigs + shortNames: + - sc + singular: slackconfig + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: SlackConfig is the Schema for the slackconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: SlackConfigSpec defines the desired state of SlackConfig + properties: + slackTokenSecret: + description: The token of user or bot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + status: + description: SlackConfigStatus defines the observed state of SlackConfig + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_slackreceivers.yaml b/config/crds/notification.kubesphere.io_slackreceivers.yaml new file mode 100644 index 000000000..ea61fbeb2 --- /dev/null +++ b/config/crds/notification.kubesphere.io_slackreceivers.yaml @@ -0,0 +1,114 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: slackreceivers.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: SlackReceiver + listKind: SlackReceiverList + plural: slackreceivers + shortNames: + - sr + singular: slackreceiver + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: SlackReceiver is the Schema for the slackreceivers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: SlackReceiverSpec defines the desired state of SlackReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + channel: + description: The channel or user to send notifications to. + type: string + slackConfigSelector: + description: SlackConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + required: + - channel + type: object + status: + description: SlackReceiverStatus defines the observed state of SlackReceiver + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_webhookconfigs.yaml b/config/crds/notification.kubesphere.io_webhookconfigs.yaml new file mode 100644 index 000000000..f2ec846f8 --- /dev/null +++ b/config/crds/notification.kubesphere.io_webhookconfigs.yaml @@ -0,0 +1,48 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: webhookconfigs.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: WebhookConfig + listKind: WebhookConfigList + plural: webhookconfigs + shortNames: + - wc + singular: webhookconfig + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: WebhookConfig is the Schema for the webhookconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WebhookConfigSpec defines the desired state of WebhookConfig + type: object + status: + description: WebhookConfigStatus defines the observed state of WebhookConfig + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_webhookreceivers.yaml b/config/crds/notification.kubesphere.io_webhookreceivers.yaml new file mode 100644 index 000000000..1952eec6a --- /dev/null +++ b/config/crds/notification.kubesphere.io_webhookreceivers.yaml @@ -0,0 +1,239 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: webhookreceivers.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: WebhookReceiver + listKind: WebhookReceiverList + plural: webhookreceivers + shortNames: + - wr + singular: webhookreceiver + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: WebhookReceiver is the Schema for the webhookreceivers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WebhookReceiverSpec defines the desired state of WebhookReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + httpConfig: + description: HTTPClientConfig configures an HTTP client. + properties: + basicAuth: + description: The HTTP basic authentication credentials for the targets. + properties: + password: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + username: + type: string + required: + - username + type: object + bearerToken: + description: The bearer token for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + proxyUrl: + description: HTTP proxy server to use to connect to the targets. + type: string + tlsConfig: + description: TLSConfig to use to connect to the targets. + properties: + clientCertificate: + description: The certificate of the client. + properties: + cert: + description: The client cert file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + key: + description: The client key file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + insecureSkipVerify: + description: Disable target certificate validation. + type: boolean + rootCA: + description: RootCA defines the root certificate authorities that clients use when verifying server certificates. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + serverName: + description: Used to verify the hostname for the targets. + type: string + type: object + type: object + service: + description: "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified. \n If the webhook is running within the cluster, then you should use `service`." + properties: + name: + description: '`name` is the name of the service. Required' + type: string + namespace: + description: '`namespace` is the namespace of the service. Required' + type: string + path: + description: '`path` is an optional URL path which will be sent in any request to this service.' + type: string + port: + description: If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + format: int32 + type: integer + scheme: + description: Http scheme, default is http. + type: string + required: + - name + - namespace + type: object + url: + description: "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. \n The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some api servers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. \n Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. \n A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. \n Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either." + type: string + webhookConfigSelector: + description: WebhookConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + status: + description: WebhookReceiverStatus defines the observed state of WebhookReceiver + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_wechatconfigs.yaml b/config/crds/notification.kubesphere.io_wechatconfigs.yaml new file mode 100644 index 000000000..3d73baadd --- /dev/null +++ b/config/crds/notification.kubesphere.io_wechatconfigs.yaml @@ -0,0 +1,77 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: wechatconfigs.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: WechatConfig + listKind: WechatConfigList + plural: wechatconfigs + shortNames: + - wcc + singular: wechatconfig + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: WechatConfig is the Schema for the wechatconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WechatConfigSpec defines the desired state of WechatConfig + properties: + wechatApiAgentId: + description: The id of the application which sending message. + type: string + wechatApiCorpId: + description: The corp id for authentication. + type: string + wechatApiSecret: + description: The API key to use when talking to the WeChat API. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + wechatApiUrl: + description: The WeChat API URL. + type: string + required: + - wechatApiAgentId + - wechatApiCorpId + - wechatApiSecret + type: object + status: + description: WechatConfigStatus defines the observed state of WechatConfig + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_wechatreceivers.yaml b/config/crds/notification.kubesphere.io_wechatreceivers.yaml new file mode 100644 index 000000000..7f3ab488a --- /dev/null +++ b/config/crds/notification.kubesphere.io_wechatreceivers.yaml @@ -0,0 +1,115 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: wechatreceivers.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + kind: WechatReceiver + listKind: WechatReceiverList + plural: wechatreceivers + shortNames: + - wcr + singular: wechatreceiver + scope: Cluster + versions: + - name: v2 + schema: + openAPIV3Schema: + description: WechatReceiver is the Schema for the wechatreceivers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WechatReceiverSpec defines the desired state of WechatReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + toParty: + type: string + toTag: + type: string + toUser: + type: string + wechatConfigSelector: + description: WechatConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + status: + description: WechatReceiverStatus defines the observed state of WechatReceiver + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federateddingtalkconfigs.yaml b/config/crds/types.kubefed.io_federateddingtalkconfigs.yaml new file mode 100644 index 000000000..e8b50001c --- /dev/null +++ b/config/crds/types.kubefed.io_federateddingtalkconfigs.yaml @@ -0,0 +1,197 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federateddingtalkconfigs.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedDingTalkConfig + listKind: FederatedDingTalkConfigList + plural: federateddingtalkconfigs + singular: federateddingtalkconfig + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: DingTalkConfigSpec defines the desired state of DingTalkConfig + properties: + conversation: + description: Only needed when send alerts to the conversation. + properties: + appkey: + description: The key of the application with which to send messages. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + appsecret: + description: The key in the secret to be used. Must be a valid secret key. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federateddingtalkreceivers.yaml b/config/crds/types.kubefed.io_federateddingtalkreceivers.yaml new file mode 100644 index 000000000..17dc9dd26 --- /dev/null +++ b/config/crds/types.kubefed.io_federateddingtalkreceivers.yaml @@ -0,0 +1,272 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federateddingtalkreceivers.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedDingTalkReceiver + listKind: FederatedDingTalkReceiverList + plural: federateddingtalkreceivers + singular: federateddingtalkreceiver + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: DingTalkReceiverSpec defines the desired state of DingTalkReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + chatbot: + description: Be careful, a ChatBot only can send 20 message per minute. + properties: + keywords: + description: Custom keywords of ChatBot + items: + type: string + type: array + secret: + description: Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + webhook: + description: The webhook of ChatBot which the message will send to. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + required: + - webhook + type: object + conversation: + description: The conversation which message will send to. + properties: + chatid: + type: string + required: + - chatid + type: object + dingtalkConfigSelector: + description: DingTalkConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedemailconfigs.yaml b/config/crds/types.kubefed.io_federatedemailconfigs.yaml new file mode 100644 index 000000000..fc313865c --- /dev/null +++ b/config/crds/types.kubefed.io_federatedemailconfigs.yaml @@ -0,0 +1,281 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedemailconfigs.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedEmailConfig + listKind: FederatedEmailConfigList + plural: federatedemailconfigs + singular: federatedemailconfig + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: EmailConfigSpec defines the desired state of EmailConfig + properties: + authIdentify: + description: The identity for PLAIN authentication. + type: string + authPassword: + description: The secret contains the SMTP password for LOGIN and PLAIN authentications. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + authSecret: + description: The secret contains the SMTP secret for CRAM-MD5 authentication. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + authUsername: + description: The username for CRAM-MD5, LOGIN and PLAIN authentications. + type: string + from: + description: The sender address. + type: string + hello: + description: The hostname to use when identifying to the SMTP server. + type: string + requireTLS: + description: The default SMTP TLS requirement. + type: boolean + smartHost: + description: The address of the SMTP server. + properties: + host: + type: string + port: + type: string + required: + - host + - port + type: object + tls: + description: TLSConfig configures the options for TLS connections. + properties: + clientCertificate: + description: The certificate of the client. + properties: + cert: + description: The client cert file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + key: + description: The client key file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + insecureSkipVerify: + description: Disable target certificate validation. + type: boolean + rootCA: + description: RootCA defines the root certificate authorities that clients use when verifying server certificates. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + serverName: + description: Used to verify the hostname for the targets. + type: string + type: object + required: + - from + - smartHost + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedemailreceivers.yaml b/config/crds/types.kubefed.io_federatedemailreceivers.yaml new file mode 100644 index 000000000..5a6ab177f --- /dev/null +++ b/config/crds/types.kubefed.io_federatedemailreceivers.yaml @@ -0,0 +1,230 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedemailreceivers.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedEmailReceiver + listKind: FederatedEmailReceiverList + plural: federatedemailreceivers + singular: federatedemailreceiver + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: EmailReceiverSpec defines the desired state of EmailReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + emailConfigSelector: + description: EmailConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + to: + description: Receivers' email addresses + items: + type: string + type: array + required: + - to + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatednamespaces.yaml b/config/crds/types.kubefed.io_federatednamespaces.yaml new file mode 100644 index 000000000..84dd1e61d --- /dev/null +++ b/config/crds/types.kubefed.io_federatednamespaces.yaml @@ -0,0 +1,164 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatednamespaces.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedNamespace + listKind: FederatedNamespaceList + plural: federatednamespaces + singular: federatednamespace + scope: Namespaced + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + spec: + description: NamespaceSpec describes the attributes on a Namespace. + properties: + finalizers: + description: 'Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/' + items: + description: FinalizerName is the name identifying a finalizer during namespace lifecycle. + type: string + type: array + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedsecrets.yaml b/config/crds/types.kubefed.io_federatedsecrets.yaml new file mode 100644 index 000000000..a5fd549d1 --- /dev/null +++ b/config/crds/types.kubefed.io_federatedsecrets.yaml @@ -0,0 +1,165 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedsecrets.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedSecret + listKind: FederatedSecretList + plural: federatedsecrets + singular: federatedsecret + scope: Namespaced + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + data: + additionalProperties: + format: byte + type: string + type: object + stringData: + additionalProperties: + type: string + type: object + type: + type: string + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedslackconfigs.yaml b/config/crds/types.kubefed.io_federatedslackconfigs.yaml new file mode 100644 index 000000000..8dc8e4670 --- /dev/null +++ b/config/crds/types.kubefed.io_federatedslackconfigs.yaml @@ -0,0 +1,178 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedslackconfigs.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedSlackConfig + listKind: FederatedSlackConfigList + plural: federatedslackconfigs + singular: federatedslackconfig + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: SlackConfigSpec defines the desired state of SlackConfig + properties: + slackTokenSecret: + description: The token of user or bot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedslackreceivers.yaml b/config/crds/types.kubefed.io_federatedslackreceivers.yaml new file mode 100644 index 000000000..8d3b96aa4 --- /dev/null +++ b/config/crds/types.kubefed.io_federatedslackreceivers.yaml @@ -0,0 +1,228 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedslackreceivers.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedSlackReceiver + listKind: FederatedSlackReceiverList + plural: federatedslackreceivers + singular: federatedslackreceiver + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: SlackReceiverSpec defines the desired state of SlackReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + channel: + description: The channel or user to send notifications to. + type: string + slackConfigSelector: + description: SlackConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + required: + - channel + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwebhookconfigs.yaml b/config/crds/types.kubefed.io_federatedwebhookconfigs.yaml new file mode 100644 index 000000000..7aa41d602 --- /dev/null +++ b/config/crds/types.kubefed.io_federatedwebhookconfigs.yaml @@ -0,0 +1,162 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedwebhookconfigs.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedWebhookConfig + listKind: FederatedWebhookConfigList + plural: federatedwebhookconfigs + singular: federatedwebhookconfig + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: WebhookConfigSpec defines the desired state of WebhookConfig + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwebhookreceivers.yaml b/config/crds/types.kubefed.io_federatedwebhookreceivers.yaml new file mode 100644 index 000000000..d3101cd95 --- /dev/null +++ b/config/crds/types.kubefed.io_federatedwebhookreceivers.yaml @@ -0,0 +1,353 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedwebhookreceivers.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedWebhookReceiver + listKind: FederatedWebhookReceiverList + plural: federatedwebhookreceivers + singular: federatedwebhookreceiver + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: WebhookReceiverSpec defines the desired state of WebhookReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + httpConfig: + description: HTTPClientConfig configures an HTTP client. + properties: + basicAuth: + description: The HTTP basic authentication credentials for the targets. + properties: + password: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + username: + type: string + required: + - username + type: object + bearerToken: + description: The bearer token for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + proxyUrl: + description: HTTP proxy server to use to connect to the targets. + type: string + tlsConfig: + description: TLSConfig to use to connect to the targets. + properties: + clientCertificate: + description: The certificate of the client. + properties: + cert: + description: The client cert file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + key: + description: The client key file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + insecureSkipVerify: + description: Disable target certificate validation. + type: boolean + rootCA: + description: RootCA defines the root certificate authorities that clients use when verifying server certificates. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + serverName: + description: Used to verify the hostname for the targets. + type: string + type: object + type: object + service: + description: "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified. \n If the webhook is running within the cluster, then you should use `service`." + properties: + name: + description: '`name` is the name of the service. Required' + type: string + namespace: + description: '`namespace` is the namespace of the service. Required' + type: string + path: + description: '`path` is an optional URL path which will be sent in any request to this service.' + type: string + port: + description: If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + format: int32 + type: integer + scheme: + description: Http scheme, default is http. + type: string + required: + - name + - namespace + type: object + url: + description: "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. \n The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some api servers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. \n Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. \n A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. \n Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either." + type: string + webhookConfigSelector: + description: WebhookConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwechatconfigs.yaml b/config/crds/types.kubefed.io_federatedwechatconfigs.yaml new file mode 100644 index 000000000..57c4bda00 --- /dev/null +++ b/config/crds/types.kubefed.io_federatedwechatconfigs.yaml @@ -0,0 +1,191 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedwechatconfigs.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedWechatConfig + listKind: FederatedWechatConfigList + plural: federatedwechatconfigs + singular: federatedwechatconfig + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: WechatConfigSpec defines the desired state of WechatConfig + properties: + wechatApiAgentId: + description: The id of the application which sending message. + type: string + wechatApiCorpId: + description: The corp id for authentication. + type: string + wechatApiSecret: + description: The API key to use when talking to the WeChat API. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + wechatApiUrl: + description: The WeChat API URL. + type: string + required: + - wechatApiAgentId + - wechatApiCorpId + - wechatApiSecret + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwechatreceivers.yaml b/config/crds/types.kubefed.io_federatedwechatreceivers.yaml new file mode 100644 index 000000000..ae9d3a3a1 --- /dev/null +++ b/config/crds/types.kubefed.io_federatedwechatreceivers.yaml @@ -0,0 +1,229 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatedwechatreceivers.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedWechatReceiver + listKind: FederatedWechatReceiverList + plural: federatedwechatreceivers + singular: federatedwechatreceiver + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: WechatReceiverSpec defines the desired state of WechatReceiver + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + toParty: + type: string + toTag: + type: string + toUser: + type: string + wechatConfigSelector: + description: WechatConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/hack/generate_client.sh b/hack/generate_client.sh index 9fc15dc03..ceca0445a 100755 --- a/hack/generate_client.sh +++ b/hack/generate_client.sh @@ -2,7 +2,6 @@ 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" rm -rf ./pkg/client diff --git a/pkg/apis/addtoscheme_notification_v2.go b/pkg/apis/addtoscheme_notification_v2.go new file mode 100644 index 000000000..541238481 --- /dev/null +++ b/pkg/apis/addtoscheme_notification_v2.go @@ -0,0 +1,25 @@ +/* +Copyright 2019 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apis + +import ( + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +func init() { + AddToSchemes = append(AddToSchemes, v2.SchemeBuilder.AddToScheme) +} diff --git a/pkg/apis/notification/group.go b/pkg/apis/notification/group.go new file mode 100644 index 000000000..699e849a4 --- /dev/null +++ b/pkg/apis/notification/group.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package auditing contains auditing API versions +package notification diff --git a/pkg/apis/notification/v2/dingtalkconfig_types.go b/pkg/apis/notification/v2/dingtalkconfig_types.go new file mode 100644 index 000000000..cd630c158 --- /dev/null +++ b/pkg/apis/notification/v2/dingtalkconfig_types.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Configuration of conversation +type DingTalkApplicationConfig struct { + // The key of the application with which to send messages. + AppKey *SecretKeySelector `json:"appkey,omitempty"` + // The key in the secret to be used. Must be a valid secret key. + AppSecret *SecretKeySelector `json:"appsecret,omitempty"` +} + +// DingTalkConfigSpec defines the desired state of DingTalkConfig +type DingTalkConfigSpec struct { + // Only needed when send alerts to the conversation. + Conversation *DingTalkApplicationConfig `json:"conversation,omitempty"` +} + +// DingTalkConfigStatus defines the observed state of DingTalkConfig +type DingTalkConfigStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=dc +// +genclient +// +genclient:nonNamespaced +// DingTalkConfig is the Schema for the dingtalkconfigs API +type DingTalkConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DingTalkConfigSpec `json:"spec,omitempty"` + Status DingTalkConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// DingTalkConfigList contains a list of DingTalkConfig +type DingTalkConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DingTalkConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DingTalkConfig{}, &DingTalkConfigList{}) +} diff --git a/pkg/apis/notification/v2/dingtalkreceiver_types.go b/pkg/apis/notification/v2/dingtalkreceiver_types.go new file mode 100644 index 000000000..9bc52095d --- /dev/null +++ b/pkg/apis/notification/v2/dingtalkreceiver_types.go @@ -0,0 +1,80 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Configuration of ChatBot +type DingTalkChatBot struct { + // The webhook of ChatBot which the message will send to. + Webhook *SecretKeySelector `json:"webhook"` + + // Custom keywords of ChatBot + Keywords []string `json:"keywords,omitempty"` + + // Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. + Secret *SecretKeySelector `json:"secret,omitempty"` +} + +// Configuration of conversation +type DingTalkConversation struct { + ChatID string `json:"chatid"` +} + +// DingTalkReceiverSpec defines the desired state of DingTalkReceiver +type DingTalkReceiverSpec struct { + // DingTalkConfig to be selected for this receiver + DingTalkConfigSelector *metav1.LabelSelector `json:"dingtalkConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // Be careful, a ChatBot only can send 20 message per minute. + ChatBot *DingTalkChatBot `json:"chatbot,omitempty"` + // The conversation which message will send to. + Conversation *DingTalkConversation `json:"conversation,omitempty"` +} + +// DingTalkReceiverStatus defines the observed state of DingTalkReceiver +type DingTalkReceiverStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=dr +// +genclient +// +genclient:nonNamespaced +// DingTalkReceiver is the Schema for the dingtalkreceivers API +type DingTalkReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DingTalkReceiverSpec `json:"spec,omitempty"` + Status DingTalkReceiverStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// DingTalkReceiverList contains a list of DingTalkReceiver +type DingTalkReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DingTalkReceiver `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DingTalkReceiver{}, &DingTalkReceiverList{}) +} diff --git a/pkg/apis/notification/v2/doc.go b/pkg/apis/notification/v2/doc.go new file mode 100644 index 000000000..383ff6b1c --- /dev/null +++ b/pkg/apis/notification/v2/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha1 contains API Schema definitions for the notification v2 API group +// +groupName=notification.kubesphere.io +// +genclient +// +genclient:nonNamespaced +package v2 diff --git a/pkg/apis/notification/v2/emailconfig_types.go b/pkg/apis/notification/v2/emailconfig_types.go new file mode 100644 index 000000000..b4035f8ad --- /dev/null +++ b/pkg/apis/notification/v2/emailconfig_types.go @@ -0,0 +1,77 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EmailConfigSpec defines the desired state of EmailConfig +type EmailConfigSpec struct { + // The sender address. + From string `json:"from"` + // The address of the SMTP server. + SmartHost HostPort `json:"smartHost"` + // The hostname to use when identifying to the SMTP server. + Hello *string `json:"hello,omitempty"` + // The username for CRAM-MD5, LOGIN and PLAIN authentications. + AuthUsername *string `json:"authUsername,omitempty"` + // The identity for PLAIN authentication. + AuthIdentify *string `json:"authIdentify,omitempty"` + // The secret contains the SMTP password for LOGIN and PLAIN authentications. + AuthPassword *SecretKeySelector `json:"authPassword,omitempty"` + // The secret contains the SMTP secret for CRAM-MD5 authentication. + AuthSecret *SecretKeySelector `json:"authSecret,omitempty"` + // The default SMTP TLS requirement. + RequireTLS *bool `json:"requireTLS,omitempty"` + TLS *TLSConfig `json:"tls,omitempty"` +} + +type HostPort struct { + Host string `json:"host"` + Port string `json:"port"` +} + +// EmailConfigStatus defines the observed state of EmailConfig +type EmailConfigStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=ec +// +genclient +// +genclient:nonNamespaced +// EmailConfig is the Schema for the emailconfigs API +type EmailConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec EmailConfigSpec `json:"spec,omitempty"` + Status EmailConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// EmailConfigList contains a list of EmailConfig +type EmailConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []EmailConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&EmailConfig{}, &EmailConfigList{}) +} diff --git a/pkg/apis/notification/v2/emailreceiver_types.go b/pkg/apis/notification/v2/emailreceiver_types.go new file mode 100644 index 000000000..497aac34c --- /dev/null +++ b/pkg/apis/notification/v2/emailreceiver_types.go @@ -0,0 +1,61 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EmailReceiverSpec defines the desired state of EmailReceiver +type EmailReceiverSpec struct { + // Receivers' email addresses + To []string `json:"to"` + // EmailConfig to be selected for this receiver + EmailConfigSelector *metav1.LabelSelector `json:"emailConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` +} + +// EmailReceiverStatus defines the observed state of EmailReceiver +type EmailReceiverStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=er +// +genclient +// +genclient:nonNamespaced +// EmailReceiver is the Schema for the emailreceivers API +type EmailReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec EmailReceiverSpec `json:"spec,omitempty"` + Status EmailReceiverStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// EmailReceiverList contains a list of EmailReceiver +type EmailReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []EmailReceiver `json:"items"` +} + +func init() { + SchemeBuilder.Register(&EmailReceiver{}, &EmailReceiverList{}) +} diff --git a/pkg/apis/notification/v2/notificationmanager_types.go b/pkg/apis/notification/v2/notificationmanager_types.go new file mode 100644 index 000000000..4deb6a736 --- /dev/null +++ b/pkg/apis/notification/v2/notificationmanager_types.go @@ -0,0 +1,210 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "time" +) + +// SecretKeySelector selects a key of a Secret. +type SecretKeySelector struct { + // The namespace of the secret, default to the pod's namespace. + // +optional + Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` + // Name of the secret. + // +optional + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + // The key of the secret to select from. Must be a valid secret key. + Key string `json:"key" protobuf:"bytes,2,opt,name=key"` +} + +// NotificationManagerSpec defines the desired state of NotificationManager +type NotificationManagerSpec struct { + // Compute Resources required by container. + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // Docker Image used to start Notification Manager container, + // for example kubesphere/notification-manager:v0.1.0 + Image *string `json:"image,omitempty"` + // Image pull policy. One of Always, Never, IfNotPresent. + // Defaults to IfNotPresent if not specified + ImagePullPolicy *v1.PullPolicy `json:"imagePullPolicy,omitempty"` + // Number of instances to deploy for Notification Manager deployment. + Replicas *int32 `json:"replicas,omitempty"` + // Define which Nodes the Pods will be scheduled to. + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // Pod's scheduling constraints. + Affinity *v1.Affinity `json:"affinity,omitempty"` + // Pod's tolerations. + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + // ServiceAccountName is the name of the ServiceAccount to use to run Notification Manager Pods. + // ServiceAccount 'default' in notification manager's namespace will be used if not specified. + ServiceAccountName string `json:"serviceAccountName,omitempty"` + // Port name used for the pods and service, defaults to webhook + PortName string `json:"portName,omitempty"` + // Default Email/Wechat/Slack/Webhook Config to be selected + DefaultConfigSelector *metav1.LabelSelector `json:"defaultConfigSelector,omitempty"` + // Receivers to send notifications to + Receivers *ReceiversSpec `json:"receivers"` + // List of volumes that can be mounted by containers belonging to the pod. + Volumes []v1.Volume `json:"volumes,omitempty"` + // Pod volumes to mount into the container's filesystem. + // Cannot be updated. + VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"` + // Arguments to the entrypoint. + // The docker image's CMD is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will remain unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // +optional + Args []string `json:"args,omitempty"` +} + +type ReceiversSpec struct { + // Key used to identify tenant, default to be "namespace" if not specified + TenantKey string `json:"tenantKey"` + // Selector to find global notification receivers + // which will be used when tenant receivers cannot be found. + // Only matchLabels expression is allowed. + GlobalReceiverSelector *metav1.LabelSelector `json:"globalReceiverSelector"` + // Selector to find tenant notification receivers. + // Only matchLabels expression is allowed. + TenantReceiverSelector *metav1.LabelSelector `json:"tenantReceiverSelector"` + // Various receiver options + Options *Options `json:"options,omitempty"` +} + +type GlobalOptions struct { + // Template file path, must be a absolute path. + TemplateFiles []string `json:"templateFile,omitempty"` + // The name of the template to generate message. + // If the receiver dose not setup template, it will use this. + Template string `json:"template,omitempty"` + // The name of the cluster in which the notification manager is deployed. + Cluster string `json:"cluster,omitempty"` +} + +type EmailOptions struct { + // Notification Sending Timeout + NotificationTimeout *int32 `json:"notificationTimeout,omitempty"` + // Type of sending email, bulk or single + DeliveryType string `json:"deliveryType,omitempty"` + // The maximum size of receivers in one email. + MaxEmailReceivers int `json:"maxEmailReceivers,omitempty"` + // The name of the template to generate email message. + // If the global template is not set, it will use default. + Template string `json:"template,omitempty"` + // The name of the template to generate email subject + SubjectTemplate string `json:"subjectTemplate,omitempty"` +} + +type WechatOptions struct { + // Notification Sending Timeout + NotificationTimeout *int32 `json:"notificationTimeout,omitempty"` + // The name of the template to generate wechat message. + Template string `json:"template,omitempty"` + // The maximum message size that can be sent in a request. + MessageMaxSize int `json:"messageMaxSize,omitempty"` + // The time of token expired. + TokenExpires time.Duration `json:"tokenExpires,omitempty"` +} + +type SlackOptions struct { + // Notification Sending Timeout + NotificationTimeout *int32 `json:"notificationTimeout,omitempty"` + // The name of the template to generate slack message. + // If the global template is not set, it will use default. + Template string `json:"template,omitempty"` +} + +type WebhookOptions struct { + // Notification Sending Timeout + NotificationTimeout *int32 `json:"notificationTimeout,omitempty"` + // The name of the template to generate webhook message. + // If the global template is not set, it will use default. + Template string `json:"template,omitempty"` +} + +// The config of flow control. +type Throttle struct { + // The maximum calls in `Unit`. + Threshold int `json:"threshold,omitempty"` + Unit time.Duration `json:"unit,omitempty"` + // The maximum tolerable waiting time when the calls trigger flow control, if the actual waiting time is more than this time, it will + // return a error, else it will wait for the flow restriction lifted, and send the message. + // Nil means do not wait, the maximum value is `Unit`. + MaxWaitTime time.Duration `json:"maxWaitTime,omitempty"` +} + +type DingTalkOptions struct { + // Notification Sending Timeout + NotificationTimeout *int32 `json:"notificationTimeout,omitempty"` + // The name of the template to generate DingTalk message. + // If the global template is not set, it will use default. + Template string `json:"template,omitempty"` + // The time of token expired. + TokenExpires time.Duration `json:"tokenExpires,omitempty"` + // The maximum message size that can be sent to conversation in a request. + ConversationMessageMaxSize int `json:"conversationMessageMaxSize,omitempty"` + // The maximum message size that can be sent to chatbot in a request. + ChatbotMessageMaxSize int `json:"chatbotMessageMaxSize,omitempty"` + // The flow control fo chatbot. + ChatBotThrottle *Throttle `json:"chatBotThrottle,omitempty"` + // The flow control fo conversation. + ConversationThrottle *Throttle `json:"conversationThrottle,omitempty"` +} + +type Options struct { + Global *GlobalOptions `json:"global,omitempty"` + Email *EmailOptions `json:"email,omitempty"` + Wechat *WechatOptions `json:"wechat,omitempty"` + Slack *SlackOptions `json:"slack,omitempty"` + Webhook *WebhookOptions `json:"webhook,omitempty"` + DingTalk *DingTalkOptions `json:"dingtalk,omitempty"` +} + +// NotificationManagerStatus defines the observed state of NotificationManager +type NotificationManagerStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=nm + +// NotificationManager is the Schema for the notificationmanagers API +type NotificationManager struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NotificationManagerSpec `json:"spec,omitempty"` + Status NotificationManagerStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// NotificationManagerList contains a list of NotificationManager +type NotificationManagerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []NotificationManager `json:"items"` +} + +func init() { + SchemeBuilder.Register(&NotificationManager{}, &NotificationManagerList{}) +} diff --git a/pkg/apis/notification/v2/register.go b/pkg/apis/notification/v2/register.go new file mode 100644 index 000000000..8103b55f0 --- /dev/null +++ b/pkg/apis/notification/v2/register.go @@ -0,0 +1,41 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// NOTE: Boilerplate only. Ignore this file. + +// Package v1alpha1 contains API Schema definitions for the notification v2 API group +// +k8s:deepcopy-gen=package,register +// +groupName=notification.kubesphere.io +package v2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "notification.kubesphere.io", Version: "v2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + AddToScheme = SchemeBuilder.AddToScheme +) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/pkg/apis/notification/v2/slackconfig_types.go b/pkg/apis/notification/v2/slackconfig_types.go new file mode 100644 index 000000000..05e7f670a --- /dev/null +++ b/pkg/apis/notification/v2/slackconfig_types.go @@ -0,0 +1,57 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SlackConfigSpec defines the desired state of SlackConfig +type SlackConfigSpec struct { + // The token of user or bot. + SlackTokenSecret *SecretKeySelector `json:"slackTokenSecret,omitempty"` +} + +// SlackConfigStatus defines the observed state of SlackConfig +type SlackConfigStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=sc +// +genclient +// +genclient:nonNamespaced +// SlackConfig is the Schema for the slackconfigs API +type SlackConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec SlackConfigSpec `json:"spec,omitempty"` + Status SlackConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SlackConfigList contains a list of SlackConfig +type SlackConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SlackConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SlackConfig{}, &SlackConfigList{}) +} diff --git a/pkg/apis/notification/v2/slackreceiver_types.go b/pkg/apis/notification/v2/slackreceiver_types.go new file mode 100644 index 000000000..61a5f3e68 --- /dev/null +++ b/pkg/apis/notification/v2/slackreceiver_types.go @@ -0,0 +1,61 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SlackReceiverSpec defines the desired state of SlackReceiver +type SlackReceiverSpec struct { + // SlackConfig to be selected for this receiver + SlackConfigSelector *metav1.LabelSelector `json:"slackConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // The channel or user to send notifications to. + Channel string `json:"channel"` +} + +// SlackReceiverStatus defines the observed state of SlackReceiver +type SlackReceiverStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=sr +// +genclient +// +genclient:nonNamespaced +// SlackReceiver is the Schema for the slackreceivers API +type SlackReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec SlackReceiverSpec `json:"spec,omitempty"` + Status SlackReceiverStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SlackReceiverList contains a list of SlackReceiver +type SlackReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SlackReceiver `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SlackReceiver{}, &SlackReceiverList{}) +} diff --git a/pkg/apis/notification/v2/types.go b/pkg/apis/notification/v2/types.go new file mode 100644 index 000000000..57c3bbd2a --- /dev/null +++ b/pkg/apis/notification/v2/types.go @@ -0,0 +1,41 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +const ( + ResourcesPluralDingTalkConfig = "dingtalkconfigs" + ResourcesPluralDingTalkReceiver = "dingtalkreceivers" + ResourcesPluralEmailConfig = "emailconfigs" + ResourcesPluralEmailReceiver = "emailreceivers" + ResourcesPluralSlackConfig = "slackconfigs" + ResourcesPluralSlackReceiver = "slackreceivers" + ResourcesPluralWebhookConfig = "webhookconfigs" + ResourcesPluralWebhookReceiver = "webhookreceivers" + ResourcesPluralWechatConfig = "wechatconfigs" + ResourcesPluralWechatReceiver = "wechatreceivers" + + ResourcesSingularDingTalkConfig = "dingtalkconfig" + ResourcesSingularDingTalkReceiver = "dingtalkreceiver" + ResourcesSingularEmailConfig = "emailconfig" + ResourcesSingularEmailReceiver = "emailreceiver" + ResourcesSingularSlackConfig = "slackconfig" + ResourcesSingularSlackReceiver = "slackreceiver" + ResourcesSingularWebhookConfig = "webhookconfig" + ResourcesSingularWebhookReceiver = "webhookreceiver" + ResourcesSingularWechatConfig = "wechatconfig" + ResourcesSingularWechatReceiver = "wechatreceiver" +) diff --git a/pkg/apis/notification/v2/v2_suite_test.go b/pkg/apis/notification/v2/v2_suite_test.go new file mode 100644 index 000000000..9e49e5c9d --- /dev/null +++ b/pkg/apis/notification/v2/v2_suite_test.go @@ -0,0 +1,54 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + "log" + "os" + "path/filepath" + "testing" + + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" +) + +var cfg *rest.Config + +func TestMain(m *testing.M) { + t := &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "..", "config", "crds")}, + } + + err := SchemeBuilder.AddToScheme(scheme.Scheme) + if err != nil { + log.Fatal(err) + } + + if cfg, err = t.Start(); err != nil { + log.Fatal(err) + } + + if _, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}); err != nil { + log.Fatal(err) + } + + code := m.Run() + _ = t.Stop() + os.Exit(code) +} diff --git a/pkg/apis/notification/v2/webhookconfig_types.go b/pkg/apis/notification/v2/webhookconfig_types.go new file mode 100644 index 000000000..0670cdcf8 --- /dev/null +++ b/pkg/apis/notification/v2/webhookconfig_types.go @@ -0,0 +1,55 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// WebhookConfigSpec defines the desired state of WebhookConfig +type WebhookConfigSpec struct { +} + +// WebhookConfigStatus defines the observed state of WebhookConfig +type WebhookConfigStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=wc +// +genclient +// +genclient:nonNamespaced +// WebhookConfig is the Schema for the webhookconfigs API +type WebhookConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec WebhookConfigSpec `json:"spec,omitempty"` + Status WebhookConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// WebhookConfigList contains a list of WebhookConfig +type WebhookConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []WebhookConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&WebhookConfig{}, &WebhookConfigList{}) +} diff --git a/pkg/apis/notification/v2/webhookreceiver_types.go b/pkg/apis/notification/v2/webhookreceiver_types.go new file mode 100644 index 000000000..12f6eb206 --- /dev/null +++ b/pkg/apis/notification/v2/webhookreceiver_types.go @@ -0,0 +1,159 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type ClientCertificate struct { + // The client cert file for the targets. + Cert *SecretKeySelector `json:"cert,omitempty"` + // The client key file for the targets. + Key *SecretKeySelector `json:"key,omitempty"` +} + +// TLSConfig configures the options for TLS connections. +type TLSConfig struct { + // RootCA defines the root certificate authorities + // that clients use when verifying server certificates. + RootCA *SecretKeySelector `json:"rootCA,omitempty"` + // The certificate of the client. + *ClientCertificate `json:"clientCertificate,omitempty"` + // Used to verify the hostname for the targets. + ServerName string `json:"serverName,omitempty"` + // Disable target certificate validation. + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` +} + +// BasicAuth contains basic HTTP authentication credentials. +type BasicAuth struct { + Username string `json:"username"` + Password *SecretKeySelector `json:"password,omitempty"` +} + +// HTTPClientConfig configures an HTTP client. +type HTTPClientConfig struct { + // The HTTP basic authentication credentials for the targets. + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // The bearer token for the targets. + BearerToken *SecretKeySelector `json:"bearerToken,omitempty"` + // HTTP proxy server to use to connect to the targets. + ProxyURL string `json:"proxyUrl,omitempty"` + // TLSConfig to use to connect to the targets. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` +} + +// ServiceReference holds a reference to Service.legacy.k8s.io +type ServiceReference struct { + // `namespace` is the namespace of the service. + // Required + Namespace string `json:"namespace"` + + // `name` is the name of the service. + // Required + Name string `json:"name"` + + // `path` is an optional URL path which will be sent in any request to + // this service. + // +optional + Path *string `json:"path,omitempty"` + + // If specified, the port on the service that hosting webhook. + // Default to 443 for backward compatibility. + // `port` should be a valid port number (1-65535, inclusive). + // +optional + Port *int32 `json:"port,omitempty"` + + // Http scheme, default is http. + // +optional + Scheme *string `json:"scheme,omitempty"` +} + +// WebhookReceiverSpec defines the desired state of WebhookReceiver +type WebhookReceiverSpec struct { + // WebhookConfig to be selected for this receiver + WebhookConfigSelector *metav1.LabelSelector `json:"webhookConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // `url` gives the location of the webhook, in standard URL form + // (`scheme://host:port/path`). Exactly one of `url` or `service` + // must be specified. + // + // The `host` should not refer to a service running in the cluster; use + // the `service` field instead. The host might be resolved via external + // DNS in some api servers (e.g., `kube-apiserver` cannot resolve + // in-cluster DNS as that would be a layering violation). `host` may + // also be an IP address. + // + // Please note that using `localhost` or `127.0.0.1` as a `host` is + // risky unless you take great care to run this webhook on all hosts + // which run an apiserver which might need to make calls to this + // webhook. Such installs are likely to be non-portable, i.e., not easy + // to turn up in a new cluster. + // + // A path is optional, and if present may be any string permissible in + // a URL. You may use the path to pass an arbitrary string to the + // webhook, for example, a cluster identifier. + // + // Attempting to use a user or basic auth e.g. "user:password@" is not + // allowed. Fragments ("#...") and query parameters ("?...") are not + // allowed, either. + // + // +optional + URL *string `json:"url,omitempty"` + + // `service` is a reference to the service for this webhook. Either + // `service` or `url` must be specified. + // + // If the webhook is running within the cluster, then you should use `service`. + // + // +optional + Service *ServiceReference `json:"service,omitempty"` + + HTTPConfig *HTTPClientConfig `json:"httpConfig,omitempty"` +} + +// WebhookReceiverStatus defines the observed state of WebhookReceiver +type WebhookReceiverStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=wr +// +genclient +// +genclient:nonNamespaced +// WebhookReceiver is the Schema for the webhookreceivers API +type WebhookReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec WebhookReceiverSpec `json:"spec,omitempty"` + Status WebhookReceiverStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// WebhookReceiverList contains a list of WebhookReceiver +type WebhookReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []WebhookReceiver `json:"items"` +} + +func init() { + SchemeBuilder.Register(&WebhookReceiver{}, &WebhookReceiverList{}) +} diff --git a/pkg/apis/notification/v2/wechatconfig_types.go b/pkg/apis/notification/v2/wechatconfig_types.go new file mode 100644 index 000000000..5a6eb6f1f --- /dev/null +++ b/pkg/apis/notification/v2/wechatconfig_types.go @@ -0,0 +1,63 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// WechatConfigSpec defines the desired state of WechatConfig +type WechatConfigSpec struct { + // The WeChat API URL. + WechatApiUrl string `json:"wechatApiUrl,omitempty"` + // The corp id for authentication. + WechatApiCorpId string `json:"wechatApiCorpId"` + // The id of the application which sending message. + WechatApiAgentId string `json:"wechatApiAgentId"` + // The API key to use when talking to the WeChat API. + WechatApiSecret *SecretKeySelector `json:"wechatApiSecret"` +} + +// WechatConfigStatus defines the observed state of WechatConfig +type WechatConfigStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=wcc +// +genclient +// +genclient:nonNamespaced +// WechatConfig is the Schema for the wechatconfigs API +type WechatConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec WechatConfigSpec `json:"spec,omitempty"` + Status WechatConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// WechatConfigList contains a list of WechatConfig +type WechatConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []WechatConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&WechatConfig{}, &WechatConfigList{}) +} diff --git a/pkg/apis/notification/v2/wechatreceiver_types.go b/pkg/apis/notification/v2/wechatreceiver_types.go new file mode 100644 index 000000000..99198460e --- /dev/null +++ b/pkg/apis/notification/v2/wechatreceiver_types.go @@ -0,0 +1,63 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// WechatReceiverSpec defines the desired state of WechatReceiver +type WechatReceiverSpec struct { + // WechatConfig to be selected for this receiver + WechatConfigSelector *metav1.LabelSelector `json:"wechatConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // +optional + ToUser string `json:"toUser,omitempty"` + ToParty string `json:"toParty,omitempty"` + ToTag string `json:"toTag,omitempty"` +} + +// WechatReceiverStatus defines the observed state of WechatReceiver +type WechatReceiverStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=wcr +// +genclient +// +genclient:nonNamespaced +// WechatReceiver is the Schema for the wechatreceivers API +type WechatReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec WechatReceiverSpec `json:"spec,omitempty"` + Status WechatReceiverStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// WechatReceiverList contains a list of WechatReceiver +type WechatReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []WechatReceiver `json:"items"` +} + +func init() { + SchemeBuilder.Register(&WechatReceiver{}, &WechatReceiverList{}) +} diff --git a/pkg/apis/notification/v2/zz_generated.deepcopy.go b/pkg/apis/notification/v2/zz_generated.deepcopy.go new file mode 100644 index 000000000..021089293 --- /dev/null +++ b/pkg/apis/notification/v2/zz_generated.deepcopy.go @@ -0,0 +1,1651 @@ +// +build !ignore_autogenerated + +/* + + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v2 + +import ( + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { + *out = *in + if in.Password != nil { + in, out := &in.Password, &out.Password + *out = new(SecretKeySelector) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuth. +func (in *BasicAuth) DeepCopy() *BasicAuth { + if in == nil { + return nil + } + out := new(BasicAuth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientCertificate) DeepCopyInto(out *ClientCertificate) { + *out = *in + if in.Cert != nil { + in, out := &in.Cert, &out.Cert + *out = new(SecretKeySelector) + **out = **in + } + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(SecretKeySelector) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientCertificate. +func (in *ClientCertificate) DeepCopy() *ClientCertificate { + if in == nil { + return nil + } + out := new(ClientCertificate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkApplicationConfig) DeepCopyInto(out *DingTalkApplicationConfig) { + *out = *in + if in.AppKey != nil { + in, out := &in.AppKey, &out.AppKey + *out = new(SecretKeySelector) + **out = **in + } + if in.AppSecret != nil { + in, out := &in.AppSecret, &out.AppSecret + *out = new(SecretKeySelector) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkApplicationConfig. +func (in *DingTalkApplicationConfig) DeepCopy() *DingTalkApplicationConfig { + if in == nil { + return nil + } + out := new(DingTalkApplicationConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkChatBot) DeepCopyInto(out *DingTalkChatBot) { + *out = *in + if in.Webhook != nil { + in, out := &in.Webhook, &out.Webhook + *out = new(SecretKeySelector) + **out = **in + } + if in.Keywords != nil { + in, out := &in.Keywords, &out.Keywords + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Secret != nil { + in, out := &in.Secret, &out.Secret + *out = new(SecretKeySelector) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkChatBot. +func (in *DingTalkChatBot) DeepCopy() *DingTalkChatBot { + if in == nil { + return nil + } + out := new(DingTalkChatBot) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkConfig) DeepCopyInto(out *DingTalkConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfig. +func (in *DingTalkConfig) DeepCopy() *DingTalkConfig { + if in == nil { + return nil + } + out := new(DingTalkConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DingTalkConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkConfigList) DeepCopyInto(out *DingTalkConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DingTalkConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigList. +func (in *DingTalkConfigList) DeepCopy() *DingTalkConfigList { + if in == nil { + return nil + } + out := new(DingTalkConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DingTalkConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkConfigSpec) DeepCopyInto(out *DingTalkConfigSpec) { + *out = *in + if in.Conversation != nil { + in, out := &in.Conversation, &out.Conversation + *out = new(DingTalkApplicationConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigSpec. +func (in *DingTalkConfigSpec) DeepCopy() *DingTalkConfigSpec { + if in == nil { + return nil + } + out := new(DingTalkConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkConfigStatus) DeepCopyInto(out *DingTalkConfigStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigStatus. +func (in *DingTalkConfigStatus) DeepCopy() *DingTalkConfigStatus { + if in == nil { + return nil + } + out := new(DingTalkConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkConversation) DeepCopyInto(out *DingTalkConversation) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConversation. +func (in *DingTalkConversation) DeepCopy() *DingTalkConversation { + if in == nil { + return nil + } + out := new(DingTalkConversation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkOptions) DeepCopyInto(out *DingTalkOptions) { + *out = *in + if in.NotificationTimeout != nil { + in, out := &in.NotificationTimeout, &out.NotificationTimeout + *out = new(int32) + **out = **in + } + if in.ChatBotThrottle != nil { + in, out := &in.ChatBotThrottle, &out.ChatBotThrottle + *out = new(Throttle) + **out = **in + } + if in.ConversationThrottle != nil { + in, out := &in.ConversationThrottle, &out.ConversationThrottle + *out = new(Throttle) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkOptions. +func (in *DingTalkOptions) DeepCopy() *DingTalkOptions { + if in == nil { + return nil + } + out := new(DingTalkOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkReceiver) DeepCopyInto(out *DingTalkReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiver. +func (in *DingTalkReceiver) DeepCopy() *DingTalkReceiver { + if in == nil { + return nil + } + out := new(DingTalkReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DingTalkReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkReceiverList) DeepCopyInto(out *DingTalkReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DingTalkReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverList. +func (in *DingTalkReceiverList) DeepCopy() *DingTalkReceiverList { + if in == nil { + return nil + } + out := new(DingTalkReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DingTalkReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkReceiverSpec) DeepCopyInto(out *DingTalkReceiverSpec) { + *out = *in + if in.DingTalkConfigSelector != nil { + in, out := &in.DingTalkConfigSelector, &out.DingTalkConfigSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.ChatBot != nil { + in, out := &in.ChatBot, &out.ChatBot + *out = new(DingTalkChatBot) + (*in).DeepCopyInto(*out) + } + if in.Conversation != nil { + in, out := &in.Conversation, &out.Conversation + *out = new(DingTalkConversation) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverSpec. +func (in *DingTalkReceiverSpec) DeepCopy() *DingTalkReceiverSpec { + if in == nil { + return nil + } + out := new(DingTalkReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkReceiverStatus) DeepCopyInto(out *DingTalkReceiverStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverStatus. +func (in *DingTalkReceiverStatus) DeepCopy() *DingTalkReceiverStatus { + if in == nil { + return nil + } + out := new(DingTalkReceiverStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailConfig) DeepCopyInto(out *EmailConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfig. +func (in *EmailConfig) DeepCopy() *EmailConfig { + if in == nil { + return nil + } + out := new(EmailConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EmailConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailConfigList) DeepCopyInto(out *EmailConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EmailConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigList. +func (in *EmailConfigList) DeepCopy() *EmailConfigList { + if in == nil { + return nil + } + out := new(EmailConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EmailConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailConfigSpec) DeepCopyInto(out *EmailConfigSpec) { + *out = *in + out.SmartHost = in.SmartHost + if in.Hello != nil { + in, out := &in.Hello, &out.Hello + *out = new(string) + **out = **in + } + if in.AuthUsername != nil { + in, out := &in.AuthUsername, &out.AuthUsername + *out = new(string) + **out = **in + } + if in.AuthIdentify != nil { + in, out := &in.AuthIdentify, &out.AuthIdentify + *out = new(string) + **out = **in + } + if in.AuthPassword != nil { + in, out := &in.AuthPassword, &out.AuthPassword + *out = new(SecretKeySelector) + **out = **in + } + if in.AuthSecret != nil { + in, out := &in.AuthSecret, &out.AuthSecret + *out = new(SecretKeySelector) + **out = **in + } + if in.RequireTLS != nil { + in, out := &in.RequireTLS, &out.RequireTLS + *out = new(bool) + **out = **in + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(TLSConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigSpec. +func (in *EmailConfigSpec) DeepCopy() *EmailConfigSpec { + if in == nil { + return nil + } + out := new(EmailConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailConfigStatus) DeepCopyInto(out *EmailConfigStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigStatus. +func (in *EmailConfigStatus) DeepCopy() *EmailConfigStatus { + if in == nil { + return nil + } + out := new(EmailConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailOptions) DeepCopyInto(out *EmailOptions) { + *out = *in + if in.NotificationTimeout != nil { + in, out := &in.NotificationTimeout, &out.NotificationTimeout + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailOptions. +func (in *EmailOptions) DeepCopy() *EmailOptions { + if in == nil { + return nil + } + out := new(EmailOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailReceiver) DeepCopyInto(out *EmailReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiver. +func (in *EmailReceiver) DeepCopy() *EmailReceiver { + if in == nil { + return nil + } + out := new(EmailReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EmailReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailReceiverList) DeepCopyInto(out *EmailReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EmailReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverList. +func (in *EmailReceiverList) DeepCopy() *EmailReceiverList { + if in == nil { + return nil + } + out := new(EmailReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EmailReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailReceiverSpec) DeepCopyInto(out *EmailReceiverSpec) { + *out = *in + if in.To != nil { + in, out := &in.To, &out.To + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.EmailConfigSelector != nil { + in, out := &in.EmailConfigSelector, &out.EmailConfigSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverSpec. +func (in *EmailReceiverSpec) DeepCopy() *EmailReceiverSpec { + if in == nil { + return nil + } + out := new(EmailReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailReceiverStatus) DeepCopyInto(out *EmailReceiverStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverStatus. +func (in *EmailReceiverStatus) DeepCopy() *EmailReceiverStatus { + if in == nil { + return nil + } + out := new(EmailReceiverStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GlobalOptions) DeepCopyInto(out *GlobalOptions) { + *out = *in + if in.TemplateFiles != nil { + in, out := &in.TemplateFiles, &out.TemplateFiles + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalOptions. +func (in *GlobalOptions) DeepCopy() *GlobalOptions { + if in == nil { + return nil + } + out := new(GlobalOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPClientConfig) DeepCopyInto(out *HTTPClientConfig) { + *out = *in + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.BearerToken != nil { + in, out := &in.BearerToken, &out.BearerToken + *out = new(SecretKeySelector) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(TLSConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPClientConfig. +func (in *HTTPClientConfig) DeepCopy() *HTTPClientConfig { + if in == nil { + return nil + } + out := new(HTTPClientConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HostPort) DeepCopyInto(out *HostPort) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostPort. +func (in *HostPort) DeepCopy() *HostPort { + if in == nil { + return nil + } + out := new(HostPort) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationManager) DeepCopyInto(out *NotificationManager) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationManager. +func (in *NotificationManager) DeepCopy() *NotificationManager { + if in == nil { + return nil + } + out := new(NotificationManager) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NotificationManager) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationManagerList) DeepCopyInto(out *NotificationManagerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NotificationManager, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationManagerList. +func (in *NotificationManagerList) DeepCopy() *NotificationManagerList { + if in == nil { + return nil + } + out := new(NotificationManagerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NotificationManagerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationManagerSpec) DeepCopyInto(out *NotificationManagerSpec) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(string) + **out = **in + } + if in.ImagePullPolicy != nil { + in, out := &in.ImagePullPolicy, &out.ImagePullPolicy + *out = new(corev1.PullPolicy) + **out = **in + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(corev1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]corev1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DefaultConfigSelector != nil { + in, out := &in.DefaultConfigSelector, &out.DefaultConfigSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.Receivers != nil { + in, out := &in.Receivers, &out.Receivers + *out = new(ReceiversSpec) + (*in).DeepCopyInto(*out) + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]corev1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.VolumeMounts != nil { + in, out := &in.VolumeMounts, &out.VolumeMounts + *out = make([]corev1.VolumeMount, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationManagerSpec. +func (in *NotificationManagerSpec) DeepCopy() *NotificationManagerSpec { + if in == nil { + return nil + } + out := new(NotificationManagerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationManagerStatus) DeepCopyInto(out *NotificationManagerStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationManagerStatus. +func (in *NotificationManagerStatus) DeepCopy() *NotificationManagerStatus { + if in == nil { + return nil + } + out := new(NotificationManagerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Options) DeepCopyInto(out *Options) { + *out = *in + if in.Global != nil { + in, out := &in.Global, &out.Global + *out = new(GlobalOptions) + (*in).DeepCopyInto(*out) + } + if in.Email != nil { + in, out := &in.Email, &out.Email + *out = new(EmailOptions) + (*in).DeepCopyInto(*out) + } + if in.Wechat != nil { + in, out := &in.Wechat, &out.Wechat + *out = new(WechatOptions) + (*in).DeepCopyInto(*out) + } + if in.Slack != nil { + in, out := &in.Slack, &out.Slack + *out = new(SlackOptions) + (*in).DeepCopyInto(*out) + } + if in.Webhook != nil { + in, out := &in.Webhook, &out.Webhook + *out = new(WebhookOptions) + (*in).DeepCopyInto(*out) + } + if in.DingTalk != nil { + in, out := &in.DingTalk, &out.DingTalk + *out = new(DingTalkOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Options. +func (in *Options) DeepCopy() *Options { + if in == nil { + return nil + } + out := new(Options) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReceiversSpec) DeepCopyInto(out *ReceiversSpec) { + *out = *in + if in.GlobalReceiverSelector != nil { + in, out := &in.GlobalReceiverSelector, &out.GlobalReceiverSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.TenantReceiverSelector != nil { + in, out := &in.TenantReceiverSelector, &out.TenantReceiverSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = new(Options) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReceiversSpec. +func (in *ReceiversSpec) DeepCopy() *ReceiversSpec { + if in == nil { + return nil + } + out := new(ReceiversSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretKeySelector) DeepCopyInto(out *SecretKeySelector) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeySelector. +func (in *SecretKeySelector) DeepCopy() *SecretKeySelector { + if in == nil { + return nil + } + out := new(SecretKeySelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceReference) DeepCopyInto(out *ServiceReference) { + *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.Scheme != nil { + in, out := &in.Scheme, &out.Scheme + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceReference. +func (in *ServiceReference) DeepCopy() *ServiceReference { + if in == nil { + return nil + } + out := new(ServiceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackConfig) DeepCopyInto(out *SlackConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfig. +func (in *SlackConfig) DeepCopy() *SlackConfig { + if in == nil { + return nil + } + out := new(SlackConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SlackConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackConfigList) DeepCopyInto(out *SlackConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SlackConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigList. +func (in *SlackConfigList) DeepCopy() *SlackConfigList { + if in == nil { + return nil + } + out := new(SlackConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SlackConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackConfigSpec) DeepCopyInto(out *SlackConfigSpec) { + *out = *in + if in.SlackTokenSecret != nil { + in, out := &in.SlackTokenSecret, &out.SlackTokenSecret + *out = new(SecretKeySelector) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigSpec. +func (in *SlackConfigSpec) DeepCopy() *SlackConfigSpec { + if in == nil { + return nil + } + out := new(SlackConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackConfigStatus) DeepCopyInto(out *SlackConfigStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigStatus. +func (in *SlackConfigStatus) DeepCopy() *SlackConfigStatus { + if in == nil { + return nil + } + out := new(SlackConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackOptions) DeepCopyInto(out *SlackOptions) { + *out = *in + if in.NotificationTimeout != nil { + in, out := &in.NotificationTimeout, &out.NotificationTimeout + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackOptions. +func (in *SlackOptions) DeepCopy() *SlackOptions { + if in == nil { + return nil + } + out := new(SlackOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackReceiver) DeepCopyInto(out *SlackReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiver. +func (in *SlackReceiver) DeepCopy() *SlackReceiver { + if in == nil { + return nil + } + out := new(SlackReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SlackReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackReceiverList) DeepCopyInto(out *SlackReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SlackReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverList. +func (in *SlackReceiverList) DeepCopy() *SlackReceiverList { + if in == nil { + return nil + } + out := new(SlackReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SlackReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackReceiverSpec) DeepCopyInto(out *SlackReceiverSpec) { + *out = *in + if in.SlackConfigSelector != nil { + in, out := &in.SlackConfigSelector, &out.SlackConfigSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverSpec. +func (in *SlackReceiverSpec) DeepCopy() *SlackReceiverSpec { + if in == nil { + return nil + } + out := new(SlackReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackReceiverStatus) DeepCopyInto(out *SlackReceiverStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverStatus. +func (in *SlackReceiverStatus) DeepCopy() *SlackReceiverStatus { + if in == nil { + return nil + } + out := new(SlackReceiverStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLSConfig) DeepCopyInto(out *TLSConfig) { + *out = *in + if in.RootCA != nil { + in, out := &in.RootCA, &out.RootCA + *out = new(SecretKeySelector) + **out = **in + } + if in.ClientCertificate != nil { + in, out := &in.ClientCertificate, &out.ClientCertificate + *out = new(ClientCertificate) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfig. +func (in *TLSConfig) DeepCopy() *TLSConfig { + if in == nil { + return nil + } + out := new(TLSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Throttle) DeepCopyInto(out *Throttle) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Throttle. +func (in *Throttle) DeepCopy() *Throttle { + if in == nil { + return nil + } + out := new(Throttle) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookConfig) DeepCopyInto(out *WebhookConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfig. +func (in *WebhookConfig) DeepCopy() *WebhookConfig { + if in == nil { + return nil + } + out := new(WebhookConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WebhookConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookConfigList) DeepCopyInto(out *WebhookConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WebhookConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigList. +func (in *WebhookConfigList) DeepCopy() *WebhookConfigList { + if in == nil { + return nil + } + out := new(WebhookConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WebhookConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookConfigSpec) DeepCopyInto(out *WebhookConfigSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigSpec. +func (in *WebhookConfigSpec) DeepCopy() *WebhookConfigSpec { + if in == nil { + return nil + } + out := new(WebhookConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookConfigStatus) DeepCopyInto(out *WebhookConfigStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigStatus. +func (in *WebhookConfigStatus) DeepCopy() *WebhookConfigStatus { + if in == nil { + return nil + } + out := new(WebhookConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookOptions) DeepCopyInto(out *WebhookOptions) { + *out = *in + if in.NotificationTimeout != nil { + in, out := &in.NotificationTimeout, &out.NotificationTimeout + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookOptions. +func (in *WebhookOptions) DeepCopy() *WebhookOptions { + if in == nil { + return nil + } + out := new(WebhookOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookReceiver) DeepCopyInto(out *WebhookReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiver. +func (in *WebhookReceiver) DeepCopy() *WebhookReceiver { + if in == nil { + return nil + } + out := new(WebhookReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WebhookReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookReceiverList) DeepCopyInto(out *WebhookReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WebhookReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverList. +func (in *WebhookReceiverList) DeepCopy() *WebhookReceiverList { + if in == nil { + return nil + } + out := new(WebhookReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WebhookReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookReceiverSpec) DeepCopyInto(out *WebhookReceiverSpec) { + *out = *in + if in.WebhookConfigSelector != nil { + in, out := &in.WebhookConfigSelector, &out.WebhookConfigSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.URL != nil { + in, out := &in.URL, &out.URL + *out = new(string) + **out = **in + } + if in.Service != nil { + in, out := &in.Service, &out.Service + *out = new(ServiceReference) + (*in).DeepCopyInto(*out) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPClientConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverSpec. +func (in *WebhookReceiverSpec) DeepCopy() *WebhookReceiverSpec { + if in == nil { + return nil + } + out := new(WebhookReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookReceiverStatus) DeepCopyInto(out *WebhookReceiverStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverStatus. +func (in *WebhookReceiverStatus) DeepCopy() *WebhookReceiverStatus { + if in == nil { + return nil + } + out := new(WebhookReceiverStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatConfig) DeepCopyInto(out *WechatConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfig. +func (in *WechatConfig) DeepCopy() *WechatConfig { + if in == nil { + return nil + } + out := new(WechatConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WechatConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatConfigList) DeepCopyInto(out *WechatConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WechatConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigList. +func (in *WechatConfigList) DeepCopy() *WechatConfigList { + if in == nil { + return nil + } + out := new(WechatConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WechatConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatConfigSpec) DeepCopyInto(out *WechatConfigSpec) { + *out = *in + if in.WechatApiSecret != nil { + in, out := &in.WechatApiSecret, &out.WechatApiSecret + *out = new(SecretKeySelector) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigSpec. +func (in *WechatConfigSpec) DeepCopy() *WechatConfigSpec { + if in == nil { + return nil + } + out := new(WechatConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatConfigStatus) DeepCopyInto(out *WechatConfigStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigStatus. +func (in *WechatConfigStatus) DeepCopy() *WechatConfigStatus { + if in == nil { + return nil + } + out := new(WechatConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatOptions) DeepCopyInto(out *WechatOptions) { + *out = *in + if in.NotificationTimeout != nil { + in, out := &in.NotificationTimeout, &out.NotificationTimeout + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatOptions. +func (in *WechatOptions) DeepCopy() *WechatOptions { + if in == nil { + return nil + } + out := new(WechatOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatReceiver) DeepCopyInto(out *WechatReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiver. +func (in *WechatReceiver) DeepCopy() *WechatReceiver { + if in == nil { + return nil + } + out := new(WechatReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WechatReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatReceiverList) DeepCopyInto(out *WechatReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WechatReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverList. +func (in *WechatReceiverList) DeepCopy() *WechatReceiverList { + if in == nil { + return nil + } + out := new(WechatReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WechatReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatReceiverSpec) DeepCopyInto(out *WechatReceiverSpec) { + *out = *in + if in.WechatConfigSelector != nil { + in, out := &in.WechatConfigSelector, &out.WechatConfigSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverSpec. +func (in *WechatReceiverSpec) DeepCopy() *WechatReceiverSpec { + if in == nil { + return nil + } + out := new(WechatReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatReceiverStatus) DeepCopyInto(out *WechatReceiverStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverStatus. +func (in *WechatReceiverStatus) DeepCopy() *WechatReceiverStatus { + if in == nil { + return nil + } + out := new(WechatReceiverStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go b/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go new file mode 100644 index 000000000..3dbeeefb9 --- /dev/null +++ b/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go @@ -0,0 +1,63 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedDingTalkConfig = "federateddingtalkconfigs" + ResourceSingularFederatedDingTalkConfig = "federateddingtalkconfig" + FederatedDingTalkConfigKind = "FederatedDingTalkConfig" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedDingTalkConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedDingTalkConfigSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedDingTalkConfigSpec struct { + Template DingTalkConfigTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type DingTalkConfigTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.DingTalkConfigSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedDingTalkConfigList contains a list of federateddingtalkconfiglists +type FederatedDingTalkConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedDingTalkConfig `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go b/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go new file mode 100644 index 000000000..69f4c5272 --- /dev/null +++ b/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedDingTalkReceiver = "federateddingtalkreceivers" + ResourceSingularFederatedDingTalkReceiver = "federateddingtalkreceiver" + FederatedDingTalkReceiverKind = "FederatedDingTalkReceiver" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedDingTalkReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedDingTalkReceiverSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedDingTalkReceiverSpec struct { + Template DingTalkReceiverTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type DingTalkReceiverTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.DingTalkReceiverSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedDingTalkConfigList contains a list of federateddingtalkreceiverlists +type FederatedDingTalkReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedDingTalkReceiver `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedemailconfig_types.go b/pkg/apis/types/v1beta1/federatedemailconfig_types.go new file mode 100644 index 000000000..2dcb93f4c --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedemailconfig_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedEmailConfig = "federatedemailconfigs" + ResourceSingularFederatedEmailConfig = "federatedemailconfig" + FederatedEmailConfigKind = "FederatedEmailConfig" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedEmailConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedEmailConfigSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedEmailConfigSpec struct { + Template EmailConfigTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type EmailConfigTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.EmailConfigSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedEmailConfigList contains a list of federatedemailconfiglists +type FederatedEmailConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedEmailConfig `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedemailreceiver_types.go b/pkg/apis/types/v1beta1/federatedemailreceiver_types.go new file mode 100644 index 000000000..729043642 --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedemailreceiver_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedEmailReceiver = "federatedemailreceivers" + ResourceSingularFederatedEmailReceiver = "federatedemailreceiver" + FederatedEmailReceiverKind = "FederatedEmailReceiver" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedEmailReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedEmailReceiverSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedEmailReceiverSpec struct { + Template EmailReceiverTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type EmailReceiverTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.EmailReceiverSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedEmailConfigList contains a list of federatedemailconfiglists +type FederatedEmailReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedEmailReceiver `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedslackconfig_types.go b/pkg/apis/types/v1beta1/federatedslackconfig_types.go new file mode 100644 index 000000000..e368dba4d --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedslackconfig_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedSlackConfig = "federatedslackconfigs" + ResourceSingularFederatedSlackConfig = "federatedslackconfig" + FederatedSlackConfigKind = "FederatedSlackConfig" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedSlackConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedSlackConfigSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedSlackConfigSpec struct { + Template SlackConfigTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type SlackConfigTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.SlackConfigSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedSlackConfigList contains a list of federatedslackconfiglists +type FederatedSlackConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedSlackConfig `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedslackreceiver_types.go b/pkg/apis/types/v1beta1/federatedslackreceiver_types.go new file mode 100644 index 000000000..840d782ba --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedslackreceiver_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedSlackReceiver = "federatedslackreceivers" + ResourceSingularFederatedSlackReceiver = "federatedslackreceiver" + FederatedSlackReceiverKind = "FederatedSlackReceiver" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedSlackReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedSlackReceiverSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedSlackReceiverSpec struct { + Template SlackReceiverTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type SlackReceiverTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.SlackReceiverSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedSlackConfigList contains a list of federatedslackconfiglists +type FederatedSlackReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedSlackReceiver `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go b/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go new file mode 100644 index 000000000..6bfe396ae --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedWebhookConfig = "federatedwebhookconfigs" + ResourceSingularFederatedWebhookConfig = "federatedwebhookconfig" + FederatedWebhookConfigKind = "FederatedWebhookConfig" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedWebhookConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedWebhookConfigSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedWebhookConfigSpec struct { + Template WebhookConfigTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type WebhookConfigTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.WebhookConfigSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedWebhookConfigList contains a list of federatedwebhookconfiglists +type FederatedWebhookConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedWebhookConfig `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go b/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go new file mode 100644 index 000000000..4bbbb4755 --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedWebhookReceiver = "federatedwebhookreceivers" + ResourceSingularFederatedWebhookReceiver = "federatedwebhookreceiver" + FederatedWebhookReceiverKind = "FederatedWebhookReceiver" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedWebhookReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedWebhookReceiverSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedWebhookReceiverSpec struct { + Template WebhookReceiverTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type WebhookReceiverTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.WebhookReceiverSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedWebhookConfigList contains a list of federatedwebhookconfiglists +type FederatedWebhookReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedWebhookReceiver `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedwechatconfig_types.go b/pkg/apis/types/v1beta1/federatedwechatconfig_types.go new file mode 100644 index 000000000..eaf906124 --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedwechatconfig_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedWechatConfig = "federatedwechatconfigs" + ResourceSingularFederatedWechatConfig = "federatedwechatconfig" + FederatedWechatConfigKind = "FederatedWechatConfig" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedWechatConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedWechatConfigSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedWechatConfigSpec struct { + Template WechatConfigTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type WechatConfigTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.WechatConfigSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedWechatConfigList contains a list of federatedwechatconfiglists +type FederatedWechatConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedWechatConfig `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go b/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go new file mode 100644 index 000000000..957909175 --- /dev/null +++ b/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2020 KubeSphere Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +const ( + ResourcePluralFederatedWechatReceiver = "federatedwechatreceivers" + ResourceSingularFederatedWechatReceiver = "federatedwechatreceiver" + FederatedWechatReceiverKind = "FederatedWechatReceiver" +) + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +type FederatedWechatReceiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FederatedWechatReceiverSpec `json:"spec"` + + Status *GenericFederatedStatus `json:"status,omitempty"` +} + +type FederatedWechatReceiverSpec struct { + Template WechatReceiverTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` +} + +type WechatReceiverTemplate struct { + // +kubebuilder:pruning:PreserveUnknownFields + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec v2.WechatReceiverSpec `json:"spec,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FederatedWechatConfigList contains a list of federatedwechatconfiglists +type FederatedWechatReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FederatedWechatReceiver `json:"items"` +} diff --git a/pkg/apis/types/v1beta1/register.go b/pkg/apis/types/v1beta1/register.go index b11654efc..d4c83082d 100644 --- a/pkg/apis/types/v1beta1/register.go +++ b/pkg/apis/types/v1beta1/register.go @@ -56,6 +56,14 @@ func init() { &FederatedConfigMapList{}, &FederatedDeployment{}, &FederatedDeploymentList{}, + &FederatedDingTalkConfig{}, + &FederatedDingTalkConfigList{}, + &FederatedDingTalkReceiver{}, + &FederatedDingTalkReceiverList{}, + &FederatedEmailConfig{}, + &FederatedEmailConfigList{}, + &FederatedEmailReceiver{}, + &FederatedEmailReceiverList{}, &FederatedIngress{}, &FederatedIngressList{}, &FederatedLimitRange{}, @@ -70,12 +78,24 @@ func init() { &FederatedSecretList{}, &FederatedService{}, &FederatedServiceList{}, + &FederatedSlackConfig{}, + &FederatedSlackConfigList{}, + &FederatedSlackReceiver{}, + &FederatedSlackReceiverList{}, &FederatedStatefulSet{}, &FederatedStatefulSetList{}, &FederatedUser{}, &FederatedUserList{}, &FederatedGroup{}, &FederatedGroupList{}, + &FederatedWebhookConfig{}, + &FederatedWebhookConfigList{}, + &FederatedWebhookReceiver{}, + &FederatedWebhookReceiverList{}, + &FederatedWechatConfig{}, + &FederatedWechatConfigList{}, + &FederatedWechatReceiver{}, + &FederatedWechatReceiverList{}, &FederatedWorkspace{}, &FederatedWorkspaceList{}, &FederatedWorkspaceRole{}, diff --git a/pkg/apis/types/v1beta1/zz_generated.deepcopy.go b/pkg/apis/types/v1beta1/zz_generated.deepcopy.go index 5bffec1cd..88115f6e1 100644 --- a/pkg/apis/types/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/types/v1beta1/zz_generated.deepcopy.go @@ -159,6 +159,78 @@ func (in *DeploymentTemplate) DeepCopy() *DeploymentTemplate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkConfigTemplate) DeepCopyInto(out *DingTalkConfigTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigTemplate. +func (in *DingTalkConfigTemplate) DeepCopy() *DingTalkConfigTemplate { + if in == nil { + return nil + } + out := new(DingTalkConfigTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DingTalkReceiverTemplate) DeepCopyInto(out *DingTalkReceiverTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverTemplate. +func (in *DingTalkReceiverTemplate) DeepCopy() *DingTalkReceiverTemplate { + if in == nil { + return nil + } + out := new(DingTalkReceiverTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailConfigTemplate) DeepCopyInto(out *EmailConfigTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigTemplate. +func (in *EmailConfigTemplate) DeepCopy() *EmailConfigTemplate { + if in == nil { + return nil + } + out := new(EmailConfigTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EmailReceiverTemplate) DeepCopyInto(out *EmailReceiverTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverTemplate. +func (in *EmailReceiverTemplate) DeepCopy() *EmailReceiverTemplate { + if in == nil { + return nil + } + out := new(EmailReceiverTemplate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedApplication) DeepCopyInto(out *FederatedApplication) { *out = *in @@ -594,6 +666,354 @@ func (in *FederatedDeploymentSpec) DeepCopy() *FederatedDeploymentSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedDingTalkConfig) DeepCopyInto(out *FederatedDingTalkConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkConfig. +func (in *FederatedDingTalkConfig) DeepCopy() *FederatedDingTalkConfig { + if in == nil { + return nil + } + out := new(FederatedDingTalkConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedDingTalkConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedDingTalkConfigList) DeepCopyInto(out *FederatedDingTalkConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedDingTalkConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkConfigList. +func (in *FederatedDingTalkConfigList) DeepCopy() *FederatedDingTalkConfigList { + if in == nil { + return nil + } + out := new(FederatedDingTalkConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedDingTalkConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedDingTalkConfigSpec) DeepCopyInto(out *FederatedDingTalkConfigSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkConfigSpec. +func (in *FederatedDingTalkConfigSpec) DeepCopy() *FederatedDingTalkConfigSpec { + if in == nil { + return nil + } + out := new(FederatedDingTalkConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedDingTalkReceiver) DeepCopyInto(out *FederatedDingTalkReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkReceiver. +func (in *FederatedDingTalkReceiver) DeepCopy() *FederatedDingTalkReceiver { + if in == nil { + return nil + } + out := new(FederatedDingTalkReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedDingTalkReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedDingTalkReceiverList) DeepCopyInto(out *FederatedDingTalkReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedDingTalkReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkReceiverList. +func (in *FederatedDingTalkReceiverList) DeepCopy() *FederatedDingTalkReceiverList { + if in == nil { + return nil + } + out := new(FederatedDingTalkReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedDingTalkReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedDingTalkReceiverSpec) DeepCopyInto(out *FederatedDingTalkReceiverSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkReceiverSpec. +func (in *FederatedDingTalkReceiverSpec) DeepCopy() *FederatedDingTalkReceiverSpec { + if in == nil { + return nil + } + out := new(FederatedDingTalkReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedEmailConfig) DeepCopyInto(out *FederatedEmailConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailConfig. +func (in *FederatedEmailConfig) DeepCopy() *FederatedEmailConfig { + if in == nil { + return nil + } + out := new(FederatedEmailConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedEmailConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedEmailConfigList) DeepCopyInto(out *FederatedEmailConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedEmailConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailConfigList. +func (in *FederatedEmailConfigList) DeepCopy() *FederatedEmailConfigList { + if in == nil { + return nil + } + out := new(FederatedEmailConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedEmailConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedEmailConfigSpec) DeepCopyInto(out *FederatedEmailConfigSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailConfigSpec. +func (in *FederatedEmailConfigSpec) DeepCopy() *FederatedEmailConfigSpec { + if in == nil { + return nil + } + out := new(FederatedEmailConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedEmailReceiver) DeepCopyInto(out *FederatedEmailReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailReceiver. +func (in *FederatedEmailReceiver) DeepCopy() *FederatedEmailReceiver { + if in == nil { + return nil + } + out := new(FederatedEmailReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedEmailReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedEmailReceiverList) DeepCopyInto(out *FederatedEmailReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedEmailReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailReceiverList. +func (in *FederatedEmailReceiverList) DeepCopy() *FederatedEmailReceiverList { + if in == nil { + return nil + } + out := new(FederatedEmailReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedEmailReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedEmailReceiverSpec) DeepCopyInto(out *FederatedEmailReceiverSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailReceiverSpec. +func (in *FederatedEmailReceiverSpec) DeepCopy() *FederatedEmailReceiverSpec { + if in == nil { + return nil + } + out := new(FederatedEmailReceiverSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedGroup) DeepCopyInto(out *FederatedGroup) { *out = *in @@ -636,6 +1056,7 @@ func (in *FederatedGroupBinding) DeepCopyInto(out *FederatedGroupBinding) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedGroupBinding. @@ -756,6 +1177,7 @@ func (in *FederatedGroupSpec) DeepCopyInto(out *FederatedGroupSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedGroupSpec. @@ -779,6 +1201,7 @@ func (in *FederatedIngress) DeepCopyInto(out *FederatedIngress) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedIngress. @@ -811,6 +1234,7 @@ func (in *FederatedIngressList) DeepCopyInto(out *FederatedIngressList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedIngressList. @@ -843,6 +1267,7 @@ func (in *FederatedIngressSpec) DeepCopyInto(out *FederatedIngressSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedIngressSpec. @@ -866,6 +1291,7 @@ func (in *FederatedJob) DeepCopyInto(out *FederatedJob) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedJob. @@ -898,6 +1324,7 @@ func (in *FederatedJobList) DeepCopyInto(out *FederatedJobList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedJobList. @@ -930,6 +1357,7 @@ func (in *FederatedJobSpec) DeepCopyInto(out *FederatedJobSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedJobSpec. @@ -953,6 +1381,7 @@ func (in *FederatedLimitRange) DeepCopyInto(out *FederatedLimitRange) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedLimitRange. @@ -985,6 +1414,7 @@ func (in *FederatedLimitRangeList) DeepCopyInto(out *FederatedLimitRangeList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedLimitRangeList. @@ -1017,6 +1447,7 @@ func (in *FederatedLimitRangeSpec) DeepCopyInto(out *FederatedLimitRangeSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedLimitRangeSpec. @@ -1040,6 +1471,7 @@ func (in *FederatedNamespace) DeepCopyInto(out *FederatedNamespace) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNamespace. @@ -1072,6 +1504,7 @@ func (in *FederatedNamespaceList) DeepCopyInto(out *FederatedNamespaceList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNamespaceList. @@ -1104,6 +1537,7 @@ func (in *FederatedNamespaceSpec) DeepCopyInto(out *FederatedNamespaceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNamespaceSpec. @@ -1127,6 +1561,7 @@ func (in *FederatedPersistentVolumeClaim) DeepCopyInto(out *FederatedPersistentV *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedPersistentVolumeClaim. @@ -1159,6 +1594,7 @@ func (in *FederatedPersistentVolumeClaimList) DeepCopyInto(out *FederatedPersist (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedPersistentVolumeClaimList. @@ -1191,6 +1627,7 @@ func (in *FederatedPersistentVolumeClaimSpec) DeepCopyInto(out *FederatedPersist (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedPersistentVolumeClaimSpec. @@ -1214,6 +1651,7 @@ func (in *FederatedResourceQuota) DeepCopyInto(out *FederatedResourceQuota) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedResourceQuota. @@ -1246,6 +1684,7 @@ func (in *FederatedResourceQuotaList) DeepCopyInto(out *FederatedResourceQuotaLi (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedResourceQuotaList. @@ -1278,6 +1717,7 @@ func (in *FederatedResourceQuotaSpec) DeepCopyInto(out *FederatedResourceQuotaSp (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedResourceQuotaSpec. @@ -1301,6 +1741,7 @@ func (in *FederatedSecret) DeepCopyInto(out *FederatedSecret) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSecret. @@ -1365,6 +1806,7 @@ func (in *FederatedSecretSpec) DeepCopyInto(out *FederatedSecretSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSecretSpec. @@ -1388,6 +1830,7 @@ func (in *FederatedService) DeepCopyInto(out *FederatedService) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedService. @@ -1420,6 +1863,7 @@ func (in *FederatedServiceList) DeepCopyInto(out *FederatedServiceList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedServiceList. @@ -1452,6 +1896,7 @@ func (in *FederatedServiceSpec) DeepCopyInto(out *FederatedServiceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedServiceSpec. @@ -1464,6 +1909,185 @@ func (in *FederatedServiceSpec) DeepCopy() *FederatedServiceSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedSlackConfig) DeepCopyInto(out *FederatedSlackConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackConfig. +func (in *FederatedSlackConfig) DeepCopy() *FederatedSlackConfig { + if in == nil { + return nil + } + out := new(FederatedSlackConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedSlackConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedSlackConfigList) DeepCopyInto(out *FederatedSlackConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedSlackConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackConfigList. +func (in *FederatedSlackConfigList) DeepCopy() *FederatedSlackConfigList { + if in == nil { + return nil + } + out := new(FederatedSlackConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedSlackConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedSlackConfigSpec) DeepCopyInto(out *FederatedSlackConfigSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackConfigSpec. +func (in *FederatedSlackConfigSpec) DeepCopy() *FederatedSlackConfigSpec { + if in == nil { + return nil + } + out := new(FederatedSlackConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedSlackReceiver) DeepCopyInto(out *FederatedSlackReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackReceiver. +func (in *FederatedSlackReceiver) DeepCopy() *FederatedSlackReceiver { + if in == nil { + return nil + } + out := new(FederatedSlackReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedSlackReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedSlackReceiverList) DeepCopyInto(out *FederatedSlackReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedSlackReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackReceiverList. +func (in *FederatedSlackReceiverList) DeepCopy() *FederatedSlackReceiverList { + if in == nil { + return nil + } + out := new(FederatedSlackReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedSlackReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedSlackReceiverSpec) DeepCopyInto(out *FederatedSlackReceiverSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackReceiverSpec. +func (in *FederatedSlackReceiverSpec) DeepCopy() *FederatedSlackReceiverSpec { + if in == nil { + return nil + } + out := new(FederatedSlackReceiverSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedStatefulSet) DeepCopyInto(out *FederatedStatefulSet) { *out = *in @@ -1638,6 +2262,354 @@ func (in *FederatedUserSpec) DeepCopy() *FederatedUserSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWebhookConfig) DeepCopyInto(out *FederatedWebhookConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookConfig. +func (in *FederatedWebhookConfig) DeepCopy() *FederatedWebhookConfig { + if in == nil { + return nil + } + out := new(FederatedWebhookConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWebhookConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWebhookConfigList) DeepCopyInto(out *FederatedWebhookConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedWebhookConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookConfigList. +func (in *FederatedWebhookConfigList) DeepCopy() *FederatedWebhookConfigList { + if in == nil { + return nil + } + out := new(FederatedWebhookConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWebhookConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWebhookConfigSpec) DeepCopyInto(out *FederatedWebhookConfigSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookConfigSpec. +func (in *FederatedWebhookConfigSpec) DeepCopy() *FederatedWebhookConfigSpec { + if in == nil { + return nil + } + out := new(FederatedWebhookConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWebhookReceiver) DeepCopyInto(out *FederatedWebhookReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookReceiver. +func (in *FederatedWebhookReceiver) DeepCopy() *FederatedWebhookReceiver { + if in == nil { + return nil + } + out := new(FederatedWebhookReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWebhookReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWebhookReceiverList) DeepCopyInto(out *FederatedWebhookReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedWebhookReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookReceiverList. +func (in *FederatedWebhookReceiverList) DeepCopy() *FederatedWebhookReceiverList { + if in == nil { + return nil + } + out := new(FederatedWebhookReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWebhookReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWebhookReceiverSpec) DeepCopyInto(out *FederatedWebhookReceiverSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookReceiverSpec. +func (in *FederatedWebhookReceiverSpec) DeepCopy() *FederatedWebhookReceiverSpec { + if in == nil { + return nil + } + out := new(FederatedWebhookReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWechatConfig) DeepCopyInto(out *FederatedWechatConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatConfig. +func (in *FederatedWechatConfig) DeepCopy() *FederatedWechatConfig { + if in == nil { + return nil + } + out := new(FederatedWechatConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWechatConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWechatConfigList) DeepCopyInto(out *FederatedWechatConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedWechatConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatConfigList. +func (in *FederatedWechatConfigList) DeepCopy() *FederatedWechatConfigList { + if in == nil { + return nil + } + out := new(FederatedWechatConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWechatConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWechatConfigSpec) DeepCopyInto(out *FederatedWechatConfigSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatConfigSpec. +func (in *FederatedWechatConfigSpec) DeepCopy() *FederatedWechatConfigSpec { + if in == nil { + return nil + } + out := new(FederatedWechatConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWechatReceiver) DeepCopyInto(out *FederatedWechatReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatReceiver. +func (in *FederatedWechatReceiver) DeepCopy() *FederatedWechatReceiver { + if in == nil { + return nil + } + out := new(FederatedWechatReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWechatReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWechatReceiverList) DeepCopyInto(out *FederatedWechatReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedWechatReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatReceiverList. +func (in *FederatedWechatReceiverList) DeepCopy() *FederatedWechatReceiverList { + if in == nil { + return nil + } + out := new(FederatedWechatReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedWechatReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedWechatReceiverSpec) DeepCopyInto(out *FederatedWechatReceiverSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatReceiverSpec. +func (in *FederatedWechatReceiverSpec) DeepCopy() *FederatedWechatReceiverSpec { + if in == nil { + return nil + } + out := new(FederatedWechatReceiverSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedWorkspace) DeepCopyInto(out *FederatedWorkspace) { *out = *in @@ -2314,6 +3286,42 @@ func (in *ServiceTemplate) DeepCopy() *ServiceTemplate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackConfigTemplate) DeepCopyInto(out *SlackConfigTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigTemplate. +func (in *SlackConfigTemplate) DeepCopy() *SlackConfigTemplate { + if in == nil { + return nil + } + out := new(SlackConfigTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackReceiverTemplate) DeepCopyInto(out *SlackReceiverTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverTemplate. +func (in *SlackReceiverTemplate) DeepCopy() *SlackReceiverTemplate { + if in == nil { + return nil + } + out := new(SlackReceiverTemplate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StatefulSetTemplate) DeepCopyInto(out *StatefulSetTemplate) { *out = *in @@ -2348,6 +3356,78 @@ func (in *UserTemplate) DeepCopy() *UserTemplate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookConfigTemplate) DeepCopyInto(out *WebhookConfigTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigTemplate. +func (in *WebhookConfigTemplate) DeepCopy() *WebhookConfigTemplate { + if in == nil { + return nil + } + out := new(WebhookConfigTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookReceiverTemplate) DeepCopyInto(out *WebhookReceiverTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverTemplate. +func (in *WebhookReceiverTemplate) DeepCopy() *WebhookReceiverTemplate { + if in == nil { + return nil + } + out := new(WebhookReceiverTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatConfigTemplate) DeepCopyInto(out *WechatConfigTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigTemplate. +func (in *WechatConfigTemplate) DeepCopy() *WechatConfigTemplate { + if in == nil { + return nil + } + out := new(WechatConfigTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WechatReceiverTemplate) DeepCopyInto(out *WechatReceiverTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverTemplate. +func (in *WechatReceiverTemplate) DeepCopy() *WechatReceiverTemplate { + if in == nil { + return nil + } + out := new(WechatReceiverTemplate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkspaceRoleBindingTemplate) DeepCopyInto(out *WorkspaceRoleBindingTemplate) { *out = *in diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index de26b8103..c2f7b689f 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -37,6 +37,7 @@ import ( "k8s.io/klog" clusterv1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1" iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" audit "kubesphere.io/kubesphere/pkg/apiserver/auditing" @@ -68,6 +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" + notificationv2 "kubesphere.io/kubesphere/pkg/kapis/notification/v2" "kubesphere.io/kubesphere/pkg/kapis/oauth" openpitrixv1 "kubesphere.io/kubesphere/pkg/kapis/openpitrix/v1" operationsv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/operations/v1alpha2" @@ -270,6 +272,8 @@ 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(notificationv2.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), + s.KubernetesClient.KubeSphere())) } func (s *APIServer) Run(stopCh <-chan struct{}) (err error) { @@ -310,6 +314,16 @@ func (s *APIServer) buildHandlerChain(stopCh <-chan struct{}) { tenantv1alpha2.Resource(clusterv1alpha1.ResourcesPluralCluster), clusterv1alpha1.Resource(clusterv1alpha1.ResourcesPluralCluster), resourcev1alpha3.Resource(clusterv1alpha1.ResourcesPluralCluster), + v2.Resource(v2.ResourcesPluralDingTalkConfig), + v2.Resource(v2.ResourcesPluralDingTalkReceiver), + v2.Resource(v2.ResourcesPluralEmailReceiver), + v2.Resource(v2.ResourcesPluralEmailConfig), + v2.Resource(v2.ResourcesPluralSlackConfig), + v2.Resource(v2.ResourcesPluralSlackReceiver), + v2.Resource(v2.ResourcesPluralWebhookConfig), + v2.Resource(v2.ResourcesPluralWebhookReceiver), + v2.Resource(v2.ResourcesPluralWechatConfig), + v2.Resource(v2.ResourcesPluralWechatReceiver), }, } @@ -443,6 +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: "v2", Resource: v2.ResourcesPluralDingTalkConfig}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralDingTalkReceiver}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralEmailConfig}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralEmailReceiver}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralSlackConfig}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralSlackReceiver}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWebhookConfig}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWebhookReceiver}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWechatConfig}, + {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWechatReceiver}, } devopsGVRs := []schema.GroupVersionResource{ diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 48f01b5c6..34da827f2 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -31,6 +31,7 @@ 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" + notificationv2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2" 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" @@ -48,6 +49,7 @@ type Interface interface { DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface IamV1alpha2() iamv1alpha2.IamV1alpha2Interface NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface + NotificationV2() notificationv2.NotificationV2Interface QuotaV1alpha2() quotav1alpha2.QuotaV1alpha2Interface ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface @@ -67,6 +69,7 @@ type Clientset struct { devopsV1alpha3 *devopsv1alpha3.DevopsV1alpha3Client iamV1alpha2 *iamv1alpha2.IamV1alpha2Client networkV1alpha1 *networkv1alpha1.NetworkV1alpha1Client + notificationV2 *notificationv2.NotificationV2Client quotaV1alpha2 *quotav1alpha2.QuotaV1alpha2Client servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client storageV1alpha1 *storagev1alpha1.StorageV1alpha1Client @@ -110,6 +113,11 @@ func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface { return c.networkV1alpha1 } +// NotificationV2 retrieves the NotificationV2Client +func (c *Clientset) NotificationV2() notificationv2.NotificationV2Interface { + return c.notificationV2 +} + // QuotaV1alpha2 retrieves the QuotaV1alpha2Client func (c *Clientset) QuotaV1alpha2() quotav1alpha2.QuotaV1alpha2Interface { return c.quotaV1alpha2 @@ -189,6 +197,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.notificationV2, err = notificationv2.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.quotaV1alpha2, err = quotav1alpha2.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -232,6 +244,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.devopsV1alpha3 = devopsv1alpha3.NewForConfigOrDie(c) cs.iamV1alpha2 = iamv1alpha2.NewForConfigOrDie(c) cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c) + cs.notificationV2 = notificationv2.NewForConfigOrDie(c) cs.quotaV1alpha2 = quotav1alpha2.NewForConfigOrDie(c) cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c) cs.storageV1alpha1 = storagev1alpha1.NewForConfigOrDie(c) @@ -253,6 +266,7 @@ func New(c rest.Interface) *Clientset { cs.devopsV1alpha3 = devopsv1alpha3.New(c) cs.iamV1alpha2 = iamv1alpha2.New(c) cs.networkV1alpha1 = networkv1alpha1.New(c) + cs.notificationV2 = notificationv2.New(c) cs.quotaV1alpha2 = quotav1alpha2.New(c) cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c) cs.storageV1alpha1 = storagev1alpha1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 1bb7bd111..c63fe54b1 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -39,6 +39,8 @@ 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" + 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" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2" @@ -135,6 +137,11 @@ func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface { return &fakenetworkv1alpha1.FakeNetworkV1alpha1{Fake: &c.Fake} } +// NotificationV2 retrieves the NotificationV2Client +func (c *Clientset) NotificationV2() notificationv2.NotificationV2Interface { + return &fakenotificationv2.FakeNotificationV2{Fake: &c.Fake} +} + // QuotaV1alpha2 retrieves the QuotaV1alpha2Client func (c *Clientset) QuotaV1alpha2() quotav1alpha2.QuotaV1alpha2Interface { return &fakequotav1alpha2.FakeQuotaV1alpha2{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 3a529a6c8..c7526aa95 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -31,6 +31,7 @@ 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" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" @@ -50,6 +51,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, + notificationv2.AddToScheme, quotav1alpha2.AddToScheme, servicemeshv1alpha2.AddToScheme, storagev1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index b366e2333..12713803d 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -31,6 +31,7 @@ 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" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" @@ -50,6 +51,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, + notificationv2.AddToScheme, quotav1alpha2.AddToScheme, servicemeshv1alpha2.AddToScheme, storagev1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/typed/notification/v2/dingtalkconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/dingtalkconfig.go new file mode 100644 index 000000000..f02141ed5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/dingtalkconfig.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// DingTalkConfigsGetter has a method to return a DingTalkConfigInterface. +// A group's client should implement this interface. +type DingTalkConfigsGetter interface { + DingTalkConfigs() DingTalkConfigInterface +} + +// DingTalkConfigInterface has methods to work with DingTalkConfig resources. +type DingTalkConfigInterface interface { + Create(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.CreateOptions) (*v2.DingTalkConfig, error) + Update(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (*v2.DingTalkConfig, error) + UpdateStatus(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (*v2.DingTalkConfig, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.DingTalkConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.DingTalkConfigList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkConfig, err error) + DingTalkConfigExpansion +} + +// dingTalkConfigs implements DingTalkConfigInterface +type dingTalkConfigs struct { + client rest.Interface +} + +// newDingTalkConfigs returns a DingTalkConfigs +func newDingTalkConfigs(c *NotificationV2Client) *dingTalkConfigs { + return &dingTalkConfigs{ + client: c.RESTClient(), + } +} + +// Get takes name of the dingTalkConfig, and returns the corresponding dingTalkConfig object, and an error if there is any. +func (c *dingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkConfig, err error) { + result = &v2.DingTalkConfig{} + err = c.client.Get(). + Resource("dingtalkconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DingTalkConfigs that match those selectors. +func (c *dingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.DingTalkConfigList{} + err = c.client.Get(). + Resource("dingtalkconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested dingTalkConfigs. +func (c *dingTalkConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("dingtalkconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a dingTalkConfig and creates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. +func (c *dingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.CreateOptions) (result *v2.DingTalkConfig, err error) { + result = &v2.DingTalkConfig{} + err = c.client.Post(). + Resource("dingtalkconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(dingTalkConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a dingTalkConfig and updates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. +func (c *dingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (result *v2.DingTalkConfig, err error) { + result = &v2.DingTalkConfig{} + err = c.client.Put(). + Resource("dingtalkconfigs"). + Name(dingTalkConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(dingTalkConfig). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *dingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (result *v2.DingTalkConfig, err error) { + result = &v2.DingTalkConfig{} + err = c.client.Put(). + Resource("dingtalkconfigs"). + Name(dingTalkConfig.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(dingTalkConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the dingTalkConfig and deletes it. Returns an error if one occurs. +func (c *dingTalkConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("dingtalkconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *dingTalkConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("dingtalkconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched dingTalkConfig. +func (c *dingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkConfig, err error) { + result = &v2.DingTalkConfig{} + err = c.client.Patch(pt). + Resource("dingtalkconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/dingtalkreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/dingtalkreceiver.go new file mode 100644 index 000000000..ba801ae4f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/dingtalkreceiver.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// DingTalkReceiversGetter has a method to return a DingTalkReceiverInterface. +// A group's client should implement this interface. +type DingTalkReceiversGetter interface { + DingTalkReceivers() DingTalkReceiverInterface +} + +// DingTalkReceiverInterface has methods to work with DingTalkReceiver resources. +type DingTalkReceiverInterface interface { + Create(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.CreateOptions) (*v2.DingTalkReceiver, error) + Update(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (*v2.DingTalkReceiver, error) + UpdateStatus(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (*v2.DingTalkReceiver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.DingTalkReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.DingTalkReceiverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkReceiver, err error) + DingTalkReceiverExpansion +} + +// dingTalkReceivers implements DingTalkReceiverInterface +type dingTalkReceivers struct { + client rest.Interface +} + +// newDingTalkReceivers returns a DingTalkReceivers +func newDingTalkReceivers(c *NotificationV2Client) *dingTalkReceivers { + return &dingTalkReceivers{ + client: c.RESTClient(), + } +} + +// Get takes name of the dingTalkReceiver, and returns the corresponding dingTalkReceiver object, and an error if there is any. +func (c *dingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkReceiver, err error) { + result = &v2.DingTalkReceiver{} + err = c.client.Get(). + Resource("dingtalkreceivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DingTalkReceivers that match those selectors. +func (c *dingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkReceiverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.DingTalkReceiverList{} + err = c.client.Get(). + Resource("dingtalkreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested dingTalkReceivers. +func (c *dingTalkReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("dingtalkreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a dingTalkReceiver and creates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. +func (c *dingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.CreateOptions) (result *v2.DingTalkReceiver, err error) { + result = &v2.DingTalkReceiver{} + err = c.client.Post(). + Resource("dingtalkreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(dingTalkReceiver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a dingTalkReceiver and updates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. +func (c *dingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (result *v2.DingTalkReceiver, err error) { + result = &v2.DingTalkReceiver{} + err = c.client.Put(). + Resource("dingtalkreceivers"). + Name(dingTalkReceiver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(dingTalkReceiver). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *dingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (result *v2.DingTalkReceiver, err error) { + result = &v2.DingTalkReceiver{} + err = c.client.Put(). + Resource("dingtalkreceivers"). + Name(dingTalkReceiver.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(dingTalkReceiver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the dingTalkReceiver and deletes it. Returns an error if one occurs. +func (c *dingTalkReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("dingtalkreceivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *dingTalkReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("dingtalkreceivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched dingTalkReceiver. +func (c *dingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkReceiver, err error) { + result = &v2.DingTalkReceiver{} + err = c.client.Patch(pt). + Resource("dingtalkreceivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/doc.go b/pkg/client/clientset/versioned/typed/notification/v2/doc.go new file mode 100644 index 000000000..35a9a79f7 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v2 diff --git a/pkg/client/clientset/versioned/typed/notification/v2/emailconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/emailconfig.go new file mode 100644 index 000000000..13bc00da6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/emailconfig.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// EmailConfigsGetter has a method to return a EmailConfigInterface. +// A group's client should implement this interface. +type EmailConfigsGetter interface { + EmailConfigs() EmailConfigInterface +} + +// EmailConfigInterface has methods to work with EmailConfig resources. +type EmailConfigInterface interface { + Create(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.CreateOptions) (*v2.EmailConfig, error) + Update(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (*v2.EmailConfig, error) + UpdateStatus(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (*v2.EmailConfig, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.EmailConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.EmailConfigList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailConfig, err error) + EmailConfigExpansion +} + +// emailConfigs implements EmailConfigInterface +type emailConfigs struct { + client rest.Interface +} + +// newEmailConfigs returns a EmailConfigs +func newEmailConfigs(c *NotificationV2Client) *emailConfigs { + return &emailConfigs{ + client: c.RESTClient(), + } +} + +// Get takes name of the emailConfig, and returns the corresponding emailConfig object, and an error if there is any. +func (c *emailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailConfig, err error) { + result = &v2.EmailConfig{} + err = c.client.Get(). + Resource("emailconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of EmailConfigs that match those selectors. +func (c *emailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.EmailConfigList{} + err = c.client.Get(). + Resource("emailconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested emailConfigs. +func (c *emailConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("emailconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a emailConfig and creates it. Returns the server's representation of the emailConfig, and an error, if there is any. +func (c *emailConfigs) Create(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.CreateOptions) (result *v2.EmailConfig, err error) { + result = &v2.EmailConfig{} + err = c.client.Post(). + Resource("emailconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(emailConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a emailConfig and updates it. Returns the server's representation of the emailConfig, and an error, if there is any. +func (c *emailConfigs) Update(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (result *v2.EmailConfig, err error) { + result = &v2.EmailConfig{} + err = c.client.Put(). + Resource("emailconfigs"). + Name(emailConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(emailConfig). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *emailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (result *v2.EmailConfig, err error) { + result = &v2.EmailConfig{} + err = c.client.Put(). + Resource("emailconfigs"). + Name(emailConfig.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(emailConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the emailConfig and deletes it. Returns an error if one occurs. +func (c *emailConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("emailconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *emailConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("emailconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched emailConfig. +func (c *emailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailConfig, err error) { + result = &v2.EmailConfig{} + err = c.client.Patch(pt). + Resource("emailconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/emailreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/emailreceiver.go new file mode 100644 index 000000000..65964d6cd --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/emailreceiver.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// EmailReceiversGetter has a method to return a EmailReceiverInterface. +// A group's client should implement this interface. +type EmailReceiversGetter interface { + EmailReceivers() EmailReceiverInterface +} + +// EmailReceiverInterface has methods to work with EmailReceiver resources. +type EmailReceiverInterface interface { + Create(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.CreateOptions) (*v2.EmailReceiver, error) + Update(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (*v2.EmailReceiver, error) + UpdateStatus(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (*v2.EmailReceiver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.EmailReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.EmailReceiverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailReceiver, err error) + EmailReceiverExpansion +} + +// emailReceivers implements EmailReceiverInterface +type emailReceivers struct { + client rest.Interface +} + +// newEmailReceivers returns a EmailReceivers +func newEmailReceivers(c *NotificationV2Client) *emailReceivers { + return &emailReceivers{ + client: c.RESTClient(), + } +} + +// Get takes name of the emailReceiver, and returns the corresponding emailReceiver object, and an error if there is any. +func (c *emailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailReceiver, err error) { + result = &v2.EmailReceiver{} + err = c.client.Get(). + Resource("emailreceivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of EmailReceivers that match those selectors. +func (c *emailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailReceiverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.EmailReceiverList{} + err = c.client.Get(). + Resource("emailreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested emailReceivers. +func (c *emailReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("emailreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a emailReceiver and creates it. Returns the server's representation of the emailReceiver, and an error, if there is any. +func (c *emailReceivers) Create(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.CreateOptions) (result *v2.EmailReceiver, err error) { + result = &v2.EmailReceiver{} + err = c.client.Post(). + Resource("emailreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(emailReceiver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a emailReceiver and updates it. Returns the server's representation of the emailReceiver, and an error, if there is any. +func (c *emailReceivers) Update(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (result *v2.EmailReceiver, err error) { + result = &v2.EmailReceiver{} + err = c.client.Put(). + Resource("emailreceivers"). + Name(emailReceiver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(emailReceiver). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *emailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (result *v2.EmailReceiver, err error) { + result = &v2.EmailReceiver{} + err = c.client.Put(). + Resource("emailreceivers"). + Name(emailReceiver.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(emailReceiver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the emailReceiver and deletes it. Returns an error if one occurs. +func (c *emailReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("emailreceivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *emailReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("emailreceivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched emailReceiver. +func (c *emailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailReceiver, err error) { + result = &v2.EmailReceiver{} + err = c.client.Patch(pt). + Resource("emailreceivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/doc.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/doc.go new file mode 100644 index 000000000..7e36dbca8 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkconfig.go new file mode 100644 index 000000000..b3d6c754a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkconfig.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeDingTalkConfigs implements DingTalkConfigInterface +type FakeDingTalkConfigs struct { + Fake *FakeNotificationV2 +} + +var dingtalkconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "dingtalkconfigs"} + +var dingtalkconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "DingTalkConfig"} + +// Get takes name of the dingTalkConfig, and returns the corresponding dingTalkConfig object, and an error if there is any. +func (c *FakeDingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(dingtalkconfigsResource, name), &v2.DingTalkConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkConfig), err +} + +// List takes label and field selectors, and returns the list of DingTalkConfigs that match those selectors. +func (c *FakeDingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(dingtalkconfigsResource, dingtalkconfigsKind, opts), &v2.DingTalkConfigList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.DingTalkConfigList{ListMeta: obj.(*v2.DingTalkConfigList).ListMeta} + for _, item := range obj.(*v2.DingTalkConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested dingTalkConfigs. +func (c *FakeDingTalkConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(dingtalkconfigsResource, opts)) +} + +// Create takes the representation of a dingTalkConfig and creates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. +func (c *FakeDingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.CreateOptions) (result *v2.DingTalkConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(dingtalkconfigsResource, dingTalkConfig), &v2.DingTalkConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkConfig), err +} + +// Update takes the representation of a dingTalkConfig and updates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. +func (c *FakeDingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (result *v2.DingTalkConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(dingtalkconfigsResource, dingTalkConfig), &v2.DingTalkConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeDingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (*v2.DingTalkConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(dingtalkconfigsResource, "status", dingTalkConfig), &v2.DingTalkConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkConfig), err +} + +// Delete takes name of the dingTalkConfig and deletes it. Returns an error if one occurs. +func (c *FakeDingTalkConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(dingtalkconfigsResource, name), &v2.DingTalkConfig{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeDingTalkConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(dingtalkconfigsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.DingTalkConfigList{}) + return err +} + +// Patch applies the patch and returns the patched dingTalkConfig. +func (c *FakeDingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(dingtalkconfigsResource, name, pt, data, subresources...), &v2.DingTalkConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkConfig), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkreceiver.go new file mode 100644 index 000000000..0a918bce5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkreceiver.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeDingTalkReceivers implements DingTalkReceiverInterface +type FakeDingTalkReceivers struct { + Fake *FakeNotificationV2 +} + +var dingtalkreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "dingtalkreceivers"} + +var dingtalkreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "DingTalkReceiver"} + +// Get takes name of the dingTalkReceiver, and returns the corresponding dingTalkReceiver object, and an error if there is any. +func (c *FakeDingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(dingtalkreceiversResource, name), &v2.DingTalkReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkReceiver), err +} + +// List takes label and field selectors, and returns the list of DingTalkReceivers that match those selectors. +func (c *FakeDingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkReceiverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(dingtalkreceiversResource, dingtalkreceiversKind, opts), &v2.DingTalkReceiverList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.DingTalkReceiverList{ListMeta: obj.(*v2.DingTalkReceiverList).ListMeta} + for _, item := range obj.(*v2.DingTalkReceiverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested dingTalkReceivers. +func (c *FakeDingTalkReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(dingtalkreceiversResource, opts)) +} + +// Create takes the representation of a dingTalkReceiver and creates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. +func (c *FakeDingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.CreateOptions) (result *v2.DingTalkReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(dingtalkreceiversResource, dingTalkReceiver), &v2.DingTalkReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkReceiver), err +} + +// Update takes the representation of a dingTalkReceiver and updates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. +func (c *FakeDingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (result *v2.DingTalkReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(dingtalkreceiversResource, dingTalkReceiver), &v2.DingTalkReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkReceiver), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeDingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (*v2.DingTalkReceiver, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(dingtalkreceiversResource, "status", dingTalkReceiver), &v2.DingTalkReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkReceiver), err +} + +// Delete takes name of the dingTalkReceiver and deletes it. Returns an error if one occurs. +func (c *FakeDingTalkReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(dingtalkreceiversResource, name), &v2.DingTalkReceiver{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeDingTalkReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(dingtalkreceiversResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.DingTalkReceiverList{}) + return err +} + +// Patch applies the patch and returns the patched dingTalkReceiver. +func (c *FakeDingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(dingtalkreceiversResource, name, pt, data, subresources...), &v2.DingTalkReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.DingTalkReceiver), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailconfig.go new file mode 100644 index 000000000..54c7c513c --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailconfig.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeEmailConfigs implements EmailConfigInterface +type FakeEmailConfigs struct { + Fake *FakeNotificationV2 +} + +var emailconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "emailconfigs"} + +var emailconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "EmailConfig"} + +// Get takes name of the emailConfig, and returns the corresponding emailConfig object, and an error if there is any. +func (c *FakeEmailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(emailconfigsResource, name), &v2.EmailConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailConfig), err +} + +// List takes label and field selectors, and returns the list of EmailConfigs that match those selectors. +func (c *FakeEmailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(emailconfigsResource, emailconfigsKind, opts), &v2.EmailConfigList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.EmailConfigList{ListMeta: obj.(*v2.EmailConfigList).ListMeta} + for _, item := range obj.(*v2.EmailConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested emailConfigs. +func (c *FakeEmailConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(emailconfigsResource, opts)) +} + +// Create takes the representation of a emailConfig and creates it. Returns the server's representation of the emailConfig, and an error, if there is any. +func (c *FakeEmailConfigs) Create(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.CreateOptions) (result *v2.EmailConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(emailconfigsResource, emailConfig), &v2.EmailConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailConfig), err +} + +// Update takes the representation of a emailConfig and updates it. Returns the server's representation of the emailConfig, and an error, if there is any. +func (c *FakeEmailConfigs) Update(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (result *v2.EmailConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(emailconfigsResource, emailConfig), &v2.EmailConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeEmailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (*v2.EmailConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(emailconfigsResource, "status", emailConfig), &v2.EmailConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailConfig), err +} + +// Delete takes name of the emailConfig and deletes it. Returns an error if one occurs. +func (c *FakeEmailConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(emailconfigsResource, name), &v2.EmailConfig{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEmailConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(emailconfigsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.EmailConfigList{}) + return err +} + +// Patch applies the patch and returns the patched emailConfig. +func (c *FakeEmailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(emailconfigsResource, name, pt, data, subresources...), &v2.EmailConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailConfig), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailreceiver.go new file mode 100644 index 000000000..a4fd51cc9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailreceiver.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeEmailReceivers implements EmailReceiverInterface +type FakeEmailReceivers struct { + Fake *FakeNotificationV2 +} + +var emailreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "emailreceivers"} + +var emailreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "EmailReceiver"} + +// Get takes name of the emailReceiver, and returns the corresponding emailReceiver object, and an error if there is any. +func (c *FakeEmailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(emailreceiversResource, name), &v2.EmailReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailReceiver), err +} + +// List takes label and field selectors, and returns the list of EmailReceivers that match those selectors. +func (c *FakeEmailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailReceiverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(emailreceiversResource, emailreceiversKind, opts), &v2.EmailReceiverList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.EmailReceiverList{ListMeta: obj.(*v2.EmailReceiverList).ListMeta} + for _, item := range obj.(*v2.EmailReceiverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested emailReceivers. +func (c *FakeEmailReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(emailreceiversResource, opts)) +} + +// Create takes the representation of a emailReceiver and creates it. Returns the server's representation of the emailReceiver, and an error, if there is any. +func (c *FakeEmailReceivers) Create(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.CreateOptions) (result *v2.EmailReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(emailreceiversResource, emailReceiver), &v2.EmailReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailReceiver), err +} + +// Update takes the representation of a emailReceiver and updates it. Returns the server's representation of the emailReceiver, and an error, if there is any. +func (c *FakeEmailReceivers) Update(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (result *v2.EmailReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(emailreceiversResource, emailReceiver), &v2.EmailReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailReceiver), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeEmailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (*v2.EmailReceiver, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(emailreceiversResource, "status", emailReceiver), &v2.EmailReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailReceiver), err +} + +// Delete takes name of the emailReceiver and deletes it. Returns an error if one occurs. +func (c *FakeEmailReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(emailreceiversResource, name), &v2.EmailReceiver{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEmailReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(emailreceiversResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.EmailReceiverList{}) + return err +} + +// Patch applies the patch and returns the patched emailReceiver. +func (c *FakeEmailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(emailreceiversResource, name, pt, data, subresources...), &v2.EmailReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.EmailReceiver), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_notification_client.go new file mode 100644 index 000000000..eeb60aec4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_notification_client.go @@ -0,0 +1,76 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2" +) + +type FakeNotificationV2 struct { + *testing.Fake +} + +func (c *FakeNotificationV2) DingTalkConfigs() v2.DingTalkConfigInterface { + return &FakeDingTalkConfigs{c} +} + +func (c *FakeNotificationV2) DingTalkReceivers() v2.DingTalkReceiverInterface { + return &FakeDingTalkReceivers{c} +} + +func (c *FakeNotificationV2) EmailConfigs() v2.EmailConfigInterface { + return &FakeEmailConfigs{c} +} + +func (c *FakeNotificationV2) EmailReceivers() v2.EmailReceiverInterface { + return &FakeEmailReceivers{c} +} + +func (c *FakeNotificationV2) SlackConfigs() v2.SlackConfigInterface { + return &FakeSlackConfigs{c} +} + +func (c *FakeNotificationV2) SlackReceivers() v2.SlackReceiverInterface { + return &FakeSlackReceivers{c} +} + +func (c *FakeNotificationV2) WebhookConfigs() v2.WebhookConfigInterface { + return &FakeWebhookConfigs{c} +} + +func (c *FakeNotificationV2) WebhookReceivers() v2.WebhookReceiverInterface { + return &FakeWebhookReceivers{c} +} + +func (c *FakeNotificationV2) WechatConfigs() v2.WechatConfigInterface { + return &FakeWechatConfigs{c} +} + +func (c *FakeNotificationV2) WechatReceivers() v2.WechatReceiverInterface { + return &FakeWechatReceivers{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeNotificationV2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackconfig.go new file mode 100644 index 000000000..605bb2d4b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackconfig.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeSlackConfigs implements SlackConfigInterface +type FakeSlackConfigs struct { + Fake *FakeNotificationV2 +} + +var slackconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "slackconfigs"} + +var slackconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "SlackConfig"} + +// Get takes name of the slackConfig, and returns the corresponding slackConfig object, and an error if there is any. +func (c *FakeSlackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(slackconfigsResource, name), &v2.SlackConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackConfig), err +} + +// List takes label and field selectors, and returns the list of SlackConfigs that match those selectors. +func (c *FakeSlackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(slackconfigsResource, slackconfigsKind, opts), &v2.SlackConfigList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.SlackConfigList{ListMeta: obj.(*v2.SlackConfigList).ListMeta} + for _, item := range obj.(*v2.SlackConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested slackConfigs. +func (c *FakeSlackConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(slackconfigsResource, opts)) +} + +// Create takes the representation of a slackConfig and creates it. Returns the server's representation of the slackConfig, and an error, if there is any. +func (c *FakeSlackConfigs) Create(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.CreateOptions) (result *v2.SlackConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(slackconfigsResource, slackConfig), &v2.SlackConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackConfig), err +} + +// Update takes the representation of a slackConfig and updates it. Returns the server's representation of the slackConfig, and an error, if there is any. +func (c *FakeSlackConfigs) Update(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (result *v2.SlackConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(slackconfigsResource, slackConfig), &v2.SlackConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeSlackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (*v2.SlackConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(slackconfigsResource, "status", slackConfig), &v2.SlackConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackConfig), err +} + +// Delete takes name of the slackConfig and deletes it. Returns an error if one occurs. +func (c *FakeSlackConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(slackconfigsResource, name), &v2.SlackConfig{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSlackConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(slackconfigsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.SlackConfigList{}) + return err +} + +// Patch applies the patch and returns the patched slackConfig. +func (c *FakeSlackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(slackconfigsResource, name, pt, data, subresources...), &v2.SlackConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackConfig), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackreceiver.go new file mode 100644 index 000000000..eccd89388 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackreceiver.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeSlackReceivers implements SlackReceiverInterface +type FakeSlackReceivers struct { + Fake *FakeNotificationV2 +} + +var slackreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "slackreceivers"} + +var slackreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "SlackReceiver"} + +// Get takes name of the slackReceiver, and returns the corresponding slackReceiver object, and an error if there is any. +func (c *FakeSlackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(slackreceiversResource, name), &v2.SlackReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackReceiver), err +} + +// List takes label and field selectors, and returns the list of SlackReceivers that match those selectors. +func (c *FakeSlackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackReceiverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(slackreceiversResource, slackreceiversKind, opts), &v2.SlackReceiverList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.SlackReceiverList{ListMeta: obj.(*v2.SlackReceiverList).ListMeta} + for _, item := range obj.(*v2.SlackReceiverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested slackReceivers. +func (c *FakeSlackReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(slackreceiversResource, opts)) +} + +// Create takes the representation of a slackReceiver and creates it. Returns the server's representation of the slackReceiver, and an error, if there is any. +func (c *FakeSlackReceivers) Create(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.CreateOptions) (result *v2.SlackReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(slackreceiversResource, slackReceiver), &v2.SlackReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackReceiver), err +} + +// Update takes the representation of a slackReceiver and updates it. Returns the server's representation of the slackReceiver, and an error, if there is any. +func (c *FakeSlackReceivers) Update(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (result *v2.SlackReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(slackreceiversResource, slackReceiver), &v2.SlackReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackReceiver), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeSlackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (*v2.SlackReceiver, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(slackreceiversResource, "status", slackReceiver), &v2.SlackReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackReceiver), err +} + +// Delete takes name of the slackReceiver and deletes it. Returns an error if one occurs. +func (c *FakeSlackReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(slackreceiversResource, name), &v2.SlackReceiver{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSlackReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(slackreceiversResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.SlackReceiverList{}) + return err +} + +// Patch applies the patch and returns the patched slackReceiver. +func (c *FakeSlackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(slackreceiversResource, name, pt, data, subresources...), &v2.SlackReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.SlackReceiver), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookconfig.go new file mode 100644 index 000000000..750577235 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookconfig.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeWebhookConfigs implements WebhookConfigInterface +type FakeWebhookConfigs struct { + Fake *FakeNotificationV2 +} + +var webhookconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "webhookconfigs"} + +var webhookconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WebhookConfig"} + +// Get takes name of the webhookConfig, and returns the corresponding webhookConfig object, and an error if there is any. +func (c *FakeWebhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(webhookconfigsResource, name), &v2.WebhookConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookConfig), err +} + +// List takes label and field selectors, and returns the list of WebhookConfigs that match those selectors. +func (c *FakeWebhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(webhookconfigsResource, webhookconfigsKind, opts), &v2.WebhookConfigList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.WebhookConfigList{ListMeta: obj.(*v2.WebhookConfigList).ListMeta} + for _, item := range obj.(*v2.WebhookConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested webhookConfigs. +func (c *FakeWebhookConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(webhookconfigsResource, opts)) +} + +// Create takes the representation of a webhookConfig and creates it. Returns the server's representation of the webhookConfig, and an error, if there is any. +func (c *FakeWebhookConfigs) Create(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.CreateOptions) (result *v2.WebhookConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(webhookconfigsResource, webhookConfig), &v2.WebhookConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookConfig), err +} + +// Update takes the representation of a webhookConfig and updates it. Returns the server's representation of the webhookConfig, and an error, if there is any. +func (c *FakeWebhookConfigs) Update(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (result *v2.WebhookConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(webhookconfigsResource, webhookConfig), &v2.WebhookConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeWebhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (*v2.WebhookConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(webhookconfigsResource, "status", webhookConfig), &v2.WebhookConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookConfig), err +} + +// Delete takes name of the webhookConfig and deletes it. Returns an error if one occurs. +func (c *FakeWebhookConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(webhookconfigsResource, name), &v2.WebhookConfig{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeWebhookConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(webhookconfigsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.WebhookConfigList{}) + return err +} + +// Patch applies the patch and returns the patched webhookConfig. +func (c *FakeWebhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(webhookconfigsResource, name, pt, data, subresources...), &v2.WebhookConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookConfig), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookreceiver.go new file mode 100644 index 000000000..ae59dd3db --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookreceiver.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeWebhookReceivers implements WebhookReceiverInterface +type FakeWebhookReceivers struct { + Fake *FakeNotificationV2 +} + +var webhookreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "webhookreceivers"} + +var webhookreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WebhookReceiver"} + +// Get takes name of the webhookReceiver, and returns the corresponding webhookReceiver object, and an error if there is any. +func (c *FakeWebhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(webhookreceiversResource, name), &v2.WebhookReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookReceiver), err +} + +// List takes label and field selectors, and returns the list of WebhookReceivers that match those selectors. +func (c *FakeWebhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookReceiverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(webhookreceiversResource, webhookreceiversKind, opts), &v2.WebhookReceiverList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.WebhookReceiverList{ListMeta: obj.(*v2.WebhookReceiverList).ListMeta} + for _, item := range obj.(*v2.WebhookReceiverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested webhookReceivers. +func (c *FakeWebhookReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(webhookreceiversResource, opts)) +} + +// Create takes the representation of a webhookReceiver and creates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. +func (c *FakeWebhookReceivers) Create(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.CreateOptions) (result *v2.WebhookReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(webhookreceiversResource, webhookReceiver), &v2.WebhookReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookReceiver), err +} + +// Update takes the representation of a webhookReceiver and updates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. +func (c *FakeWebhookReceivers) Update(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (result *v2.WebhookReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(webhookreceiversResource, webhookReceiver), &v2.WebhookReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookReceiver), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeWebhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (*v2.WebhookReceiver, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(webhookreceiversResource, "status", webhookReceiver), &v2.WebhookReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookReceiver), err +} + +// Delete takes name of the webhookReceiver and deletes it. Returns an error if one occurs. +func (c *FakeWebhookReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(webhookreceiversResource, name), &v2.WebhookReceiver{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeWebhookReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(webhookreceiversResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.WebhookReceiverList{}) + return err +} + +// Patch applies the patch and returns the patched webhookReceiver. +func (c *FakeWebhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(webhookreceiversResource, name, pt, data, subresources...), &v2.WebhookReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WebhookReceiver), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatconfig.go new file mode 100644 index 000000000..a30069674 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatconfig.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeWechatConfigs implements WechatConfigInterface +type FakeWechatConfigs struct { + Fake *FakeNotificationV2 +} + +var wechatconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "wechatconfigs"} + +var wechatconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WechatConfig"} + +// Get takes name of the wechatConfig, and returns the corresponding wechatConfig object, and an error if there is any. +func (c *FakeWechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(wechatconfigsResource, name), &v2.WechatConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatConfig), err +} + +// List takes label and field selectors, and returns the list of WechatConfigs that match those selectors. +func (c *FakeWechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(wechatconfigsResource, wechatconfigsKind, opts), &v2.WechatConfigList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.WechatConfigList{ListMeta: obj.(*v2.WechatConfigList).ListMeta} + for _, item := range obj.(*v2.WechatConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested wechatConfigs. +func (c *FakeWechatConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(wechatconfigsResource, opts)) +} + +// Create takes the representation of a wechatConfig and creates it. Returns the server's representation of the wechatConfig, and an error, if there is any. +func (c *FakeWechatConfigs) Create(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.CreateOptions) (result *v2.WechatConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(wechatconfigsResource, wechatConfig), &v2.WechatConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatConfig), err +} + +// Update takes the representation of a wechatConfig and updates it. Returns the server's representation of the wechatConfig, and an error, if there is any. +func (c *FakeWechatConfigs) Update(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (result *v2.WechatConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(wechatconfigsResource, wechatConfig), &v2.WechatConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeWechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (*v2.WechatConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(wechatconfigsResource, "status", wechatConfig), &v2.WechatConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatConfig), err +} + +// Delete takes name of the wechatConfig and deletes it. Returns an error if one occurs. +func (c *FakeWechatConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(wechatconfigsResource, name), &v2.WechatConfig{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeWechatConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(wechatconfigsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.WechatConfigList{}) + return err +} + +// Patch applies the patch and returns the patched wechatConfig. +func (c *FakeWechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(wechatconfigsResource, name, pt, data, subresources...), &v2.WechatConfig{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatConfig), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatreceiver.go new file mode 100644 index 000000000..e337b10a5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatreceiver.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// FakeWechatReceivers implements WechatReceiverInterface +type FakeWechatReceivers struct { + Fake *FakeNotificationV2 +} + +var wechatreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "wechatreceivers"} + +var wechatreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WechatReceiver"} + +// Get takes name of the wechatReceiver, and returns the corresponding wechatReceiver object, and an error if there is any. +func (c *FakeWechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(wechatreceiversResource, name), &v2.WechatReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatReceiver), err +} + +// List takes label and field selectors, and returns the list of WechatReceivers that match those selectors. +func (c *FakeWechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatReceiverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(wechatreceiversResource, wechatreceiversKind, opts), &v2.WechatReceiverList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.WechatReceiverList{ListMeta: obj.(*v2.WechatReceiverList).ListMeta} + for _, item := range obj.(*v2.WechatReceiverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested wechatReceivers. +func (c *FakeWechatReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(wechatreceiversResource, opts)) +} + +// Create takes the representation of a wechatReceiver and creates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. +func (c *FakeWechatReceivers) Create(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.CreateOptions) (result *v2.WechatReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(wechatreceiversResource, wechatReceiver), &v2.WechatReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatReceiver), err +} + +// Update takes the representation of a wechatReceiver and updates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. +func (c *FakeWechatReceivers) Update(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (result *v2.WechatReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(wechatreceiversResource, wechatReceiver), &v2.WechatReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatReceiver), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeWechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (*v2.WechatReceiver, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(wechatreceiversResource, "status", wechatReceiver), &v2.WechatReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatReceiver), err +} + +// Delete takes name of the wechatReceiver and deletes it. Returns an error if one occurs. +func (c *FakeWechatReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(wechatreceiversResource, name), &v2.WechatReceiver{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeWechatReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(wechatreceiversResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2.WechatReceiverList{}) + return err +} + +// Patch applies the patch and returns the patched wechatReceiver. +func (c *FakeWechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatReceiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(wechatreceiversResource, name, pt, data, subresources...), &v2.WechatReceiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2.WechatReceiver), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/generated_expansion.go b/pkg/client/clientset/versioned/typed/notification/v2/generated_expansion.go new file mode 100644 index 000000000..37b7f21a9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/generated_expansion.go @@ -0,0 +1,39 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +type DingTalkConfigExpansion interface{} + +type DingTalkReceiverExpansion interface{} + +type EmailConfigExpansion interface{} + +type EmailReceiverExpansion interface{} + +type SlackConfigExpansion interface{} + +type SlackReceiverExpansion interface{} + +type WebhookConfigExpansion interface{} + +type WebhookReceiverExpansion interface{} + +type WechatConfigExpansion interface{} + +type WechatReceiverExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2/notification_client.go new file mode 100644 index 000000000..ac14cb642 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/notification_client.go @@ -0,0 +1,134 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +type NotificationV2Interface interface { + RESTClient() rest.Interface + DingTalkConfigsGetter + DingTalkReceiversGetter + EmailConfigsGetter + EmailReceiversGetter + SlackConfigsGetter + SlackReceiversGetter + WebhookConfigsGetter + WebhookReceiversGetter + WechatConfigsGetter + WechatReceiversGetter +} + +// NotificationV2Client is used to interact with features provided by the notification.kubesphere.io group. +type NotificationV2Client struct { + restClient rest.Interface +} + +func (c *NotificationV2Client) DingTalkConfigs() DingTalkConfigInterface { + return newDingTalkConfigs(c) +} + +func (c *NotificationV2Client) DingTalkReceivers() DingTalkReceiverInterface { + return newDingTalkReceivers(c) +} + +func (c *NotificationV2Client) EmailConfigs() EmailConfigInterface { + return newEmailConfigs(c) +} + +func (c *NotificationV2Client) EmailReceivers() EmailReceiverInterface { + return newEmailReceivers(c) +} + +func (c *NotificationV2Client) SlackConfigs() SlackConfigInterface { + return newSlackConfigs(c) +} + +func (c *NotificationV2Client) SlackReceivers() SlackReceiverInterface { + return newSlackReceivers(c) +} + +func (c *NotificationV2Client) WebhookConfigs() WebhookConfigInterface { + return newWebhookConfigs(c) +} + +func (c *NotificationV2Client) WebhookReceivers() WebhookReceiverInterface { + return newWebhookReceivers(c) +} + +func (c *NotificationV2Client) WechatConfigs() WechatConfigInterface { + return newWechatConfigs(c) +} + +func (c *NotificationV2Client) WechatReceivers() WechatReceiverInterface { + return newWechatReceivers(c) +} + +// NewForConfig creates a new NotificationV2Client for the given config. +func NewForConfig(c *rest.Config) (*NotificationV2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &NotificationV2Client{client}, nil +} + +// NewForConfigOrDie creates a new NotificationV2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *NotificationV2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new NotificationV2Client for the given RESTClient. +func New(c rest.Interface) *NotificationV2Client { + return &NotificationV2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *NotificationV2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/slackconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/slackconfig.go new file mode 100644 index 000000000..c1919a0f0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/slackconfig.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// SlackConfigsGetter has a method to return a SlackConfigInterface. +// A group's client should implement this interface. +type SlackConfigsGetter interface { + SlackConfigs() SlackConfigInterface +} + +// SlackConfigInterface has methods to work with SlackConfig resources. +type SlackConfigInterface interface { + Create(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.CreateOptions) (*v2.SlackConfig, error) + Update(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (*v2.SlackConfig, error) + UpdateStatus(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (*v2.SlackConfig, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.SlackConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.SlackConfigList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackConfig, err error) + SlackConfigExpansion +} + +// slackConfigs implements SlackConfigInterface +type slackConfigs struct { + client rest.Interface +} + +// newSlackConfigs returns a SlackConfigs +func newSlackConfigs(c *NotificationV2Client) *slackConfigs { + return &slackConfigs{ + client: c.RESTClient(), + } +} + +// Get takes name of the slackConfig, and returns the corresponding slackConfig object, and an error if there is any. +func (c *slackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackConfig, err error) { + result = &v2.SlackConfig{} + err = c.client.Get(). + Resource("slackconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SlackConfigs that match those selectors. +func (c *slackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.SlackConfigList{} + err = c.client.Get(). + Resource("slackconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested slackConfigs. +func (c *slackConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("slackconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a slackConfig and creates it. Returns the server's representation of the slackConfig, and an error, if there is any. +func (c *slackConfigs) Create(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.CreateOptions) (result *v2.SlackConfig, err error) { + result = &v2.SlackConfig{} + err = c.client.Post(). + Resource("slackconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(slackConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a slackConfig and updates it. Returns the server's representation of the slackConfig, and an error, if there is any. +func (c *slackConfigs) Update(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (result *v2.SlackConfig, err error) { + result = &v2.SlackConfig{} + err = c.client.Put(). + Resource("slackconfigs"). + Name(slackConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(slackConfig). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *slackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (result *v2.SlackConfig, err error) { + result = &v2.SlackConfig{} + err = c.client.Put(). + Resource("slackconfigs"). + Name(slackConfig.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(slackConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the slackConfig and deletes it. Returns an error if one occurs. +func (c *slackConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("slackconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *slackConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("slackconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched slackConfig. +func (c *slackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackConfig, err error) { + result = &v2.SlackConfig{} + err = c.client.Patch(pt). + Resource("slackconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/slackreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/slackreceiver.go new file mode 100644 index 000000000..5a280fa3f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/slackreceiver.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// SlackReceiversGetter has a method to return a SlackReceiverInterface. +// A group's client should implement this interface. +type SlackReceiversGetter interface { + SlackReceivers() SlackReceiverInterface +} + +// SlackReceiverInterface has methods to work with SlackReceiver resources. +type SlackReceiverInterface interface { + Create(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.CreateOptions) (*v2.SlackReceiver, error) + Update(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (*v2.SlackReceiver, error) + UpdateStatus(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (*v2.SlackReceiver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.SlackReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.SlackReceiverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackReceiver, err error) + SlackReceiverExpansion +} + +// slackReceivers implements SlackReceiverInterface +type slackReceivers struct { + client rest.Interface +} + +// newSlackReceivers returns a SlackReceivers +func newSlackReceivers(c *NotificationV2Client) *slackReceivers { + return &slackReceivers{ + client: c.RESTClient(), + } +} + +// Get takes name of the slackReceiver, and returns the corresponding slackReceiver object, and an error if there is any. +func (c *slackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackReceiver, err error) { + result = &v2.SlackReceiver{} + err = c.client.Get(). + Resource("slackreceivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SlackReceivers that match those selectors. +func (c *slackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackReceiverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.SlackReceiverList{} + err = c.client.Get(). + Resource("slackreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested slackReceivers. +func (c *slackReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("slackreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a slackReceiver and creates it. Returns the server's representation of the slackReceiver, and an error, if there is any. +func (c *slackReceivers) Create(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.CreateOptions) (result *v2.SlackReceiver, err error) { + result = &v2.SlackReceiver{} + err = c.client.Post(). + Resource("slackreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(slackReceiver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a slackReceiver and updates it. Returns the server's representation of the slackReceiver, and an error, if there is any. +func (c *slackReceivers) Update(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (result *v2.SlackReceiver, err error) { + result = &v2.SlackReceiver{} + err = c.client.Put(). + Resource("slackreceivers"). + Name(slackReceiver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(slackReceiver). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *slackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (result *v2.SlackReceiver, err error) { + result = &v2.SlackReceiver{} + err = c.client.Put(). + Resource("slackreceivers"). + Name(slackReceiver.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(slackReceiver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the slackReceiver and deletes it. Returns an error if one occurs. +func (c *slackReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("slackreceivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *slackReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("slackreceivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched slackReceiver. +func (c *slackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackReceiver, err error) { + result = &v2.SlackReceiver{} + err = c.client.Patch(pt). + Resource("slackreceivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/webhookconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/webhookconfig.go new file mode 100644 index 000000000..6d69cf2e8 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/webhookconfig.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// WebhookConfigsGetter has a method to return a WebhookConfigInterface. +// A group's client should implement this interface. +type WebhookConfigsGetter interface { + WebhookConfigs() WebhookConfigInterface +} + +// WebhookConfigInterface has methods to work with WebhookConfig resources. +type WebhookConfigInterface interface { + Create(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.CreateOptions) (*v2.WebhookConfig, error) + Update(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (*v2.WebhookConfig, error) + UpdateStatus(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (*v2.WebhookConfig, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WebhookConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.WebhookConfigList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookConfig, err error) + WebhookConfigExpansion +} + +// webhookConfigs implements WebhookConfigInterface +type webhookConfigs struct { + client rest.Interface +} + +// newWebhookConfigs returns a WebhookConfigs +func newWebhookConfigs(c *NotificationV2Client) *webhookConfigs { + return &webhookConfigs{ + client: c.RESTClient(), + } +} + +// Get takes name of the webhookConfig, and returns the corresponding webhookConfig object, and an error if there is any. +func (c *webhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookConfig, err error) { + result = &v2.WebhookConfig{} + err = c.client.Get(). + Resource("webhookconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of WebhookConfigs that match those selectors. +func (c *webhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.WebhookConfigList{} + err = c.client.Get(). + Resource("webhookconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested webhookConfigs. +func (c *webhookConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("webhookconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a webhookConfig and creates it. Returns the server's representation of the webhookConfig, and an error, if there is any. +func (c *webhookConfigs) Create(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.CreateOptions) (result *v2.WebhookConfig, err error) { + result = &v2.WebhookConfig{} + err = c.client.Post(). + Resource("webhookconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(webhookConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a webhookConfig and updates it. Returns the server's representation of the webhookConfig, and an error, if there is any. +func (c *webhookConfigs) Update(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (result *v2.WebhookConfig, err error) { + result = &v2.WebhookConfig{} + err = c.client.Put(). + Resource("webhookconfigs"). + Name(webhookConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(webhookConfig). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *webhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (result *v2.WebhookConfig, err error) { + result = &v2.WebhookConfig{} + err = c.client.Put(). + Resource("webhookconfigs"). + Name(webhookConfig.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(webhookConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the webhookConfig and deletes it. Returns an error if one occurs. +func (c *webhookConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("webhookconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *webhookConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("webhookconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched webhookConfig. +func (c *webhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookConfig, err error) { + result = &v2.WebhookConfig{} + err = c.client.Patch(pt). + Resource("webhookconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/webhookreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/webhookreceiver.go new file mode 100644 index 000000000..9072d03fd --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/webhookreceiver.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// WebhookReceiversGetter has a method to return a WebhookReceiverInterface. +// A group's client should implement this interface. +type WebhookReceiversGetter interface { + WebhookReceivers() WebhookReceiverInterface +} + +// WebhookReceiverInterface has methods to work with WebhookReceiver resources. +type WebhookReceiverInterface interface { + Create(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.CreateOptions) (*v2.WebhookReceiver, error) + Update(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (*v2.WebhookReceiver, error) + UpdateStatus(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (*v2.WebhookReceiver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WebhookReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.WebhookReceiverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookReceiver, err error) + WebhookReceiverExpansion +} + +// webhookReceivers implements WebhookReceiverInterface +type webhookReceivers struct { + client rest.Interface +} + +// newWebhookReceivers returns a WebhookReceivers +func newWebhookReceivers(c *NotificationV2Client) *webhookReceivers { + return &webhookReceivers{ + client: c.RESTClient(), + } +} + +// Get takes name of the webhookReceiver, and returns the corresponding webhookReceiver object, and an error if there is any. +func (c *webhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookReceiver, err error) { + result = &v2.WebhookReceiver{} + err = c.client.Get(). + Resource("webhookreceivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of WebhookReceivers that match those selectors. +func (c *webhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookReceiverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.WebhookReceiverList{} + err = c.client.Get(). + Resource("webhookreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested webhookReceivers. +func (c *webhookReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("webhookreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a webhookReceiver and creates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. +func (c *webhookReceivers) Create(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.CreateOptions) (result *v2.WebhookReceiver, err error) { + result = &v2.WebhookReceiver{} + err = c.client.Post(). + Resource("webhookreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(webhookReceiver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a webhookReceiver and updates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. +func (c *webhookReceivers) Update(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (result *v2.WebhookReceiver, err error) { + result = &v2.WebhookReceiver{} + err = c.client.Put(). + Resource("webhookreceivers"). + Name(webhookReceiver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(webhookReceiver). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *webhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (result *v2.WebhookReceiver, err error) { + result = &v2.WebhookReceiver{} + err = c.client.Put(). + Resource("webhookreceivers"). + Name(webhookReceiver.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(webhookReceiver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the webhookReceiver and deletes it. Returns an error if one occurs. +func (c *webhookReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("webhookreceivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *webhookReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("webhookreceivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched webhookReceiver. +func (c *webhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookReceiver, err error) { + result = &v2.WebhookReceiver{} + err = c.client.Patch(pt). + Resource("webhookreceivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/wechatconfig.go b/pkg/client/clientset/versioned/typed/notification/v2/wechatconfig.go new file mode 100644 index 000000000..e850bc36e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/wechatconfig.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// WechatConfigsGetter has a method to return a WechatConfigInterface. +// A group's client should implement this interface. +type WechatConfigsGetter interface { + WechatConfigs() WechatConfigInterface +} + +// WechatConfigInterface has methods to work with WechatConfig resources. +type WechatConfigInterface interface { + Create(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.CreateOptions) (*v2.WechatConfig, error) + Update(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (*v2.WechatConfig, error) + UpdateStatus(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (*v2.WechatConfig, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WechatConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.WechatConfigList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatConfig, err error) + WechatConfigExpansion +} + +// wechatConfigs implements WechatConfigInterface +type wechatConfigs struct { + client rest.Interface +} + +// newWechatConfigs returns a WechatConfigs +func newWechatConfigs(c *NotificationV2Client) *wechatConfigs { + return &wechatConfigs{ + client: c.RESTClient(), + } +} + +// Get takes name of the wechatConfig, and returns the corresponding wechatConfig object, and an error if there is any. +func (c *wechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatConfig, err error) { + result = &v2.WechatConfig{} + err = c.client.Get(). + Resource("wechatconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of WechatConfigs that match those selectors. +func (c *wechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.WechatConfigList{} + err = c.client.Get(). + Resource("wechatconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested wechatConfigs. +func (c *wechatConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("wechatconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a wechatConfig and creates it. Returns the server's representation of the wechatConfig, and an error, if there is any. +func (c *wechatConfigs) Create(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.CreateOptions) (result *v2.WechatConfig, err error) { + result = &v2.WechatConfig{} + err = c.client.Post(). + Resource("wechatconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(wechatConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a wechatConfig and updates it. Returns the server's representation of the wechatConfig, and an error, if there is any. +func (c *wechatConfigs) Update(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (result *v2.WechatConfig, err error) { + result = &v2.WechatConfig{} + err = c.client.Put(). + Resource("wechatconfigs"). + Name(wechatConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(wechatConfig). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *wechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (result *v2.WechatConfig, err error) { + result = &v2.WechatConfig{} + err = c.client.Put(). + Resource("wechatconfigs"). + Name(wechatConfig.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(wechatConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the wechatConfig and deletes it. Returns an error if one occurs. +func (c *wechatConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("wechatconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *wechatConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("wechatconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched wechatConfig. +func (c *wechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatConfig, err error) { + result = &v2.WechatConfig{} + err = c.client.Patch(pt). + Resource("wechatconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/wechatreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2/wechatreceiver.go new file mode 100644 index 000000000..9cf9145b0 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2/wechatreceiver.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// WechatReceiversGetter has a method to return a WechatReceiverInterface. +// A group's client should implement this interface. +type WechatReceiversGetter interface { + WechatReceivers() WechatReceiverInterface +} + +// WechatReceiverInterface has methods to work with WechatReceiver resources. +type WechatReceiverInterface interface { + Create(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.CreateOptions) (*v2.WechatReceiver, error) + Update(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (*v2.WechatReceiver, error) + UpdateStatus(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (*v2.WechatReceiver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WechatReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.WechatReceiverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatReceiver, err error) + WechatReceiverExpansion +} + +// wechatReceivers implements WechatReceiverInterface +type wechatReceivers struct { + client rest.Interface +} + +// newWechatReceivers returns a WechatReceivers +func newWechatReceivers(c *NotificationV2Client) *wechatReceivers { + return &wechatReceivers{ + client: c.RESTClient(), + } +} + +// Get takes name of the wechatReceiver, and returns the corresponding wechatReceiver object, and an error if there is any. +func (c *wechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatReceiver, err error) { + result = &v2.WechatReceiver{} + err = c.client.Get(). + Resource("wechatreceivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of WechatReceivers that match those selectors. +func (c *wechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatReceiverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.WechatReceiverList{} + err = c.client.Get(). + Resource("wechatreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested wechatReceivers. +func (c *wechatReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("wechatreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a wechatReceiver and creates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. +func (c *wechatReceivers) Create(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.CreateOptions) (result *v2.WechatReceiver, err error) { + result = &v2.WechatReceiver{} + err = c.client.Post(). + Resource("wechatreceivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(wechatReceiver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a wechatReceiver and updates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. +func (c *wechatReceivers) Update(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (result *v2.WechatReceiver, err error) { + result = &v2.WechatReceiver{} + err = c.client.Put(). + Resource("wechatreceivers"). + Name(wechatReceiver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(wechatReceiver). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *wechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (result *v2.WechatReceiver, err error) { + result = &v2.WechatReceiver{} + err = c.client.Put(). + Resource("wechatreceivers"). + Name(wechatReceiver.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(wechatReceiver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the wechatReceiver and deletes it. Returns an error if one occurs. +func (c *wechatReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("wechatreceivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *wechatReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("wechatreceivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched wechatReceiver. +func (c *wechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatReceiver, err error) { + result = &v2.WechatReceiver{} + err = c.client.Patch(pt). + Resource("wechatreceivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 49260176b..efde8e5b3 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -35,6 +35,7 @@ import ( iam "kubesphere.io/kubesphere/pkg/client/informers/externalversions/iam" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" network "kubesphere.io/kubesphere/pkg/client/informers/externalversions/network" + notification "kubesphere.io/kubesphere/pkg/client/informers/externalversions/notification" quota "kubesphere.io/kubesphere/pkg/client/informers/externalversions/quota" servicemesh "kubesphere.io/kubesphere/pkg/client/informers/externalversions/servicemesh" storage "kubesphere.io/kubesphere/pkg/client/informers/externalversions/storage" @@ -188,6 +189,7 @@ type SharedInformerFactory interface { Devops() devops.Interface Iam() iam.Interface Network() network.Interface + Notification() notification.Interface Quota() quota.Interface Servicemesh() servicemesh.Interface Storage() storage.Interface @@ -219,6 +221,10 @@ func (f *sharedInformerFactory) Network() network.Interface { return network.New(f, f.namespace, f.tweakListOptions) } +func (f *sharedInformerFactory) Notification() notification.Interface { + return notification.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Quota() quota.Interface { return quota.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index f0c144604..fe74bb2c5 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -30,6 +30,7 @@ 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" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" @@ -132,6 +133,28 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case networkv1alpha1.SchemeGroupVersion.WithResource("namespacenetworkpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().NamespaceNetworkPolicies().Informer()}, nil + // Group=notification.kubesphere.io, Version=v2 + case v2.SchemeGroupVersion.WithResource("dingtalkconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().DingTalkConfigs().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("dingtalkreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().DingTalkReceivers().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("emailconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().EmailConfigs().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("emailreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().EmailReceivers().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("slackconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().SlackConfigs().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("slackreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().SlackReceivers().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("webhookconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WebhookConfigs().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("webhookreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WebhookReceivers().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("wechatconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WechatConfigs().Informer()}, nil + case v2.SchemeGroupVersion.WithResource("wechatreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WechatReceivers().Informer()}, nil + // Group=quota.kubesphere.io, Version=v1alpha2 case quotav1alpha2.SchemeGroupVersion.WithResource("resourcequotas"): return &genericInformer{resource: resource.GroupResource(), informer: f.Quota().V1alpha2().ResourceQuotas().Informer()}, nil diff --git a/pkg/client/informers/externalversions/notification/interface.go b/pkg/client/informers/externalversions/notification/interface.go new file mode 100644 index 000000000..c5d31fdf3 --- /dev/null +++ b/pkg/client/informers/externalversions/notification/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package notification + +import ( + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/notification/v2" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V2 provides access to shared informers for resources in V2. + V2() v2.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V2 returns a new v2.Interface. +func (g *group) V2() v2.Interface { + return v2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/notification/v2/dingtalkconfig.go b/pkg/client/informers/externalversions/notification/v2/dingtalkconfig.go new file mode 100644 index 000000000..1cbd67536 --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/dingtalkconfig.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// DingTalkConfigInformer provides access to a shared informer and lister for +// DingTalkConfigs. +type DingTalkConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.DingTalkConfigLister +} + +type dingTalkConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewDingTalkConfigInformer constructs a new informer for DingTalkConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDingTalkConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDingTalkConfigInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredDingTalkConfigInformer constructs a new informer for DingTalkConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDingTalkConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().DingTalkConfigs().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().DingTalkConfigs().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.DingTalkConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *dingTalkConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDingTalkConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *dingTalkConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.DingTalkConfig{}, f.defaultInformer) +} + +func (f *dingTalkConfigInformer) Lister() v2.DingTalkConfigLister { + return v2.NewDingTalkConfigLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/dingtalkreceiver.go b/pkg/client/informers/externalversions/notification/v2/dingtalkreceiver.go new file mode 100644 index 000000000..3c4f4d362 --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/dingtalkreceiver.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// DingTalkReceiverInformer provides access to a shared informer and lister for +// DingTalkReceivers. +type DingTalkReceiverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.DingTalkReceiverLister +} + +type dingTalkReceiverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewDingTalkReceiverInformer constructs a new informer for DingTalkReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDingTalkReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDingTalkReceiverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredDingTalkReceiverInformer constructs a new informer for DingTalkReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDingTalkReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().DingTalkReceivers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().DingTalkReceivers().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.DingTalkReceiver{}, + resyncPeriod, + indexers, + ) +} + +func (f *dingTalkReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDingTalkReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *dingTalkReceiverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.DingTalkReceiver{}, f.defaultInformer) +} + +func (f *dingTalkReceiverInformer) Lister() v2.DingTalkReceiverLister { + return v2.NewDingTalkReceiverLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/emailconfig.go b/pkg/client/informers/externalversions/notification/v2/emailconfig.go new file mode 100644 index 000000000..a7860894a --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/emailconfig.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// EmailConfigInformer provides access to a shared informer and lister for +// EmailConfigs. +type EmailConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.EmailConfigLister +} + +type emailConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewEmailConfigInformer constructs a new informer for EmailConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEmailConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEmailConfigInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredEmailConfigInformer constructs a new informer for EmailConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEmailConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().EmailConfigs().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().EmailConfigs().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.EmailConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *emailConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEmailConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *emailConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.EmailConfig{}, f.defaultInformer) +} + +func (f *emailConfigInformer) Lister() v2.EmailConfigLister { + return v2.NewEmailConfigLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/emailreceiver.go b/pkg/client/informers/externalversions/notification/v2/emailreceiver.go new file mode 100644 index 000000000..a49a32b7d --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/emailreceiver.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// EmailReceiverInformer provides access to a shared informer and lister for +// EmailReceivers. +type EmailReceiverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.EmailReceiverLister +} + +type emailReceiverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewEmailReceiverInformer constructs a new informer for EmailReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEmailReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEmailReceiverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredEmailReceiverInformer constructs a new informer for EmailReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEmailReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().EmailReceivers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().EmailReceivers().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.EmailReceiver{}, + resyncPeriod, + indexers, + ) +} + +func (f *emailReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEmailReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *emailReceiverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.EmailReceiver{}, f.defaultInformer) +} + +func (f *emailReceiverInformer) Lister() v2.EmailReceiverLister { + return v2.NewEmailReceiverLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/interface.go b/pkg/client/informers/externalversions/notification/v2/interface.go new file mode 100644 index 000000000..a1afb6e0d --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/interface.go @@ -0,0 +1,108 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // DingTalkConfigs returns a DingTalkConfigInformer. + DingTalkConfigs() DingTalkConfigInformer + // DingTalkReceivers returns a DingTalkReceiverInformer. + DingTalkReceivers() DingTalkReceiverInformer + // EmailConfigs returns a EmailConfigInformer. + EmailConfigs() EmailConfigInformer + // EmailReceivers returns a EmailReceiverInformer. + EmailReceivers() EmailReceiverInformer + // SlackConfigs returns a SlackConfigInformer. + SlackConfigs() SlackConfigInformer + // SlackReceivers returns a SlackReceiverInformer. + SlackReceivers() SlackReceiverInformer + // WebhookConfigs returns a WebhookConfigInformer. + WebhookConfigs() WebhookConfigInformer + // WebhookReceivers returns a WebhookReceiverInformer. + WebhookReceivers() WebhookReceiverInformer + // WechatConfigs returns a WechatConfigInformer. + WechatConfigs() WechatConfigInformer + // WechatReceivers returns a WechatReceiverInformer. + WechatReceivers() WechatReceiverInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// DingTalkConfigs returns a DingTalkConfigInformer. +func (v *version) DingTalkConfigs() DingTalkConfigInformer { + return &dingTalkConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// DingTalkReceivers returns a DingTalkReceiverInformer. +func (v *version) DingTalkReceivers() DingTalkReceiverInformer { + return &dingTalkReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// EmailConfigs returns a EmailConfigInformer. +func (v *version) EmailConfigs() EmailConfigInformer { + return &emailConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// EmailReceivers returns a EmailReceiverInformer. +func (v *version) EmailReceivers() EmailReceiverInformer { + return &emailReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// SlackConfigs returns a SlackConfigInformer. +func (v *version) SlackConfigs() SlackConfigInformer { + return &slackConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// SlackReceivers returns a SlackReceiverInformer. +func (v *version) SlackReceivers() SlackReceiverInformer { + return &slackReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// WebhookConfigs returns a WebhookConfigInformer. +func (v *version) WebhookConfigs() WebhookConfigInformer { + return &webhookConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// WebhookReceivers returns a WebhookReceiverInformer. +func (v *version) WebhookReceivers() WebhookReceiverInformer { + return &webhookReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// WechatConfigs returns a WechatConfigInformer. +func (v *version) WechatConfigs() WechatConfigInformer { + return &wechatConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// WechatReceivers returns a WechatReceiverInformer. +func (v *version) WechatReceivers() WechatReceiverInformer { + return &wechatReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/notification/v2/slackconfig.go b/pkg/client/informers/externalversions/notification/v2/slackconfig.go new file mode 100644 index 000000000..c326cd90a --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/slackconfig.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// SlackConfigInformer provides access to a shared informer and lister for +// SlackConfigs. +type SlackConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.SlackConfigLister +} + +type slackConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewSlackConfigInformer constructs a new informer for SlackConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSlackConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSlackConfigInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredSlackConfigInformer constructs a new informer for SlackConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSlackConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().SlackConfigs().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().SlackConfigs().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.SlackConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *slackConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSlackConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *slackConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.SlackConfig{}, f.defaultInformer) +} + +func (f *slackConfigInformer) Lister() v2.SlackConfigLister { + return v2.NewSlackConfigLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/slackreceiver.go b/pkg/client/informers/externalversions/notification/v2/slackreceiver.go new file mode 100644 index 000000000..89fe1e10e --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/slackreceiver.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// SlackReceiverInformer provides access to a shared informer and lister for +// SlackReceivers. +type SlackReceiverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.SlackReceiverLister +} + +type slackReceiverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewSlackReceiverInformer constructs a new informer for SlackReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSlackReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSlackReceiverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredSlackReceiverInformer constructs a new informer for SlackReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSlackReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().SlackReceivers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().SlackReceivers().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.SlackReceiver{}, + resyncPeriod, + indexers, + ) +} + +func (f *slackReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSlackReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *slackReceiverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.SlackReceiver{}, f.defaultInformer) +} + +func (f *slackReceiverInformer) Lister() v2.SlackReceiverLister { + return v2.NewSlackReceiverLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/webhookconfig.go b/pkg/client/informers/externalversions/notification/v2/webhookconfig.go new file mode 100644 index 000000000..492babe9b --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/webhookconfig.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// WebhookConfigInformer provides access to a shared informer and lister for +// WebhookConfigs. +type WebhookConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.WebhookConfigLister +} + +type webhookConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewWebhookConfigInformer constructs a new informer for WebhookConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewWebhookConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredWebhookConfigInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredWebhookConfigInformer constructs a new informer for WebhookConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredWebhookConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WebhookConfigs().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WebhookConfigs().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.WebhookConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *webhookConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredWebhookConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *webhookConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.WebhookConfig{}, f.defaultInformer) +} + +func (f *webhookConfigInformer) Lister() v2.WebhookConfigLister { + return v2.NewWebhookConfigLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/webhookreceiver.go b/pkg/client/informers/externalversions/notification/v2/webhookreceiver.go new file mode 100644 index 000000000..9a41c6be6 --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/webhookreceiver.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// WebhookReceiverInformer provides access to a shared informer and lister for +// WebhookReceivers. +type WebhookReceiverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.WebhookReceiverLister +} + +type webhookReceiverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewWebhookReceiverInformer constructs a new informer for WebhookReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewWebhookReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredWebhookReceiverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredWebhookReceiverInformer constructs a new informer for WebhookReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredWebhookReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WebhookReceivers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WebhookReceivers().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.WebhookReceiver{}, + resyncPeriod, + indexers, + ) +} + +func (f *webhookReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredWebhookReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *webhookReceiverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.WebhookReceiver{}, f.defaultInformer) +} + +func (f *webhookReceiverInformer) Lister() v2.WebhookReceiverLister { + return v2.NewWebhookReceiverLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/wechatconfig.go b/pkg/client/informers/externalversions/notification/v2/wechatconfig.go new file mode 100644 index 000000000..26e05061d --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/wechatconfig.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// WechatConfigInformer provides access to a shared informer and lister for +// WechatConfigs. +type WechatConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.WechatConfigLister +} + +type wechatConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewWechatConfigInformer constructs a new informer for WechatConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewWechatConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredWechatConfigInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredWechatConfigInformer constructs a new informer for WechatConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredWechatConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WechatConfigs().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WechatConfigs().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.WechatConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *wechatConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredWechatConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *wechatConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.WechatConfig{}, f.defaultInformer) +} + +func (f *wechatConfigInformer) Lister() v2.WechatConfigLister { + return v2.NewWechatConfigLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/notification/v2/wechatreceiver.go b/pkg/client/informers/externalversions/notification/v2/wechatreceiver.go new file mode 100644 index 000000000..253a69194 --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2/wechatreceiver.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" + v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" +) + +// WechatReceiverInformer provides access to a shared informer and lister for +// WechatReceivers. +type WechatReceiverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.WechatReceiverLister +} + +type wechatReceiverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewWechatReceiverInformer constructs a new informer for WechatReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewWechatReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredWechatReceiverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredWechatReceiverInformer constructs a new informer for WechatReceiver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredWechatReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WechatReceivers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NotificationV2().WechatReceivers().Watch(context.TODO(), options) + }, + }, + ¬ificationv2.WechatReceiver{}, + resyncPeriod, + indexers, + ) +} + +func (f *wechatReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredWechatReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *wechatReceiverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2.WechatReceiver{}, f.defaultInformer) +} + +func (f *wechatReceiverInformer) Lister() v2.WechatReceiverLister { + return v2.NewWechatReceiverLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/notification/v2/dingtalkconfig.go b/pkg/client/listers/notification/v2/dingtalkconfig.go new file mode 100644 index 000000000..28420570b --- /dev/null +++ b/pkg/client/listers/notification/v2/dingtalkconfig.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// DingTalkConfigLister helps list DingTalkConfigs. +type DingTalkConfigLister interface { + // List lists all DingTalkConfigs in the indexer. + List(selector labels.Selector) (ret []*v2.DingTalkConfig, err error) + // Get retrieves the DingTalkConfig from the index for a given name. + Get(name string) (*v2.DingTalkConfig, error) + DingTalkConfigListerExpansion +} + +// dingTalkConfigLister implements the DingTalkConfigLister interface. +type dingTalkConfigLister struct { + indexer cache.Indexer +} + +// NewDingTalkConfigLister returns a new DingTalkConfigLister. +func NewDingTalkConfigLister(indexer cache.Indexer) DingTalkConfigLister { + return &dingTalkConfigLister{indexer: indexer} +} + +// List lists all DingTalkConfigs in the indexer. +func (s *dingTalkConfigLister) List(selector labels.Selector) (ret []*v2.DingTalkConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.DingTalkConfig)) + }) + return ret, err +} + +// Get retrieves the DingTalkConfig from the index for a given name. +func (s *dingTalkConfigLister) Get(name string) (*v2.DingTalkConfig, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("dingtalkconfig"), name) + } + return obj.(*v2.DingTalkConfig), nil +} diff --git a/pkg/client/listers/notification/v2/dingtalkreceiver.go b/pkg/client/listers/notification/v2/dingtalkreceiver.go new file mode 100644 index 000000000..da88dc5f5 --- /dev/null +++ b/pkg/client/listers/notification/v2/dingtalkreceiver.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// DingTalkReceiverLister helps list DingTalkReceivers. +type DingTalkReceiverLister interface { + // List lists all DingTalkReceivers in the indexer. + List(selector labels.Selector) (ret []*v2.DingTalkReceiver, err error) + // Get retrieves the DingTalkReceiver from the index for a given name. + Get(name string) (*v2.DingTalkReceiver, error) + DingTalkReceiverListerExpansion +} + +// dingTalkReceiverLister implements the DingTalkReceiverLister interface. +type dingTalkReceiverLister struct { + indexer cache.Indexer +} + +// NewDingTalkReceiverLister returns a new DingTalkReceiverLister. +func NewDingTalkReceiverLister(indexer cache.Indexer) DingTalkReceiverLister { + return &dingTalkReceiverLister{indexer: indexer} +} + +// List lists all DingTalkReceivers in the indexer. +func (s *dingTalkReceiverLister) List(selector labels.Selector) (ret []*v2.DingTalkReceiver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.DingTalkReceiver)) + }) + return ret, err +} + +// Get retrieves the DingTalkReceiver from the index for a given name. +func (s *dingTalkReceiverLister) Get(name string) (*v2.DingTalkReceiver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("dingtalkreceiver"), name) + } + return obj.(*v2.DingTalkReceiver), nil +} diff --git a/pkg/client/listers/notification/v2/emailconfig.go b/pkg/client/listers/notification/v2/emailconfig.go new file mode 100644 index 000000000..c0025b95c --- /dev/null +++ b/pkg/client/listers/notification/v2/emailconfig.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// EmailConfigLister helps list EmailConfigs. +type EmailConfigLister interface { + // List lists all EmailConfigs in the indexer. + List(selector labels.Selector) (ret []*v2.EmailConfig, err error) + // Get retrieves the EmailConfig from the index for a given name. + Get(name string) (*v2.EmailConfig, error) + EmailConfigListerExpansion +} + +// emailConfigLister implements the EmailConfigLister interface. +type emailConfigLister struct { + indexer cache.Indexer +} + +// NewEmailConfigLister returns a new EmailConfigLister. +func NewEmailConfigLister(indexer cache.Indexer) EmailConfigLister { + return &emailConfigLister{indexer: indexer} +} + +// List lists all EmailConfigs in the indexer. +func (s *emailConfigLister) List(selector labels.Selector) (ret []*v2.EmailConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.EmailConfig)) + }) + return ret, err +} + +// Get retrieves the EmailConfig from the index for a given name. +func (s *emailConfigLister) Get(name string) (*v2.EmailConfig, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("emailconfig"), name) + } + return obj.(*v2.EmailConfig), nil +} diff --git a/pkg/client/listers/notification/v2/emailreceiver.go b/pkg/client/listers/notification/v2/emailreceiver.go new file mode 100644 index 000000000..c5d4ed0f8 --- /dev/null +++ b/pkg/client/listers/notification/v2/emailreceiver.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// EmailReceiverLister helps list EmailReceivers. +type EmailReceiverLister interface { + // List lists all EmailReceivers in the indexer. + List(selector labels.Selector) (ret []*v2.EmailReceiver, err error) + // Get retrieves the EmailReceiver from the index for a given name. + Get(name string) (*v2.EmailReceiver, error) + EmailReceiverListerExpansion +} + +// emailReceiverLister implements the EmailReceiverLister interface. +type emailReceiverLister struct { + indexer cache.Indexer +} + +// NewEmailReceiverLister returns a new EmailReceiverLister. +func NewEmailReceiverLister(indexer cache.Indexer) EmailReceiverLister { + return &emailReceiverLister{indexer: indexer} +} + +// List lists all EmailReceivers in the indexer. +func (s *emailReceiverLister) List(selector labels.Selector) (ret []*v2.EmailReceiver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.EmailReceiver)) + }) + return ret, err +} + +// Get retrieves the EmailReceiver from the index for a given name. +func (s *emailReceiverLister) Get(name string) (*v2.EmailReceiver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("emailreceiver"), name) + } + return obj.(*v2.EmailReceiver), nil +} diff --git a/pkg/client/listers/notification/v2/expansion_generated.go b/pkg/client/listers/notification/v2/expansion_generated.go new file mode 100644 index 000000000..fb646dbc1 --- /dev/null +++ b/pkg/client/listers/notification/v2/expansion_generated.go @@ -0,0 +1,59 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +// DingTalkConfigListerExpansion allows custom methods to be added to +// DingTalkConfigLister. +type DingTalkConfigListerExpansion interface{} + +// DingTalkReceiverListerExpansion allows custom methods to be added to +// DingTalkReceiverLister. +type DingTalkReceiverListerExpansion interface{} + +// EmailConfigListerExpansion allows custom methods to be added to +// EmailConfigLister. +type EmailConfigListerExpansion interface{} + +// EmailReceiverListerExpansion allows custom methods to be added to +// EmailReceiverLister. +type EmailReceiverListerExpansion interface{} + +// SlackConfigListerExpansion allows custom methods to be added to +// SlackConfigLister. +type SlackConfigListerExpansion interface{} + +// SlackReceiverListerExpansion allows custom methods to be added to +// SlackReceiverLister. +type SlackReceiverListerExpansion interface{} + +// WebhookConfigListerExpansion allows custom methods to be added to +// WebhookConfigLister. +type WebhookConfigListerExpansion interface{} + +// WebhookReceiverListerExpansion allows custom methods to be added to +// WebhookReceiverLister. +type WebhookReceiverListerExpansion interface{} + +// WechatConfigListerExpansion allows custom methods to be added to +// WechatConfigLister. +type WechatConfigListerExpansion interface{} + +// WechatReceiverListerExpansion allows custom methods to be added to +// WechatReceiverLister. +type WechatReceiverListerExpansion interface{} diff --git a/pkg/client/listers/notification/v2/slackconfig.go b/pkg/client/listers/notification/v2/slackconfig.go new file mode 100644 index 000000000..77981346f --- /dev/null +++ b/pkg/client/listers/notification/v2/slackconfig.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// SlackConfigLister helps list SlackConfigs. +type SlackConfigLister interface { + // List lists all SlackConfigs in the indexer. + List(selector labels.Selector) (ret []*v2.SlackConfig, err error) + // Get retrieves the SlackConfig from the index for a given name. + Get(name string) (*v2.SlackConfig, error) + SlackConfigListerExpansion +} + +// slackConfigLister implements the SlackConfigLister interface. +type slackConfigLister struct { + indexer cache.Indexer +} + +// NewSlackConfigLister returns a new SlackConfigLister. +func NewSlackConfigLister(indexer cache.Indexer) SlackConfigLister { + return &slackConfigLister{indexer: indexer} +} + +// List lists all SlackConfigs in the indexer. +func (s *slackConfigLister) List(selector labels.Selector) (ret []*v2.SlackConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.SlackConfig)) + }) + return ret, err +} + +// Get retrieves the SlackConfig from the index for a given name. +func (s *slackConfigLister) Get(name string) (*v2.SlackConfig, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("slackconfig"), name) + } + return obj.(*v2.SlackConfig), nil +} diff --git a/pkg/client/listers/notification/v2/slackreceiver.go b/pkg/client/listers/notification/v2/slackreceiver.go new file mode 100644 index 000000000..90906b682 --- /dev/null +++ b/pkg/client/listers/notification/v2/slackreceiver.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// SlackReceiverLister helps list SlackReceivers. +type SlackReceiverLister interface { + // List lists all SlackReceivers in the indexer. + List(selector labels.Selector) (ret []*v2.SlackReceiver, err error) + // Get retrieves the SlackReceiver from the index for a given name. + Get(name string) (*v2.SlackReceiver, error) + SlackReceiverListerExpansion +} + +// slackReceiverLister implements the SlackReceiverLister interface. +type slackReceiverLister struct { + indexer cache.Indexer +} + +// NewSlackReceiverLister returns a new SlackReceiverLister. +func NewSlackReceiverLister(indexer cache.Indexer) SlackReceiverLister { + return &slackReceiverLister{indexer: indexer} +} + +// List lists all SlackReceivers in the indexer. +func (s *slackReceiverLister) List(selector labels.Selector) (ret []*v2.SlackReceiver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.SlackReceiver)) + }) + return ret, err +} + +// Get retrieves the SlackReceiver from the index for a given name. +func (s *slackReceiverLister) Get(name string) (*v2.SlackReceiver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("slackreceiver"), name) + } + return obj.(*v2.SlackReceiver), nil +} diff --git a/pkg/client/listers/notification/v2/webhookconfig.go b/pkg/client/listers/notification/v2/webhookconfig.go new file mode 100644 index 000000000..41470f642 --- /dev/null +++ b/pkg/client/listers/notification/v2/webhookconfig.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// WebhookConfigLister helps list WebhookConfigs. +type WebhookConfigLister interface { + // List lists all WebhookConfigs in the indexer. + List(selector labels.Selector) (ret []*v2.WebhookConfig, err error) + // Get retrieves the WebhookConfig from the index for a given name. + Get(name string) (*v2.WebhookConfig, error) + WebhookConfigListerExpansion +} + +// webhookConfigLister implements the WebhookConfigLister interface. +type webhookConfigLister struct { + indexer cache.Indexer +} + +// NewWebhookConfigLister returns a new WebhookConfigLister. +func NewWebhookConfigLister(indexer cache.Indexer) WebhookConfigLister { + return &webhookConfigLister{indexer: indexer} +} + +// List lists all WebhookConfigs in the indexer. +func (s *webhookConfigLister) List(selector labels.Selector) (ret []*v2.WebhookConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.WebhookConfig)) + }) + return ret, err +} + +// Get retrieves the WebhookConfig from the index for a given name. +func (s *webhookConfigLister) Get(name string) (*v2.WebhookConfig, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("webhookconfig"), name) + } + return obj.(*v2.WebhookConfig), nil +} diff --git a/pkg/client/listers/notification/v2/webhookreceiver.go b/pkg/client/listers/notification/v2/webhookreceiver.go new file mode 100644 index 000000000..07359add3 --- /dev/null +++ b/pkg/client/listers/notification/v2/webhookreceiver.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// WebhookReceiverLister helps list WebhookReceivers. +type WebhookReceiverLister interface { + // List lists all WebhookReceivers in the indexer. + List(selector labels.Selector) (ret []*v2.WebhookReceiver, err error) + // Get retrieves the WebhookReceiver from the index for a given name. + Get(name string) (*v2.WebhookReceiver, error) + WebhookReceiverListerExpansion +} + +// webhookReceiverLister implements the WebhookReceiverLister interface. +type webhookReceiverLister struct { + indexer cache.Indexer +} + +// NewWebhookReceiverLister returns a new WebhookReceiverLister. +func NewWebhookReceiverLister(indexer cache.Indexer) WebhookReceiverLister { + return &webhookReceiverLister{indexer: indexer} +} + +// List lists all WebhookReceivers in the indexer. +func (s *webhookReceiverLister) List(selector labels.Selector) (ret []*v2.WebhookReceiver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.WebhookReceiver)) + }) + return ret, err +} + +// Get retrieves the WebhookReceiver from the index for a given name. +func (s *webhookReceiverLister) Get(name string) (*v2.WebhookReceiver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("webhookreceiver"), name) + } + return obj.(*v2.WebhookReceiver), nil +} diff --git a/pkg/client/listers/notification/v2/wechatconfig.go b/pkg/client/listers/notification/v2/wechatconfig.go new file mode 100644 index 000000000..ccccb4716 --- /dev/null +++ b/pkg/client/listers/notification/v2/wechatconfig.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// WechatConfigLister helps list WechatConfigs. +type WechatConfigLister interface { + // List lists all WechatConfigs in the indexer. + List(selector labels.Selector) (ret []*v2.WechatConfig, err error) + // Get retrieves the WechatConfig from the index for a given name. + Get(name string) (*v2.WechatConfig, error) + WechatConfigListerExpansion +} + +// wechatConfigLister implements the WechatConfigLister interface. +type wechatConfigLister struct { + indexer cache.Indexer +} + +// NewWechatConfigLister returns a new WechatConfigLister. +func NewWechatConfigLister(indexer cache.Indexer) WechatConfigLister { + return &wechatConfigLister{indexer: indexer} +} + +// List lists all WechatConfigs in the indexer. +func (s *wechatConfigLister) List(selector labels.Selector) (ret []*v2.WechatConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.WechatConfig)) + }) + return ret, err +} + +// Get retrieves the WechatConfig from the index for a given name. +func (s *wechatConfigLister) Get(name string) (*v2.WechatConfig, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("wechatconfig"), name) + } + return obj.(*v2.WechatConfig), nil +} diff --git a/pkg/client/listers/notification/v2/wechatreceiver.go b/pkg/client/listers/notification/v2/wechatreceiver.go new file mode 100644 index 000000000..14b15669a --- /dev/null +++ b/pkg/client/listers/notification/v2/wechatreceiver.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" +) + +// WechatReceiverLister helps list WechatReceivers. +type WechatReceiverLister interface { + // List lists all WechatReceivers in the indexer. + List(selector labels.Selector) (ret []*v2.WechatReceiver, err error) + // Get retrieves the WechatReceiver from the index for a given name. + Get(name string) (*v2.WechatReceiver, error) + WechatReceiverListerExpansion +} + +// wechatReceiverLister implements the WechatReceiverLister interface. +type wechatReceiverLister struct { + indexer cache.Indexer +} + +// NewWechatReceiverLister returns a new WechatReceiverLister. +func NewWechatReceiverLister(indexer cache.Indexer) WechatReceiverLister { + return &wechatReceiverLister{indexer: indexer} +} + +// List lists all WechatReceivers in the indexer. +func (s *wechatReceiverLister) List(selector labels.Selector) (ret []*v2.WechatReceiver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.WechatReceiver)) + }) + return ret, err +} + +// Get retrieves the WechatReceiver from the index for a given name. +func (s *wechatReceiverLister) Get(name string) (*v2.WechatReceiver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.Resource("wechatreceiver"), name) + } + return obj.(*v2.WechatReceiver), nil +} diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index ea0de7d59..70affdf96 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -125,6 +125,10 @@ const ( ApplicationName = "app.kubernetes.io/name" ApplicationVersion = "app.kubernetes.io/version" AlertingTag = "Alerting" + + NotificationTag = "Notification" + KubeSphereNotificationNamespace = "kubesphere-notification-system" + NotificationManagedLabel = "notification-manager/managed" ) var ( diff --git a/pkg/controller/notification/notification_controller.go b/pkg/controller/notification/notification_controller.go new file mode 100644 index 000000000..34d6e5ad3 --- /dev/null +++ b/pkg/controller/notification/notification_controller.go @@ -0,0 +1,985 @@ +/* +Copyright 2019 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notification + +import ( + "context" + "fmt" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/kubernetes/scheme" + typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" + toolscache "k8s.io/client-go/tools/cache" + "k8s.io/client-go/tools/record" + "k8s.io/client-go/util/workqueue" + "k8s.io/klog" + "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" + "kubesphere.io/kubesphere/pkg/constants" + "reflect" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "time" +) + +const ( + // SuccessSynced is used as part of the Event 'reason' when a Foo is synced + successSynced = "Synced" + controllerName = "notification-controller" +) + +type Controller struct { + client.Client + ksCache cache.Cache + reconciledObjs []runtime.Object + informerSynced []toolscache.InformerSynced + // workqueue is a rate limited work queue. This is used to queue work to be + // processed instead of performing it as soon as a change happens. This + // means we can ensure we only process a fixed amount of resources at a + // time, and makes it easy to ensure we are never processing the same item + // simultaneously in two different workers. + workqueue workqueue.RateLimitingInterface + // recorder is an event recorder for recording Event resources to the + // Kubernetes API. + recorder record.EventRecorder +} + +func NewController(k8sClient kubernetes.Interface, ksClient client.Client, ksCache cache.Cache) (*Controller, error) { + // Create event broadcaster + // Add sample-controller types to the default Kubernetes Scheme so Events can be + // logged for sample-controller types. + + klog.V(4).Info("Creating event broadcaster") + eventBroadcaster := record.NewBroadcaster() + eventBroadcaster.StartLogging(klog.Infof) + eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: k8sClient.CoreV1().Events("")}) + recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerName}) + ctl := &Controller{ + Client: ksClient, + ksCache: ksCache, + workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Notification"), + recorder: recorder, + } + klog.Info("Setting up event handlers") + + if err := ctl.setEventHandlers(); err != nil { + return nil, err + } + + return ctl, nil +} + +func (c *Controller) setEventHandlers() error { + + if c.reconciledObjs != nil && len(c.reconciledObjs) > 0 { + c.reconciledObjs = c.reconciledObjs[:0] + } + c.reconciledObjs = append(c.reconciledObjs, &v2.DingTalkConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.DingTalkReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.EmailConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.EmailReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.SlackConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.SlackReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.WebhookConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.WebhookReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.WechatConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2.WechatReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &corev1.Secret{}) + + if c.informerSynced != nil && len(c.informerSynced) > 0 { + c.informerSynced = c.informerSynced[:0] + } + + for _, obj := range c.reconciledObjs { + if informer, err := c.ksCache.GetInformer(context.Background(), obj); err != nil { + klog.Errorf("get %s informer error, %v", obj.GetObjectKind().GroupVersionKind().String(), err) + return err + } else { + informer.AddEventHandler(toolscache.ResourceEventHandlerFuncs{ + AddFunc: c.enqueue, + UpdateFunc: func(old, new interface{}) { + c.enqueue(new) + }, + DeleteFunc: c.enqueue, + }) + c.informerSynced = append(c.informerSynced, informer.HasSynced) + } + } + + return nil +} + +func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error { + defer utilruntime.HandleCrash() + defer c.workqueue.ShutDown() + + // Start the informer factories to begin populating the informer caches + klog.Info("Starting Notification controller") + + // Wait for the caches to be synced before starting workers + klog.Info("Waiting for informer caches to sync") + + if ok := toolscache.WaitForCacheSync(stopCh, c.informerSynced...); !ok { + return fmt.Errorf("failed to wait for caches to sync") + } + + klog.Info("Starting workers") + // Launch two workers to process Foo resources + for i := 0; i < threadiness; i++ { + go wait.Until(c.runWorker, time.Second, stopCh) + } + + klog.Info("Started workers") + <-stopCh + klog.Info("Shutting down workers") + return nil +} + +func (c *Controller) enqueue(obj interface{}) { + c.workqueue.Add(obj) +} + +func (c *Controller) runWorker() { + for c.processNextWorkItem() { + } +} + +func (c *Controller) processNextWorkItem() bool { + obj, shutdown := c.workqueue.Get() + + if shutdown { + return false + } + + // We wrap this block in a func so we can defer c.workqueue.Done. + err := func(obj interface{}) error { + // We call Done here so the workqueue knows we have finished + // processing this item. We also must remember to call Forget if we + // do not want this work item being re-queued. For example, we do + // not call Forget if a transient error occurs, instead the item is + // put back on the workqueue and attempted again after a back-off + // period. + defer c.workqueue.Done(obj) + + // Run the reconcile, passing it the namespace/name string of the + // Foo resource to be synced. + if err := c.reconcile(obj); err != nil { + // Put the item back on the workqueue to handle any transient errors. + c.workqueue.AddRateLimited(obj) + } + // Finally, if no error occurs we Forget this item so it does not + // get queued again until another change happens. + c.workqueue.Forget(obj) + return nil + }(obj) + + if err != nil { + utilruntime.HandleError(err) + return true + } + + return true +} + +// syncHandler compares the actual state with the desired, and attempts to +// converge the two. It then updates the Status block of the Foo resource +// with the current status of the resource. +func (c *Controller) reconcile(obj interface{}) error { + + runtimeObj, ok := obj.(runtime.Object) + if !ok { + utilruntime.HandleError(fmt.Errorf("object does not implement the Object interfaces")) + return nil + } + runtimeObj = runtimeObj.DeepCopyObject() + + accessor, err := meta.Accessor(runtimeObj) + if err != nil { + utilruntime.HandleError(fmt.Errorf("object does not implement the Object interfaces")) + return nil + } + + // Only reconcile the secret which created by notification manager. + if secret, ok := obj.(*corev1.Secret); ok { + if secret.Namespace != constants.KubeSphereNotificationNamespace || secret.Labels[constants.NotificationManagedLabel] != "true" { + klog.V(8).Infof("No need to reconcile secret %s/%s", accessor.GetNamespace(), accessor.GetName()) + return nil + } + + if err := c.ensureNotificationNamespaceExist(); err != nil { + return err + } + } + + name := accessor.GetName() + kind := runtimeObj.GetObjectKind().GroupVersionKind().String() + err = c.Get(context.Background(), client.ObjectKey{Name: accessor.GetName(), Namespace: accessor.GetNamespace()}, runtimeObj) + if err != nil { + // The user may no longer exist, in which case we stop + // processing. + if errors.IsNotFound(err) { + utilruntime.HandleError(fmt.Errorf("obj '%s, %s' in work queue no longer exists", kind, name)) + c.recorder.Event(runtimeObj, corev1.EventTypeNormal, successSynced, fmt.Sprintf("%s synced successfully", kind)) + klog.Infof("Successfully synced %s:%s", kind, name) + return nil + } + klog.Error(err) + return err + } + + if err = c.multiClusterSync(context.Background(), runtimeObj); err != nil { + return err + } + + c.recorder.Event(runtimeObj, corev1.EventTypeNormal, successSynced, fmt.Sprintf("%s synced successfully", kind)) + klog.Infof("Successfully synced %s:%s", kind, name) + return nil +} + +func (c *Controller) Start(stopCh <-chan struct{}) error { + return c.Run(4, stopCh) +} + +func (c *Controller) multiClusterSync(ctx context.Context, obj runtime.Object) error { + + if err := c.ensureNotControlledByKubefed(ctx, obj); err != nil { + klog.Error(err) + return err + } + + switch obj.(type) { + case *v2.DingTalkConfig: + return c.syncFederatedDingTalkConfig(obj.(*v2.DingTalkConfig)) + case *v2.DingTalkReceiver: + return c.syncFederatedDingTalkReceiver(obj.(*v2.DingTalkReceiver)) + case *v2.EmailConfig: + return c.syncFederatedEmailConfig(obj.(*v2.EmailConfig)) + case *v2.EmailReceiver: + return c.syncFederatedEmailReceiver(obj.(*v2.EmailReceiver)) + case *v2.SlackConfig: + return c.syncFederatedSlackConfig(obj.(*v2.SlackConfig)) + case *v2.SlackReceiver: + return c.syncFederatedSlackReceiver(obj.(*v2.SlackReceiver)) + case *v2.WebhookConfig: + return c.syncFederatedWebhookConfig(obj.(*v2.WebhookConfig)) + case *v2.WebhookReceiver: + return c.syncFederatedWebhookReceiver(obj.(*v2.WebhookReceiver)) + case *v2.WechatConfig: + return c.syncFederatedWechatConfig(obj.(*v2.WechatConfig)) + case *v2.WechatReceiver: + return c.syncFederatedWechatReceiver(obj.(*v2.WechatReceiver)) + case *corev1.Secret: + return c.syncFederatedSecret(obj.(*corev1.Secret)) + default: + klog.Errorf("unknown type for notification, %v", obj) + return nil + } +} + +func (c *Controller) syncFederatedDingTalkConfig(obj *v2.DingTalkConfig) error { + + fedObj := &v1beta1.FederatedDingTalkConfig{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedDingTalkConfig{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedDingTalkConfigKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedDingTalkConfigSpec{ + Template: v1beta1.DingTalkConfigTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedDingTalkReceiver(obj *v2.DingTalkReceiver) error { + + fedObj := &v1beta1.FederatedDingTalkReceiver{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedDingTalkReceiver{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedDingTalkReceiverKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedDingTalkReceiverSpec{ + Template: v1beta1.DingTalkReceiverTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedEmailConfig(obj *v2.EmailConfig) error { + + fedObj := &v1beta1.FederatedEmailConfig{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedEmailConfig{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedEmailConfigKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedEmailConfigSpec{ + Template: v1beta1.EmailConfigTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedEmailReceiver(obj *v2.EmailReceiver) error { + + fedObj := &v1beta1.FederatedEmailReceiver{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedEmailReceiver{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedEmailReceiverKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedEmailReceiverSpec{ + Template: v1beta1.EmailReceiverTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedSlackConfig(obj *v2.SlackConfig) error { + + fedObj := &v1beta1.FederatedSlackConfig{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedSlackConfig{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedSlackConfigKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedSlackConfigSpec{ + Template: v1beta1.SlackConfigTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedSlackReceiver(obj *v2.SlackReceiver) error { + + fedObj := &v1beta1.FederatedSlackReceiver{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedSlackReceiver{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedSlackReceiverKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedSlackReceiverSpec{ + Template: v1beta1.SlackReceiverTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedWebhookConfig(obj *v2.WebhookConfig) error { + + fedObj := &v1beta1.FederatedWebhookConfig{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedWebhookConfig{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedWebhookConfigKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedWebhookConfigSpec{ + Template: v1beta1.WebhookConfigTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedWebhookReceiver(obj *v2.WebhookReceiver) error { + + fedObj := &v1beta1.FederatedWebhookReceiver{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedWebhookReceiver{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedWebhookReceiverKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedWebhookReceiverSpec{ + Template: v1beta1.WebhookReceiverTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedWechatConfig(obj *v2.WechatConfig) error { + + fedObj := &v1beta1.FederatedWechatConfig{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedWechatConfig{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedWechatConfigKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedWechatConfigSpec{ + Template: v1beta1.WechatConfigTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedWechatReceiver(obj *v2.WechatReceiver) error { + + fedObj := &v1beta1.FederatedWechatReceiver{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedWechatReceiver{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedWechatReceiverKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + }, + Spec: v1beta1.FederatedWechatReceiverSpec{ + Template: v1beta1.WechatReceiverTemplate{ + ObjectMeta: metav1.ObjectMeta{ + Labels: obj.Labels, + }, + Spec: obj.Spec, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { + + fedObj.Spec.Template.Spec = obj.Spec + fedObj.Spec.Template.Labels = obj.Labels + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) syncFederatedSecret(obj *corev1.Secret) error { + + fedObj := &v1beta1.FederatedSecret{} + err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name, Namespace: obj.Namespace}, fedObj) + if err != nil { + if errors.IsNotFound(err) { + fedObj = &v1beta1.FederatedSecret{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedSecretKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: obj.Name, + Namespace: obj.Namespace, + }, + Spec: v1beta1.FederatedSecretSpec{ + Template: v1beta1.SecretTemplate{ + Data: obj.Data, + StringData: obj.StringData, + Type: obj.Type, + }, + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) + if err != nil { + return err + } + if err := c.Create(context.Background(), fedObj); err != nil { + klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + + return nil + } + klog.Error(err) + return err + } + + if !reflect.DeepEqual(fedObj.Spec.Template.Data, obj.Data) || + !reflect.DeepEqual(fedObj.Spec.Template.StringData, obj.StringData) || + !reflect.DeepEqual(fedObj.Spec.Template.Type, obj.Type) { + + fedObj.Spec.Template.Data = obj.Data + fedObj.Spec.Template.StringData = obj.StringData + fedObj.Spec.Template.Type = obj.Type + + if err := c.Update(context.Background(), fedObj); err != nil { + klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) + return err + } + } + + return nil +} + +func (c *Controller) ensureNotificationNamespaceExist() error { + + ns := corev1.Namespace{} + if err := c.Get(context.Background(), client.ObjectKey{Name: constants.KubeSphereNotificationNamespace}, &ns); err != nil { + return err + } + + fedNs := v1beta1.FederatedNamespace{} + if err := c.Get(context.Background(), client.ObjectKey{Name: constants.KubeSphereNotificationNamespace, Namespace: constants.KubeSphereNotificationNamespace}, &fedNs); err != nil { + if errors.IsAlreadyExists(err) { + return nil + } + + if errors.IsNotFound(err) { + fedNs = v1beta1.FederatedNamespace{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1.FederatedNamespaceKind, + APIVersion: v1beta1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: constants.KubeSphereNotificationNamespace, + Namespace: constants.KubeSphereNotificationNamespace, + }, + Spec: v1beta1.FederatedNamespaceSpec{ + Placement: v1beta1.GenericPlacementFields{ + ClusterSelector: &metav1.LabelSelector{}, + }, + }, + } + + if err := controllerutil.SetControllerReference(&ns, &fedNs, scheme.Scheme); err != nil { + return err + } + + return c.Create(context.Background(), &fedNs) + } + + return err + } + + return nil + +} + +func (c *Controller) ensureNotControlledByKubefed(ctx context.Context, obj runtime.Object) error { + + accessor, err := meta.Accessor(obj) + if err != nil { + klog.Error(err) + return nil + } + + labels := accessor.GetLabels() + if labels == nil { + labels = make(map[string]string, 0) + } + + if labels[constants.KubefedManagedLabel] != "false" { + labels[constants.KubefedManagedLabel] = "false" + accessor.SetLabels(labels) + err := c.Update(ctx, accessor.(runtime.Object)) + if err != nil { + klog.Error(err) + } + } + return nil +} diff --git a/pkg/controller/notification/notification_controller_suite_test.go b/pkg/controller/notification/notification_controller_suite_test.go new file mode 100644 index 000000000..0a2d23362 --- /dev/null +++ b/pkg/controller/notification/notification_controller_suite_test.go @@ -0,0 +1,83 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notification + +import ( + "k8s.io/client-go/kubernetes/fake" + "k8s.io/client-go/kubernetes/scheme" + "kubesphere.io/kubesphere/pkg/apis" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "path/filepath" + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "k8s.io/client-go/rest" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/envtest" + "sigs.k8s.io/controller-runtime/pkg/envtest/printer" +) + +func TestSource(t *testing.T) { + RegisterFailHandler(Fail) + suiteName := "Cache Suite" + RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)}) +} + +var testenv *envtest.Environment +var cfg *rest.Config +var k8sManager ctrl.Manager + +var _ = BeforeSuite(func(done Done) { + + testenv = &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crds")}, + } + + var err error + cfg, err = testenv.Start() + Expect(err).NotTo(HaveOccurred()) + Expect(cfg).ToNot(BeNil()) + + err = v2.AddToScheme(scheme.Scheme) + Expect(err).NotTo(HaveOccurred()) + + err = apis.AddToScheme(scheme.Scheme) + Expect(err).NotTo(HaveOccurred()) + + k8sManager, err = ctrl.NewManager(cfg, ctrl.Options{ + Scheme: scheme.Scheme, + MetricsBindAddress: "0", + }) + Expect(err).ToNot(HaveOccurred()) + + r, err := NewController(fake.NewSimpleClientset(), k8sManager.GetClient(), k8sManager.GetCache()) + Expect(err).ToNot(HaveOccurred()) + err = k8sManager.Add(r) + Expect(err).ToNot(HaveOccurred()) + + go func() { + err = k8sManager.Start(ctrl.SetupSignalHandler()) + Expect(err).ToNot(HaveOccurred()) + }() + + close(done) +}, 60) + +var _ = AfterSuite(func() { + Expect(testenv.Stop()).To(Succeed()) +}) diff --git a/pkg/controller/notification/notification_controller_test.go b/pkg/controller/notification/notification_controller_test.go new file mode 100644 index 000000000..ef2f0fd23 --- /dev/null +++ b/pkg/controller/notification/notification_controller_test.go @@ -0,0 +1,202 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notification + +import ( + "context" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" + "kubesphere.io/kubesphere/pkg/constants" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" + "time" +) + +var ( + _ = Describe("Secret", func() { + + const timeout = time.Second * 30 + const interval = time.Second * 1 + + namespace := &corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: constants.KubeSphereNotificationNamespace, + }, + } + + secret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: constants.KubeSphereNotificationNamespace, + Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + }, + } + + var ( + cl client.Client + ksCache cache.Cache + informerCacheCtx context.Context + informerCacheCancel context.CancelFunc + ) + + BeforeEach(func() { + var err error + cl, err = client.New(cfg, client.Options{}) + Expect(err).NotTo(HaveOccurred()) + + ksCache, err = cache.New(cfg, cache.Options{}) + Expect(err).NotTo(HaveOccurred()) + + informerCacheCtx, informerCacheCancel = context.WithCancel(context.Background()) + go func(ctx context.Context) { + defer GinkgoRecover() + Expect(ksCache.Start(ctx.Done())).To(Succeed()) + }(informerCacheCtx) + Expect(ksCache.WaitForCacheSync(informerCacheCtx.Done())).To(BeTrue()) + + Eventually(func() bool { + err = cl.Create(informerCacheCtx, namespace) + if err == nil || errors.IsAlreadyExists(err) { + return true + } + return false + }, timeout, interval).Should(BeTrue()) + }) + + AfterEach(func() { + By("cleaning up") + informerCacheCancel() + }) + + // Add Tests for OpenAPI validation (or additonal CRD features) specified in + // your API definition. + // Avoid adding tests for vanilla CRUD operations because they would + // test Kubernetes API server, which isn't the goal here. + Context("Notification Controller", func() { + It("Should create successfully", func() { + + // Create a secret + Expect(cl.Create(context.Background(), secret)).Should(Succeed()) + time.Sleep(time.Second) + + fedSecret := &v1beta1.FederatedSecret{} + By("Expecting to create federated secret successfully") + Eventually(func() bool { + err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.KubeSphereNotificationNamespace}, fedSecret) + Expect(err).Should(Succeed()) + return !fedSecret.CreationTimestamp.IsZero() + }, timeout, interval).Should(BeTrue()) + + err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.KubeSphereNotificationNamespace}, secret) + Expect(err).Should(Succeed()) + secret.StringData = map[string]string{"foo": "bar"} + Expect(cl.Update(context.Background(), secret)).Should(Succeed()) + time.Sleep(time.Second) + + By("Expecting to update federated secret successfully") + Eventually(func() bool { + err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.KubeSphereNotificationNamespace}, fedSecret) + Expect(err).Should(Succeed()) + return string(fedSecret.Spec.Template.Data["foo"]) == "bar" + }, timeout, interval).Should(BeTrue()) + }) + }) + }) + + _ = Describe("Notification", func() { + + const timeout = time.Second * 30 + const interval = time.Second * 1 + + obj := &v2.DingTalkConfig{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: constants.KubeSphereNotificationNamespace, + Labels: map[string]string{ + "tyep": "default", + }, + }, + } + + var ( + cl client.Client + ksCache cache.Cache + informerCacheCtx context.Context + informerCacheCancel context.CancelFunc + ) + + BeforeEach(func() { + var err error + cl, err = client.New(cfg, client.Options{}) + Expect(err).NotTo(HaveOccurred()) + + ksCache, err = cache.New(cfg, cache.Options{}) + Expect(err).NotTo(HaveOccurred()) + + informerCacheCtx, informerCacheCancel = context.WithCancel(context.Background()) + go func(ctx context.Context) { + defer GinkgoRecover() + Expect(ksCache.Start(ctx.Done())).To(Succeed()) + }(informerCacheCtx) + Expect(ksCache.WaitForCacheSync(informerCacheCtx.Done())).To(BeTrue()) + }) + + AfterEach(func() { + By("cleaning up") + informerCacheCancel() + }) + + // Add Tests for OpenAPI validation (or additonal CRD features) specified in + // your API definition. + // Avoid adding tests for vanilla CRUD operations because they would + // test Kubernetes API server, which isn't the goal here. + Context("Notification Controller", func() { + It("Should create successfully", func() { + + // Create a bject + Expect(cl.Create(context.Background(), obj)).Should(Succeed()) + time.Sleep(time.Second) + + fedObj := &v1beta1.FederatedDingTalkConfig{} + By("Expecting to create federated object successfully") + Eventually(func() bool { + err := ksCache.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + Expect(err).Should(Succeed()) + return !fedObj.CreationTimestamp.IsZero() + }, timeout, interval).Should(BeTrue()) + + err := ksCache.Get(context.Background(), client.ObjectKey{Name: obj.Name}, obj) + Expect(err).Should(Succeed()) + obj.Labels = map[string]string{"foo": "bar"} + Expect(cl.Update(context.Background(), obj)).Should(Succeed()) + time.Sleep(time.Second) + + By("Expecting to update federated object successfully") + Eventually(func() bool { + err := ksCache.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) + Expect(err).Should(Succeed()) + return fedObj.Spec.Template.Labels["foo"] == "bar" + }, timeout, interval).Should(BeTrue()) + }) + }) + }) +) diff --git a/pkg/kapis/notification/v2/handler.go b/pkg/kapis/notification/v2/handler.go new file mode 100644 index 000000000..5f99c90cb --- /dev/null +++ b/pkg/kapis/notification/v2/handler.go @@ -0,0 +1,177 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + "github.com/emicklei/go-restful" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/client-go/kubernetes" + "k8s.io/klog" + "kubesphere.io/kubesphere/pkg/api" + "kubesphere.io/kubesphere/pkg/apiserver/query" + kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + "kubesphere.io/kubesphere/pkg/informers" + "kubesphere.io/kubesphere/pkg/models/notification" + servererr "kubesphere.io/kubesphere/pkg/server/errors" +) + +type handler struct { + operator notification.Operator +} + +func newNotificationHandler( + informers informers.InformerFactory, + k8sClient kubernetes.Interface, + ksClient kubesphere.Interface) *handler { + + return &handler{ + operator: notification.NewOperator(informers, k8sClient, ksClient), + } +} + +func (h *handler) ListSecret(req *restful.Request, resp *restful.Response) { + q := query.ParseQueryParameter(req) + objs, err := h.operator.ListSecret(q) + handleResponse(req, resp, objs, err) +} + +func (h *handler) GetSecret(req *restful.Request, resp *restful.Response) { + + obj, err := h.operator.GetSecret(req.PathParameter("secret")) + handleResponse(req, resp, obj, err) +} + +func (h *handler) CreateOrUpdateSecret(req *restful.Request, resp *restful.Response) { + + var obj corev1.Secret + err := req.ReadEntity(&obj) + if err != nil { + api.HandleBadRequest(resp, req, err) + return + } + + created, err := h.operator.CreateOrUpdateSecret(&obj) + handleResponse(req, resp, created, err) +} + +func (h *handler) DeleteSecret(req *restful.Request, resp *restful.Response) { + err := h.operator.DeleteSecret(req.PathParameter("secret")) + handleResponse(req, resp, servererr.None, err) +} + +func (h *handler) ListResource(req *restful.Request, resp *restful.Response) { + + user := req.PathParameter("user") + resource := req.PathParameter("resources") + q := query.ParseQueryParameter(req) + + if !h.operator.IsKnownResource(resource) { + api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) + return + } + + objs, err := h.operator.List(user, resource, q) + handleResponse(req, resp, objs, err) +} + +func (h *handler) GetResource(req *restful.Request, resp *restful.Response) { + + user := req.PathParameter("user") + resource := req.PathParameter("resources") + name := req.PathParameter("name") + + if !h.operator.IsKnownResource(resource) { + api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) + return + } + + obj, err := h.operator.Get(user, resource, name) + handleResponse(req, resp, obj, err) +} + +func (h *handler) CreateResource(req *restful.Request, resp *restful.Response) { + + user := req.PathParameter("user") + resource := req.PathParameter("resources") + + if !h.operator.IsKnownResource(resource) { + api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) + return + } + + obj := h.operator.GetObject(resource) + if err := req.ReadEntity(obj); err != nil { + api.HandleBadRequest(resp, req, err) + return + } + + created, err := h.operator.Create(user, resource, obj) + handleResponse(req, resp, created, err) +} + +func (h *handler) UpdateResource(req *restful.Request, resp *restful.Response) { + + user := req.PathParameter("user") + resource := req.PathParameter("resources") + + if !h.operator.IsKnownResource(resource) { + api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) + return + } + + obj := h.operator.GetObject(resource) + if err := req.ReadEntity(obj); err != nil { + api.HandleBadRequest(resp, req, err) + return + } + + updated, err := h.operator.Update(user, resource, obj) + handleResponse(req, resp, updated, err) +} + +func (h *handler) DeleteResource(req *restful.Request, resp *restful.Response) { + + user := req.PathParameter("user") + resource := req.PathParameter("resources") + name := req.PathParameter("name") + + if !h.operator.IsKnownResource(resource) { + api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) + return + } + + handleResponse(req, resp, h.operator.Delete(user, resource, name), servererr.None) +} + +func handleResponse(req *restful.Request, resp *restful.Response, obj interface{}, err error) { + + if err != nil { + klog.Error(err) + if errors.IsNotFound(err) { + api.HandleNotFound(resp, req, err) + return + } else if errors.IsConflict(err) { + api.HandleConflict(resp, req, err) + return + } + api.HandleBadRequest(resp, req, err) + return + } + + _ = resp.WriteEntity(obj) +} diff --git a/pkg/kapis/notification/v2/register.go b/pkg/kapis/notification/v2/register.go new file mode 100644 index 000000000..abd62d142 --- /dev/null +++ b/pkg/kapis/notification/v2/register.go @@ -0,0 +1,188 @@ +/* + + Copyright 2020 The KubeSphere Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package v2 + +import ( + "github.com/emicklei/go-restful" + openapi "github.com/emicklei/go-restful-openapi" + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/kubernetes" + "kubesphere.io/kubesphere/pkg/api" + "kubesphere.io/kubesphere/pkg/apiserver/query" + "kubesphere.io/kubesphere/pkg/apiserver/runtime" + kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + "kubesphere.io/kubesphere/pkg/constants" + "kubesphere.io/kubesphere/pkg/informers" + "kubesphere.io/kubesphere/pkg/server/errors" + "net/http" +) + +const ( + GroupName = "notification.kubesphere.io" + KeyOpenAPITags = openapi.KeyOpenAPITags +) + +var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2"} + +func AddToContainer( + container *restful.Container, + informers informers.InformerFactory, + k8sClient kubernetes.Interface, + ksClient kubesphere.Interface) error { + + ws := runtime.NewWebService(GroupVersion) + h := newNotificationHandler(informers, k8sClient, ksClient) + + // apis for secrets + ws.Route(ws.GET("/secrets"). + To(h.ListSecret). + Doc("list the secrets"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.QueryParameter(query.ParameterName, "name used to do filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used to do filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). + Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). + Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). + Param(ws.QueryParameter(query.ParameterOrderBy, "sort parameters, e.g. orderBy=createTime")). + Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}})) + + ws.Route(ws.GET("/secrets/{secret}"). + To(h.GetSecret). + Doc("get the secret"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("secret", "secret name")). + Returns(http.StatusOK, api.StatusOK, []v1.Secret{})) + + ws.Route(ws.POST("/secrets"). + To(h.CreateOrUpdateSecret). + Doc("create a secret"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Returns(http.StatusOK, api.StatusOK, []v1.Secret{})) + + ws.Route(ws.PUT("/secrets/{secret}"). + To(h.CreateOrUpdateSecret). + Doc("update the secret"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("secret", "secret name")). + Returns(http.StatusOK, api.StatusOK, []v1.Secret{})) + + ws.Route(ws.DELETE("/secrets/{secret}"). + To(h.DeleteSecret). + Doc("delete the secret"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("secret", "secret name")). + Returns(http.StatusOK, api.StatusOK, errors.None)) + + // apis for global notification config and receiver + ws.Route(ws.GET("/{resources}"). + To(h.ListResource). + Doc("list the notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.QueryParameter(query.ParameterName, "name used to do filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used to do filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). + Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). + Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). + Param(ws.QueryParameter(query.ParameterOrderBy, "sort parameters, e.g. orderBy=createTime")). + Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}})) + + ws.Route(ws.GET("/{resources}/{name}"). + To(h.GetResource). + Doc("get the specified notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("name", "the name of the resource")). + Returns(http.StatusOK, api.StatusOK, nil)) + + ws.Route(ws.POST("/{resources}"). + To(h.CreateResource). + Doc("create a notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("resource", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Returns(http.StatusOK, api.StatusOK, nil)) + + ws.Route(ws.PUT("/{resources}/{name}"). + To(h.UpdateResource). + Doc("update the specified notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("name", "the name of the resource")). + Returns(http.StatusOK, api.StatusOK, nil)) + + ws.Route(ws.DELETE("/{resources}/{name}"). + To(h.DeleteResource). + Doc("delete the specified notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("name", "the name of the resource")). + Returns(http.StatusOK, api.StatusOK, errors.None)) + + // apis for tenant notification config and receiver + ws.Route(ws.GET("/users/{user}/{resources}"). + To(h.ListResource). + Doc("list the notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("user", "user name")). + Param(ws.QueryParameter(query.ParameterName, "name used to do filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used to do filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). + Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). + Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). + Param(ws.QueryParameter(query.ParameterOrderBy, "sort parameters, e.g. orderBy=createTime")). + Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}})) + + ws.Route(ws.GET("/users/{user}/{resources}/{name}"). + To(h.GetResource). + Doc("get the specified notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("user", "user name")). + Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("name", "the name of the resource")). + Returns(http.StatusOK, api.StatusOK, nil)) + + ws.Route(ws.POST("/users/{user}/{resources}"). + To(h.CreateResource). + Doc("create the specified notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("user", "user name")). + Returns(http.StatusOK, api.StatusOK, nil)) + + ws.Route(ws.PUT("/users/{user}/{resources}/{name}"). + To(h.UpdateResource). + Doc("update the specified notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("user", "user name")). + Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("name", "the name of the resource")). + Returns(http.StatusOK, api.StatusOK, nil)) + + ws.Route(ws.DELETE("/users/{user}/{resources}/{name}"). + To(h.DeleteResource). + Doc("delete the specified notification config or receiver"). + Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). + Param(ws.PathParameter("user", "user name")). + Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("name", "the name of the resource")). + Returns(http.StatusOK, api.StatusOK, errors.None)) + + container.Add(ws) + return nil +} diff --git a/pkg/models/notification/notification.go b/pkg/models/notification/notification.go new file mode 100644 index 000000000..c8969773a --- /dev/null +++ b/pkg/models/notification/notification.go @@ -0,0 +1,383 @@ +package notification + +import ( + "context" + "fmt" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/kubernetes" + "k8s.io/klog" + "kubesphere.io/kubesphere/pkg/api" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apiserver/query" + kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned" + "kubesphere.io/kubesphere/pkg/constants" + "kubesphere.io/kubesphere/pkg/informers" + "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/resource" +) + +type Operator interface { + List(user, resource string, query *query.Query) (*api.ListResult, error) + Get(user, resource, name string) (runtime.Object, error) + Create(user, resource string, obj runtime.Object) (runtime.Object, error) + Delete(user, resource, name string) error + Update(user, resource string, obj runtime.Object) (runtime.Object, error) + + ListSecret(query *query.Query) (*api.ListResult, error) + GetSecret(name string) (interface{}, error) + CreateOrUpdateSecret(obj *corev1.Secret) (*corev1.Secret, error) + DeleteSecret(name string) error + + GetObject(resource string) runtime.Object + IsKnownResource(resource string) bool +} + +type operator struct { + k8sClient kubernetes.Interface + ksClient kubesphere.Interface + informers informers.InformerFactory + resourceGetter *resource.ResourceGetter +} + +func NewOperator( + informers informers.InformerFactory, + k8sClient kubernetes.Interface, + ksClient kubesphere.Interface) Operator { + + return &operator{ + informers: informers, + k8sClient: k8sClient, + ksClient: ksClient, + resourceGetter: resource.NewResourceGetter(informers, nil), + } +} + +// List objects, if the user is nil, it will return the global object. +// If the user it not nil, it will return tenant object which the tenant specified in the labels of object +// equal to this user. +func (o *operator) List(user, resource string, q *query.Query) (*api.ListResult, error) { + + // If user is nil, it will list all global object. + if user == "" { + appendGlobalLabel(resource, q) + } else { + // If the user is not nil, only return the object belong to this user. + appendTenantLabel(user, q) + } + + return o.resourceGetter.List(resource, "", q) +} + +// Get the specified object, if you want to get a global object, the user must be nil. +// If you want to get a tenant object, the user must equal to the tenant specified in labels of the object. +func (o *operator) Get(user, resource, name string) (runtime.Object, error) { + obj, err := o.resourceGetter.Get(resource, "", name) + if err != nil { + return nil, err + } + + if err := authorizer(user, obj); err != nil { + return nil, err + } + + return obj, nil +} + +// Create a object, if the user is nil, it only can create a global object. +// If the user is not nil, it only can create a tenant object. +func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Object, error) { + + if err := authorizer(user, obj); err != nil { + return nil, err + } + + switch resource { + case v2.ResourcesPluralDingTalkConfig: + return o.ksClient.NotificationV2().DingTalkConfigs().Create(context.Background(), obj.(*v2.DingTalkConfig), v1.CreateOptions{}) + case v2.ResourcesPluralDingTalkReceiver: + return o.ksClient.NotificationV2().DingTalkReceivers().Create(context.Background(), obj.(*v2.DingTalkReceiver), v1.CreateOptions{}) + case v2.ResourcesPluralEmailConfig: + return o.ksClient.NotificationV2().EmailConfigs().Create(context.Background(), obj.(*v2.EmailConfig), v1.CreateOptions{}) + case v2.ResourcesPluralEmailReceiver: + return o.ksClient.NotificationV2().EmailReceivers().Create(context.Background(), obj.(*v2.EmailReceiver), v1.CreateOptions{}) + case v2.ResourcesPluralSlackConfig: + return o.ksClient.NotificationV2().SlackConfigs().Create(context.Background(), obj.(*v2.SlackConfig), v1.CreateOptions{}) + case v2.ResourcesPluralSlackReceiver: + return o.ksClient.NotificationV2().SlackReceivers().Create(context.Background(), obj.(*v2.SlackReceiver), v1.CreateOptions{}) + case v2.ResourcesPluralWebhookConfig: + return o.ksClient.NotificationV2().WebhookConfigs().Create(context.Background(), obj.(*v2.WebhookConfig), v1.CreateOptions{}) + case v2.ResourcesPluralWebhookReceiver: + return o.ksClient.NotificationV2().WebhookReceivers().Create(context.Background(), obj.(*v2.WebhookReceiver), v1.CreateOptions{}) + case v2.ResourcesPluralWechatConfig: + return o.ksClient.NotificationV2().WechatConfigs().Create(context.Background(), obj.(*v2.WechatConfig), v1.CreateOptions{}) + case v2.ResourcesPluralWechatReceiver: + return o.ksClient.NotificationV2().WechatReceivers().Create(context.Background(), obj.(*v2.WechatReceiver), v1.CreateOptions{}) + default: + return nil, errors.NewInternalError(nil) + } +} + +// Delete a object, if the user is nil, it only can delete the global object. +// If the user is not nil, it only can delete the tenant object which the tenant +// specified in the labels of the object equal to this user. +func (o *operator) Delete(user, resource, name string) error { + + if obj, err := o.Get(user, resource, name); err != nil { + return err + } else { + if err := authorizer(user, obj); err != nil { + return err + } + } + + switch resource { + case v2.ResourcesPluralDingTalkConfig: + return o.ksClient.NotificationV2().DingTalkConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralDingTalkReceiver: + return o.ksClient.NotificationV2().DingTalkReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralEmailConfig: + return o.ksClient.NotificationV2().EmailConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralEmailReceiver: + return o.ksClient.NotificationV2().EmailReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralSlackConfig: + return o.ksClient.NotificationV2().SlackConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralSlackReceiver: + return o.ksClient.NotificationV2().SlackReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralWebhookConfig: + return o.ksClient.NotificationV2().WebhookConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralWebhookReceiver: + return o.ksClient.NotificationV2().WebhookReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralWechatConfig: + return o.ksClient.NotificationV2().WechatConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2.ResourcesPluralWechatReceiver: + return o.ksClient.NotificationV2().WechatReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + default: + return errors.NewInternalError(nil) + } +} + +// Update a object, if the user is nil, it only can update the global object. +// If the user is not nil, it only can delete the tenant object which the tenant +// specified in the labels of the object equal to this user. +func (o *operator) Update(user, resource string, obj runtime.Object) (runtime.Object, error) { + + name, err := getName(obj) + if err != nil { + return nil, err + } + + if _, err := o.Get(user, resource, name); err != nil { + return nil, err + } else { + if err := authorizer(user, obj); err != nil { + return nil, err + } + } + + switch resource { + case v2.ResourcesPluralDingTalkConfig: + return o.ksClient.NotificationV2().DingTalkConfigs().Update(context.Background(), obj.(*v2.DingTalkConfig), v1.UpdateOptions{}) + case v2.ResourcesPluralDingTalkReceiver: + return o.ksClient.NotificationV2().DingTalkReceivers().Update(context.Background(), obj.(*v2.DingTalkReceiver), v1.UpdateOptions{}) + case v2.ResourcesPluralEmailConfig: + return o.ksClient.NotificationV2().EmailConfigs().Update(context.Background(), obj.(*v2.EmailConfig), v1.UpdateOptions{}) + case v2.ResourcesPluralEmailReceiver: + return o.ksClient.NotificationV2().EmailReceivers().Update(context.Background(), obj.(*v2.EmailReceiver), v1.UpdateOptions{}) + case v2.ResourcesPluralSlackConfig: + return o.ksClient.NotificationV2().SlackConfigs().Update(context.Background(), obj.(*v2.SlackConfig), v1.UpdateOptions{}) + case v2.ResourcesPluralSlackReceiver: + return o.ksClient.NotificationV2().SlackReceivers().Update(context.Background(), obj.(*v2.SlackReceiver), v1.UpdateOptions{}) + case v2.ResourcesPluralWebhookConfig: + return o.ksClient.NotificationV2().WebhookConfigs().Update(context.Background(), obj.(*v2.WebhookConfig), v1.UpdateOptions{}) + case v2.ResourcesPluralWebhookReceiver: + return o.ksClient.NotificationV2().WebhookReceivers().Update(context.Background(), obj.(*v2.WebhookReceiver), v1.UpdateOptions{}) + case v2.ResourcesPluralWechatConfig: + return o.ksClient.NotificationV2().WechatConfigs().Update(context.Background(), obj.(*v2.WechatConfig), v1.UpdateOptions{}) + case v2.ResourcesPluralWechatReceiver: + return o.ksClient.NotificationV2().WechatReceivers().Update(context.Background(), obj.(*v2.WechatReceiver), v1.UpdateOptions{}) + default: + return nil, errors.NewInternalError(nil) + } +} + +func (o *operator) ListSecret(q *query.Query) (*api.ListResult, error) { + + appendManagedLabel(q) + return o.resourceGetter.List("secrets", constants.KubeSphereNotificationNamespace, q) +} + +func (o *operator) GetSecret(name string) (interface{}, error) { + obj, err := o.resourceGetter.Get("secrets", constants.KubeSphereNotificationNamespace, name) + if err != nil { + return nil, err + } + + if !isManagedByNotification(obj.(*corev1.Secret)) { + return nil, errors.NewForbidden(v2.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", + fmt.Errorf("secret '%s' is not managed by notification", name)) + } + + return obj, nil +} + +func (o *operator) CreateOrUpdateSecret(obj *corev1.Secret) (*corev1.Secret, error) { + + obj.Namespace = constants.KubeSphereNotificationNamespace + if obj.Labels == nil { + obj.Labels = make(map[string]string) + } + obj.Labels[constants.NotificationManagedLabel] = "true" + if obj.ResourceVersion == "" { + return o.k8sClient.CoreV1().Secrets(constants.KubeSphereNotificationNamespace).Create(context.Background(), obj, v1.CreateOptions{}) + } else { + return o.k8sClient.CoreV1().Secrets(constants.KubeSphereNotificationNamespace).Update(context.Background(), obj, v1.UpdateOptions{}) + } +} + +func (o *operator) DeleteSecret(name string) error { + + if _, err := o.GetSecret(name); err != nil { + return err + } + + return o.k8sClient.CoreV1().Secrets(constants.KubeSphereNotificationNamespace).Delete(context.Background(), name, v1.DeleteOptions{}) +} + +func (o *operator) GetObject(resource string) runtime.Object { + + switch resource { + case v2.ResourcesPluralDingTalkConfig: + return &v2.DingTalkConfig{} + case v2.ResourcesPluralDingTalkReceiver: + return &v2.DingTalkReceiver{} + case v2.ResourcesPluralEmailConfig: + return &v2.EmailConfig{} + case v2.ResourcesPluralEmailReceiver: + return &v2.EmailReceiver{} + case v2.ResourcesPluralSlackConfig: + return &v2.SlackConfig{} + case v2.ResourcesPluralSlackReceiver: + return &v2.SlackReceiver{} + case v2.ResourcesPluralWebhookConfig: + return &v2.WebhookConfig{} + case v2.ResourcesPluralWebhookReceiver: + return &v2.WebhookReceiver{} + case v2.ResourcesPluralWechatConfig: + return &v2.WechatConfig{} + case v2.ResourcesPluralWechatReceiver: + return &v2.WechatReceiver{} + default: + return nil + } +} + +func (o *operator) IsKnownResource(resource string) bool { + + if obj := o.GetObject(resource); obj == nil { + return false + } + + return true +} + +// Does the user has permission to access this object. +func authorizer(user string, obj runtime.Object) error { + // If the user is not nil, it must equal to the tenant specified in labels of the object. + if user != "" && !isOwner(user, obj) { + return errors.NewForbidden(v2.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", + fmt.Errorf("user '%s' is not the owner of object", user)) + } + + // If the user is nil, the object must be a global object. + if user == "" && !isGlobal(obj) { + return errors.NewForbidden(v2.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", + fmt.Errorf("object is not a global object")) + } + + return nil +} + +// Is the user equal to the tenant specified in the object labels. +func isOwner(user string, obj interface{}) bool { + + accessor, err := meta.Accessor(obj) + if err != nil { + klog.Errorln(err) + return false + } + + return accessor.GetLabels()["user"] == user +} + +func isConfig(obj runtime.Object) bool { + switch obj.(type) { + case *v2.DingTalkConfig, *v2.EmailConfig, *v2.SlackConfig, *v2.WebhookConfig, *v2.WechatConfig: + return true + default: + return false + } +} + +// Is the object is a global object. +func isGlobal(obj runtime.Object) bool { + accessor, err := meta.Accessor(obj) + if err != nil { + klog.Errorln(err) + return false + } + + if isConfig(obj) { + return accessor.GetLabels()["type"] == "default" + } else { + return accessor.GetLabels()["type"] == "global" + } +} + +func appendTenantLabel(user string, q *query.Query) { + + if len(q.LabelSelector) > 0 { + q.LabelSelector = q.LabelSelector + "," + } + q.LabelSelector = q.LabelSelector + "type=tenant,user=" + user +} + +func appendGlobalLabel(resource string, q *query.Query) { + + if len(q.LabelSelector) > 0 { + q.LabelSelector = q.LabelSelector + "," + } + + switch resource { + case v2.ResourcesPluralDingTalkConfig, v2.ResourcesPluralEmailConfig, + v2.ResourcesPluralSlackConfig, v2.ResourcesPluralWebhookConfig, v2.ResourcesPluralWechatConfig: + q.LabelSelector = q.LabelSelector + "type=default" + case v2.ResourcesPluralDingTalkReceiver, v2.ResourcesPluralEmailReceiver, + v2.ResourcesPluralSlackReceiver, v2.ResourcesPluralWebhookReceiver, v2.ResourcesPluralWechatReceiver: + q.LabelSelector = q.LabelSelector + "type=global" + } +} + +func appendManagedLabel(q *query.Query) { + + if len(q.LabelSelector) > 0 { + q.LabelSelector = q.LabelSelector + "," + } + q.LabelSelector = q.LabelSelector + constants.NotificationManagedLabel + "=" + "true" +} + +func isManagedByNotification(secret *corev1.Secret) bool { + return secret.Labels[constants.NotificationManagedLabel] == "true" +} + +func getName(obj runtime.Object) (string, error) { + + accessor, err := meta.Accessor(obj) + if err != nil { + return "", err + } + + return accessor.GetName(), nil +} diff --git a/pkg/models/notification/notification_test.go b/pkg/models/notification/notification_test.go new file mode 100644 index 000000000..6a97dc5d5 --- /dev/null +++ b/pkg/models/notification/notification_test.go @@ -0,0 +1,206 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notification + +import ( + "github.com/google/go-cmp/cmp" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + fakek8s "k8s.io/client-go/kubernetes/fake" + "kubesphere.io/kubesphere/pkg/api" + "kubesphere.io/kubesphere/pkg/apiserver/query" + fakeks "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" + "kubesphere.io/kubesphere/pkg/constants" + "kubesphere.io/kubesphere/pkg/informers" + "reflect" + "testing" +) + +func TestOperator_ListSecret(t *testing.T) { + o := prepare() + tests := []struct { + result *api.ListResult + expectError error + }{ + { + result: &api.ListResult{ + Items: []interface{}{secret1, secret2, secret3}, + TotalItems: 3, + }, + }, + } + + for i, test := range tests { + result, err := o.ListSecret(&query.Query{ + SortBy: query.FieldName, + Ascending: true, + }) + + if err != nil { + if !reflect.DeepEqual(err, test.expectError) { + t.Errorf("got %#v, expected %#v", err, test.expectError) + } + continue + } + + if diff := cmp.Diff(result, test.result); diff != "" { + t.Errorf("case %d, %s", i, diff) + } + } +} + +func TestOperator_GetSecret(t *testing.T) { + o := prepare() + tests := []struct { + result *corev1.Secret + name string + expectError error + }{ + { + result: secret1, + name: secret1.Name, + expectError: nil, + }, + { + name: "foo4", + expectError: errors.NewNotFound(corev1.Resource("secret"), "foo4"), + }, + } + + for _, test := range tests { + result, err := o.GetSecret(test.name) + + if err != nil { + if !reflect.DeepEqual(err, test.expectError) { + t.Errorf("got %#v, expected %#v", err, test.expectError) + } + continue + } + + if diff := cmp.Diff(result, test.result); diff != "" { + t.Error(diff) + } + } +} + +func TestOperator_CreateOrUpdateSecret(t *testing.T) { + o := prepare() + tests := []struct { + result *corev1.Secret + secret *corev1.Secret + expectError error + }{ + { + result: &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test", + Namespace: constants.KubeSphereNotificationNamespace, + Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + }, + }, + secret: &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test", + }, + }, + expectError: nil, + }, + } + + for i, test := range tests { + result, err := o.CreateOrUpdateSecret(test.secret) + + if err != nil { + if !reflect.DeepEqual(err, test.expectError) { + t.Errorf("case %d, got %#v, expected %#v", i, err, test.expectError) + } + continue + } + + if diff := cmp.Diff(result, test.result); diff != "" { + t.Error(diff) + } + } +} + +func TestOperator_DeleteSecret(t *testing.T) { + o := prepare() + tests := []struct { + name string + expectError error + }{ + { + name: "foo4", + expectError: errors.NewNotFound(corev1.Resource("secret"), "foo4"), + }, + } + + for i, test := range tests { + err := o.DeleteSecret(test.name) + if err != nil { + if test.expectError != nil && test.expectError.Error() == err.Error() { + continue + } else { + if !reflect.DeepEqual(err, test.expectError) { + t.Errorf("case %d, got %#v, expected %#v", i, err, test.expectError) + } + } + } + } +} + +var ( + secret1 = &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo1", + Namespace: constants.KubeSphereNotificationNamespace, + Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + }, + } + + secret2 = &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo2", + Namespace: constants.KubeSphereNotificationNamespace, + Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + }, + } + + secret3 = &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo3", + Namespace: constants.KubeSphereNotificationNamespace, + Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + }, + } + + secrets = []*corev1.Secret{secret1, secret2, secret3} +) + +func prepare() Operator { + + ksClient := fakeks.NewSimpleClientset() + k8sClient := fakek8s.NewSimpleClientset() + fakeInformerFactory := informers.NewInformerFactories(k8sClient, ksClient, nil, nil, nil, nil) + + for _, secret := range secrets { + _ = fakeInformerFactory.KubernetesSharedInformerFactory().Core().V1().Secrets().Informer().GetIndexer().Add(secret) + } + + return NewOperator(fakeInformerFactory, k8sClient, ksClient) +} diff --git a/pkg/models/resources/v1alpha3/notification/notification.go b/pkg/models/resources/v1alpha3/notification/notification.go new file mode 100644 index 000000000..aa77737ad --- /dev/null +++ b/pkg/models/resources/v1alpha3/notification/notification.go @@ -0,0 +1,302 @@ +/* +Copyright 2019 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notification + +import ( + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime" + "kubesphere.io/kubesphere/pkg/api" + "kubesphere.io/kubesphere/pkg/apiserver/query" + ksinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" + "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3" +) + +type dingtalkConfigGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewDingTalkConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &dingtalkConfigGetter{ksInformer: informer} +} + +func (g *dingtalkConfigGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().DingTalkConfigs().Lister().Get(name) +} + +func (g *dingtalkConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().DingTalkConfigs().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type dingtalkReceiverGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewDingTalkReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &dingtalkReceiverGetter{ksInformer: informer} +} + +func (g *dingtalkReceiverGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().DingTalkReceivers().Lister().Get(name) +} + +func (g *dingtalkReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().DingTalkReceivers().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type emailConfigGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewEmailConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &emailConfigGetter{ksInformer: informer} +} + +func (g *emailConfigGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().EmailConfigs().Lister().Get(name) +} + +func (g *emailConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().EmailConfigs().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type emailReceiverGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewEmailReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &emailReceiverGetter{ksInformer: informer} +} + +func (g *emailReceiverGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().EmailReceivers().Lister().Get(name) +} + +func (g *emailReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().EmailReceivers().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type slackConfigGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewSlackConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &slackConfigGetter{ksInformer: informer} +} + +func (g *slackConfigGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().SlackConfigs().Lister().Get(name) +} + +func (g *slackConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().SlackConfigs().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type slackReceiverGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewSlackReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &slackReceiverGetter{ksInformer: informer} +} + +func (g *slackReceiverGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().SlackReceivers().Lister().Get(name) +} + +func (g *slackReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().SlackReceivers().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type webhookConfigGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewWebhookConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &webhookConfigGetter{ksInformer: informer} +} + +func (g *webhookConfigGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().WebhookConfigs().Lister().Get(name) +} + +func (g *webhookConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().WebhookConfigs().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type webhookReceiverGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewWebhookReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &webhookReceiverGetter{ksInformer: informer} +} + +func (g *webhookReceiverGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().WebhookReceivers().Lister().Get(name) +} + +func (g *webhookReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().WebhookReceivers().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type wechatConfigGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewWechatConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &wechatConfigGetter{ksInformer: informer} +} + +func (g *wechatConfigGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().WechatConfigs().Lister().Get(name) +} + +func (g *wechatConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().WechatConfigs().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +type wechatReceiverGetter struct { + ksInformer ksinformers.SharedInformerFactory +} + +func NewWechatReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &wechatReceiverGetter{ksInformer: informer} +} + +func (g *wechatReceiverGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2().WechatReceivers().Lister().Get(name) +} + +func (g *wechatReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2().WechatReceivers().Lister().List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, obj := range objs { + result = append(result, obj) + } + return v1alpha3.DefaultList(result, query, compare, filter), nil +} + +func compare(left runtime.Object, right runtime.Object, field query.Field) bool { + + leftObj, err := meta.Accessor(left) + if err != nil { + return false + } + + rightObj, err := meta.Accessor(right) + if err != nil { + return false + } + + return v1alpha3.DefaultObjectMetaCompare(meta.AsPartialObjectMetadata(leftObj).ObjectMeta, + meta.AsPartialObjectMetadata(rightObj).ObjectMeta, field) +} + +func filter(object runtime.Object, filter query.Filter) bool { + + accessor, err := meta.Accessor(object) + if err != nil { + return false + } + + return v1alpha3.DefaultObjectMetaFilter(meta.AsPartialObjectMetadata(accessor).ObjectMeta, filter) +} diff --git a/pkg/models/resources/v1alpha3/notification/notification_test.go b/pkg/models/resources/v1alpha3/notification/notification_test.go new file mode 100644 index 000000000..e8023250c --- /dev/null +++ b/pkg/models/resources/v1alpha3/notification/notification_test.go @@ -0,0 +1,204 @@ +/* +Copyright 2019 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notification + +import ( + "github.com/google/go-cmp/cmp" + "github.com/google/uuid" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/tools/cache" + "kubesphere.io/kubesphere/pkg/api" + v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apiserver/query" + "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" + ksinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" + "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3" + "kubesphere.io/kubesphere/pkg/server/errors" + "math/rand" + "sort" + "testing" +) + +const ( + Prefix = "foo" + LengthMin = 3 + LengthMax = 10 +) + +func TestListObjects(t *testing.T) { + tests := []struct { + description string + key string + }{ + { + "test name filter", + v2.ResourcesPluralDingTalkConfig, + }, + { + "test name filter", + v2.ResourcesPluralDingTalkReceiver, + }, + { + "test name filter", + v2.ResourcesPluralEmailConfig, + }, + { + "test name filter", + v2.ResourcesPluralEmailReceiver, + }, + { + "test name filter", + v2.ResourcesPluralSlackConfig, + }, + { + "test name filter", + v2.ResourcesPluralSlackReceiver, + }, + { + "test name filter", + v2.ResourcesPluralWebhookConfig, + }, + { + "test name filter", + v2.ResourcesPluralWebhookReceiver, + }, + { + "test name filter", + v2.ResourcesPluralWechatConfig, + }, + { + "test name filter", + v2.ResourcesPluralWechatReceiver, + }, + } + + q := &query.Query{ + Pagination: &query.Pagination{ + Limit: 10, + Offset: 0, + }, + SortBy: query.FieldName, + Ascending: true, + Filters: map[query.Field]query.Value{query.FieldName: query.Value(Prefix)}, + } + + for _, test := range tests { + + getter, objects, err := prepare(test.key) + if err != nil { + t.Fatal(err) + } + + got, err := getter.List("", q) + if err != nil { + t.Fatal(err) + } + + expected := &api.ListResult{ + Items: objects, + TotalItems: len(objects), + } + + if diff := cmp.Diff(got, expected); diff != "" { + t.Errorf("[%s] %T differ (-got, +want): %s", test.description, expected, diff) + } + } +} + +func prepare(key string) (v1alpha3.Interface, []interface{}, error) { + client := fake.NewSimpleClientset() + informer := ksinformers.NewSharedInformerFactory(client, 0) + + var obj runtime.Object + var indexer cache.Indexer + var getter func(informer ksinformers.SharedInformerFactory) v1alpha3.Interface + switch key { + case v2.ResourcesPluralDingTalkConfig: + indexer = informer.Notification().V2().DingTalkConfigs().Informer().GetIndexer() + getter = NewDingTalkConfigGetter + obj = &v2.DingTalkConfig{} + case v2.ResourcesPluralDingTalkReceiver: + indexer = informer.Notification().V2().DingTalkReceivers().Informer().GetIndexer() + getter = NewDingTalkReceiverGetter + obj = &v2.DingTalkReceiver{} + case v2.ResourcesPluralEmailConfig: + indexer = informer.Notification().V2().EmailConfigs().Informer().GetIndexer() + getter = NewEmailConfigGetter + obj = &v2.EmailConfig{} + case v2.ResourcesPluralEmailReceiver: + indexer = informer.Notification().V2().EmailReceivers().Informer().GetIndexer() + getter = NewEmailReceiverGetter + obj = &v2.EmailReceiver{} + case v2.ResourcesPluralSlackConfig: + indexer = informer.Notification().V2().SlackConfigs().Informer().GetIndexer() + getter = NewSlackConfigGetter + obj = &v2.SlackConfig{} + case v2.ResourcesPluralSlackReceiver: + indexer = informer.Notification().V2().SlackReceivers().Informer().GetIndexer() + getter = NewSlackReceiverGetter + obj = &v2.SlackReceiver{} + case v2.ResourcesPluralWebhookConfig: + indexer = informer.Notification().V2().WebhookConfigs().Informer().GetIndexer() + getter = NewWebhookConfigGetter + obj = &v2.WebhookConfig{} + case v2.ResourcesPluralWebhookReceiver: + indexer = informer.Notification().V2().WebhookReceivers().Informer().GetIndexer() + getter = NewWebhookReceiverGetter + obj = &v2.WebhookReceiver{} + case v2.ResourcesPluralWechatConfig: + indexer = informer.Notification().V2().WechatConfigs().Informer().GetIndexer() + getter = NewWechatConfigGetter + obj = &v2.WechatConfig{} + case v2.ResourcesPluralWechatReceiver: + indexer = informer.Notification().V2().WechatReceivers().Informer().GetIndexer() + getter = NewWechatReceiverGetter + obj = &v2.WechatReceiver{} + default: + return nil, nil, errors.New("unkonwed type %s", key) + } + + num := rand.Intn(LengthMax) + if num < LengthMin { + num = LengthMin + } + + var suffix []string + for i := 0; i < num; i++ { + s := uuid.New().String() + suffix = append(suffix, s) + } + sort.Strings(suffix) + + var objects []interface{} + for i := 0; i < num; i++ { + val := obj.DeepCopyObject() + accessor, err := meta.Accessor(val) + if err != nil { + return nil, nil, err + } + + accessor.SetName(Prefix + "-" + suffix[i]) + err = indexer.Add(accessor) + if err != nil { + return nil, nil, err + } + objects = append(objects, val) + } + + return getter(informer), objects, nil +} diff --git a/pkg/models/resources/v1alpha3/resource/resource.go b/pkg/models/resources/v1alpha3/resource/resource.go index 6590ba07a..23f1e82c3 100644 --- a/pkg/models/resources/v1alpha3/resource/resource.go +++ b/pkg/models/resources/v1alpha3/resource/resource.go @@ -26,6 +26,7 @@ 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" + notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2" typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" @@ -61,10 +62,12 @@ import ( "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/namespace" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/networkpolicy" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/node" + "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/notification" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/persistentvolumeclaim" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/pod" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/role" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/rolebinding" + "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/secret" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/service" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/serviceaccount" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/statefulset" @@ -92,6 +95,7 @@ func NewResourceGetter(factory informers.InformerFactory, cache cache.Cache) *Re getters[schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}] = service.New(factory.KubernetesSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"}] = namespace.New(factory.KubernetesSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"}] = configmap.New(factory.KubernetesSharedInformerFactory()) + getters[schema.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"}] = secret.New(factory.KubernetesSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}] = pod.New(factory.KubernetesSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"}] = node.New(factory.KubernetesSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "", Version: "v1", Resource: "serviceaccounts"}] = serviceaccount.New(factory.KubernetesSharedInformerFactory()) @@ -122,6 +126,17 @@ func NewResourceGetter(factory informers.InformerFactory, cache cache.Cache) *Re getters[schema.GroupVersionResource{Group: "cluster.kubesphere.io", Version: "v1alpha1", Resource: "clusters"}] = cluster.New(factory.KubeSphereSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "v1", Resource: "customresourcedefinitions"}] = customresourcedefinition.New(factory.ApiExtensionSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralDingTalkConfig)] = notification.NewDingTalkConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralDingTalkReceiver)] = notification.NewDingTalkReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralEmailConfig)] = notification.NewEmailConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralEmailReceiver)] = notification.NewEmailReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralSlackConfig)] = notification.NewSlackConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralSlackReceiver)] = notification.NewSlackReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWebhookConfig)] = notification.NewWebhookConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWebhookReceiver)] = notification.NewWebhookReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWechatConfig)] = notification.NewWechatConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWechatReceiver)] = notification.NewWechatReceiverGetter(factory.KubeSphereSharedInformerFactory()) + // federated resources getters[typesv1beta1.SchemeGroupVersion.WithResource(typesv1beta1.ResourcePluralFederatedNamespace)] = federatednamespace.New(factory.KubeSphereSharedInformerFactory()) getters[typesv1beta1.SchemeGroupVersion.WithResource(typesv1beta1.ResourcePluralFederatedDeployment)] = federateddeployment.New(factory.KubeSphereSharedInformerFactory()) diff --git a/pkg/models/resources/v1alpha3/secret/secrets.go b/pkg/models/resources/v1alpha3/secret/secrets.go new file mode 100644 index 000000000..3c2569299 --- /dev/null +++ b/pkg/models/resources/v1alpha3/secret/secrets.go @@ -0,0 +1,77 @@ +/* +Copyright 2019 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package secret + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/informers" + "kubesphere.io/kubesphere/pkg/api" + "kubesphere.io/kubesphere/pkg/apiserver/query" + "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3" + + "k8s.io/api/core/v1" +) + +type secretSearcher struct { + informers informers.SharedInformerFactory +} + +func New(informers informers.SharedInformerFactory) v1alpha3.Interface { + return &secretSearcher{informers: informers} +} + +func (s *secretSearcher) Get(namespace, name string) (runtime.Object, error) { + return s.informers.Core().V1().Secrets().Lister().Secrets(namespace).Get(name) +} + +func (s *secretSearcher) List(namespace string, query *query.Query) (*api.ListResult, error) { + secrets, err := s.informers.Core().V1().Secrets().Lister().Secrets(namespace).List(query.Selector()) + if err != nil { + return nil, err + } + + var result []runtime.Object + for _, secret := range secrets { + result = append(result, secret) + } + + return v1alpha3.DefaultList(result, query, s.compare, s.filter), nil +} + +func (s *secretSearcher) compare(left runtime.Object, right runtime.Object, field query.Field) bool { + + leftSecret, ok := left.(*v1.Secret) + if !ok { + return false + } + + rightSecret, ok := right.(*v1.Secret) + if !ok { + return false + } + + return v1alpha3.DefaultObjectMetaCompare(leftSecret.ObjectMeta, rightSecret.ObjectMeta, field) +} + +func (s *secretSearcher) filter(object runtime.Object, filter query.Filter) bool { + secret, ok := object.(*v1.Secret) + if !ok { + return false + } + + return v1alpha3.DefaultObjectMetaFilter(secret.ObjectMeta, filter) +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/cache/informertest/fake_cache.go b/vendor/sigs.k8s.io/controller-runtime/pkg/cache/informertest/fake_cache.go new file mode 100644 index 000000000..e68620829 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/cache/informertest/fake_cache.go @@ -0,0 +1,141 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package informertest + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/kubernetes/scheme" + toolscache "k8s.io/client-go/tools/cache" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllertest" +) + +var _ cache.Cache = &FakeInformers{} + +// FakeInformers is a fake implementation of Informers +type FakeInformers struct { + InformersByGVK map[schema.GroupVersionKind]toolscache.SharedIndexInformer + Scheme *runtime.Scheme + Error error + Synced *bool +} + +// GetInformerForKind implements Informers +func (c *FakeInformers) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error) { + if c.Scheme == nil { + c.Scheme = scheme.Scheme + } + obj, err := c.Scheme.New(gvk) + if err != nil { + return nil, err + } + return c.informerFor(gvk, obj) +} + +// FakeInformerForKind implements Informers +func (c *FakeInformers) FakeInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (*controllertest.FakeInformer, error) { + if c.Scheme == nil { + c.Scheme = scheme.Scheme + } + obj, err := c.Scheme.New(gvk) + if err != nil { + return nil, err + } + i, err := c.informerFor(gvk, obj) + if err != nil { + return nil, err + } + return i.(*controllertest.FakeInformer), nil +} + +// GetInformer implements Informers +func (c *FakeInformers) GetInformer(ctx context.Context, obj runtime.Object) (cache.Informer, error) { + if c.Scheme == nil { + c.Scheme = scheme.Scheme + } + gvks, _, err := c.Scheme.ObjectKinds(obj) + if err != nil { + return nil, err + } + gvk := gvks[0] + return c.informerFor(gvk, obj) +} + +// WaitForCacheSync implements Informers +func (c *FakeInformers) WaitForCacheSync(stop <-chan struct{}) bool { + if c.Synced == nil { + return true + } + return *c.Synced +} + +// FakeInformerFor implements Informers +func (c *FakeInformers) FakeInformerFor(obj runtime.Object) (*controllertest.FakeInformer, error) { + if c.Scheme == nil { + c.Scheme = scheme.Scheme + } + gvks, _, err := c.Scheme.ObjectKinds(obj) + if err != nil { + return nil, err + } + gvk := gvks[0] + i, err := c.informerFor(gvk, obj) + if err != nil { + return nil, err + } + return i.(*controllertest.FakeInformer), nil +} + +func (c *FakeInformers) informerFor(gvk schema.GroupVersionKind, _ runtime.Object) (toolscache.SharedIndexInformer, error) { + if c.Error != nil { + return nil, c.Error + } + if c.InformersByGVK == nil { + c.InformersByGVK = map[schema.GroupVersionKind]toolscache.SharedIndexInformer{} + } + informer, ok := c.InformersByGVK[gvk] + if ok { + return informer, nil + } + + c.InformersByGVK[gvk] = &controllertest.FakeInformer{} + return c.InformersByGVK[gvk], nil +} + +// Start implements Informers +func (c *FakeInformers) Start(stopCh <-chan struct{}) error { + return c.Error +} + +// IndexField implements Cache +func (c *FakeInformers) IndexField(ctx context.Context, obj runtime.Object, field string, extractValue client.IndexerFunc) error { + return nil +} + +// Get implements Cache +func (c *FakeInformers) Get(ctx context.Context, key client.ObjectKey, obj runtime.Object) error { + return nil +} + +// List implements Cache +func (c *FakeInformers) List(ctx context.Context, list runtime.Object, opts ...client.ListOption) error { + return nil +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go new file mode 100644 index 000000000..e7d3c5c35 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go @@ -0,0 +1,409 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "strconv" + "strings" + + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + utilrand "k8s.io/apimachinery/pkg/util/rand" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/testing" + + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + "sigs.k8s.io/controller-runtime/pkg/internal/objectutil" +) + +type versionedTracker struct { + testing.ObjectTracker +} + +type fakeClient struct { + tracker versionedTracker + scheme *runtime.Scheme +} + +var _ client.Client = &fakeClient{} + +const ( + maxNameLength = 63 + randomLength = 5 + maxGeneratedNameLength = maxNameLength - randomLength +) + +// NewFakeClient creates a new fake client for testing. +// You can choose to initialize it with a slice of runtime.Object. +// Deprecated: use NewFakeClientWithScheme. You should always be +// passing an explicit Scheme. +func NewFakeClient(initObjs ...runtime.Object) client.Client { + return NewFakeClientWithScheme(scheme.Scheme, initObjs...) +} + +// NewFakeClientWithScheme creates a new fake client with the given scheme +// for testing. +// You can choose to initialize it with a slice of runtime.Object. +func NewFakeClientWithScheme(clientScheme *runtime.Scheme, initObjs ...runtime.Object) client.Client { + tracker := testing.NewObjectTracker(clientScheme, scheme.Codecs.UniversalDecoder()) + for _, obj := range initObjs { + err := tracker.Add(obj) + if err != nil { + panic(fmt.Errorf("failed to add object %v to fake client: %w", obj, err)) + } + } + return &fakeClient{ + tracker: versionedTracker{tracker}, + scheme: clientScheme, + } +} + +func (t versionedTracker) Create(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error { + accessor, err := meta.Accessor(obj) + if err != nil { + return err + } + if accessor.GetName() == "" { + return apierrors.NewInvalid( + obj.GetObjectKind().GroupVersionKind().GroupKind(), + accessor.GetName(), + field.ErrorList{field.Required(field.NewPath("metadata.name"), "name is required")}) + } + if accessor.GetResourceVersion() != "" { + return apierrors.NewBadRequest("resourceVersion can not be set for Create requests") + } + accessor.SetResourceVersion("1") + if err := t.ObjectTracker.Create(gvr, obj, ns); err != nil { + accessor.SetResourceVersion("") + return err + } + return nil +} + +func (t versionedTracker) Update(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error { + accessor, err := meta.Accessor(obj) + if err != nil { + return fmt.Errorf("failed to get accessor for object: %v", err) + } + if accessor.GetName() == "" { + return apierrors.NewInvalid( + obj.GetObjectKind().GroupVersionKind().GroupKind(), + accessor.GetName(), + field.ErrorList{field.Required(field.NewPath("metadata.name"), "name is required")}) + } + oldObject, err := t.ObjectTracker.Get(gvr, ns, accessor.GetName()) + if err != nil { + return err + } + oldAccessor, err := meta.Accessor(oldObject) + if err != nil { + return err + } + if accessor.GetResourceVersion() != oldAccessor.GetResourceVersion() { + return apierrors.NewConflict(gvr.GroupResource(), accessor.GetName(), errors.New("object was modified")) + } + if oldAccessor.GetResourceVersion() == "" { + oldAccessor.SetResourceVersion("0") + } + intResourceVersion, err := strconv.ParseUint(oldAccessor.GetResourceVersion(), 10, 64) + if err != nil { + return fmt.Errorf("can not convert resourceVersion %q to int: %v", oldAccessor.GetResourceVersion(), err) + } + intResourceVersion++ + accessor.SetResourceVersion(strconv.FormatUint(intResourceVersion, 10)) + return t.ObjectTracker.Update(gvr, obj, ns) +} + +func (c *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj runtime.Object) error { + gvr, err := getGVRFromObject(obj, c.scheme) + if err != nil { + return err + } + o, err := c.tracker.Get(gvr, key.Namespace, key.Name) + if err != nil { + return err + } + + gvk, err := apiutil.GVKForObject(obj, c.scheme) + if err != nil { + return err + } + ta, err := meta.TypeAccessor(o) + if err != nil { + return err + } + ta.SetKind(gvk.Kind) + ta.SetAPIVersion(gvk.GroupVersion().String()) + + j, err := json.Marshal(o) + if err != nil { + return err + } + decoder := scheme.Codecs.UniversalDecoder() + _, _, err = decoder.Decode(j, nil, obj) + return err +} + +func (c *fakeClient) List(ctx context.Context, obj runtime.Object, opts ...client.ListOption) error { + gvk, err := apiutil.GVKForObject(obj, c.scheme) + if err != nil { + return err + } + + OriginalKind := gvk.Kind + + if !strings.HasSuffix(gvk.Kind, "List") { + return fmt.Errorf("non-list type %T (kind %q) passed as output", obj, gvk) + } + // we need the non-list GVK, so chop off the "List" from the end of the kind + gvk.Kind = gvk.Kind[:len(gvk.Kind)-4] + + listOpts := client.ListOptions{} + listOpts.ApplyOptions(opts) + + gvr, _ := meta.UnsafeGuessKindToResource(gvk) + o, err := c.tracker.List(gvr, gvk, listOpts.Namespace) + if err != nil { + return err + } + + ta, err := meta.TypeAccessor(o) + if err != nil { + return err + } + ta.SetKind(OriginalKind) + ta.SetAPIVersion(gvk.GroupVersion().String()) + + j, err := json.Marshal(o) + if err != nil { + return err + } + decoder := scheme.Codecs.UniversalDecoder() + _, _, err = decoder.Decode(j, nil, obj) + if err != nil { + return err + } + + if listOpts.LabelSelector != nil { + objs, err := meta.ExtractList(obj) + if err != nil { + return err + } + filteredObjs, err := objectutil.FilterWithLabels(objs, listOpts.LabelSelector) + if err != nil { + return err + } + err = meta.SetList(obj, filteredObjs) + if err != nil { + return err + } + } + return nil +} + +func (c *fakeClient) Create(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error { + createOptions := &client.CreateOptions{} + createOptions.ApplyOptions(opts) + + for _, dryRunOpt := range createOptions.DryRun { + if dryRunOpt == metav1.DryRunAll { + return nil + } + } + + gvr, err := getGVRFromObject(obj, c.scheme) + if err != nil { + return err + } + accessor, err := meta.Accessor(obj) + if err != nil { + return err + } + + if accessor.GetName() == "" && accessor.GetGenerateName() != "" { + base := accessor.GetGenerateName() + if len(base) > maxGeneratedNameLength { + base = base[:maxGeneratedNameLength] + } + accessor.SetName(fmt.Sprintf("%s%s", base, utilrand.String(randomLength))) + } + + return c.tracker.Create(gvr, obj, accessor.GetNamespace()) +} + +func (c *fakeClient) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error { + gvr, err := getGVRFromObject(obj, c.scheme) + if err != nil { + return err + } + accessor, err := meta.Accessor(obj) + if err != nil { + return err + } + delOptions := client.DeleteOptions{} + delOptions.ApplyOptions(opts) + + //TODO: implement propagation + return c.tracker.Delete(gvr, accessor.GetNamespace(), accessor.GetName()) +} + +func (c *fakeClient) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...client.DeleteAllOfOption) error { + gvk, err := apiutil.GVKForObject(obj, c.scheme) + if err != nil { + return err + } + + dcOptions := client.DeleteAllOfOptions{} + dcOptions.ApplyOptions(opts) + + gvr, _ := meta.UnsafeGuessKindToResource(gvk) + o, err := c.tracker.List(gvr, gvk, dcOptions.Namespace) + if err != nil { + return err + } + + objs, err := meta.ExtractList(o) + if err != nil { + return err + } + filteredObjs, err := objectutil.FilterWithLabels(objs, dcOptions.LabelSelector) + if err != nil { + return err + } + for _, o := range filteredObjs { + accessor, err := meta.Accessor(o) + if err != nil { + return err + } + err = c.tracker.Delete(gvr, accessor.GetNamespace(), accessor.GetName()) + if err != nil { + return err + } + } + return nil +} + +func (c *fakeClient) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error { + updateOptions := &client.UpdateOptions{} + updateOptions.ApplyOptions(opts) + + for _, dryRunOpt := range updateOptions.DryRun { + if dryRunOpt == metav1.DryRunAll { + return nil + } + } + + gvr, err := getGVRFromObject(obj, c.scheme) + if err != nil { + return err + } + accessor, err := meta.Accessor(obj) + if err != nil { + return err + } + return c.tracker.Update(gvr, obj, accessor.GetNamespace()) +} + +func (c *fakeClient) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOption) error { + patchOptions := &client.PatchOptions{} + patchOptions.ApplyOptions(opts) + + for _, dryRunOpt := range patchOptions.DryRun { + if dryRunOpt == metav1.DryRunAll { + return nil + } + } + + gvr, err := getGVRFromObject(obj, c.scheme) + if err != nil { + return err + } + accessor, err := meta.Accessor(obj) + if err != nil { + return err + } + data, err := patch.Data(obj) + if err != nil { + return err + } + + reaction := testing.ObjectReaction(c.tracker) + handled, o, err := reaction(testing.NewPatchAction(gvr, accessor.GetNamespace(), accessor.GetName(), patch.Type(), data)) + if err != nil { + return err + } + if !handled { + panic("tracker could not handle patch method") + } + + gvk, err := apiutil.GVKForObject(obj, c.scheme) + if err != nil { + return err + } + ta, err := meta.TypeAccessor(o) + if err != nil { + return err + } + ta.SetKind(gvk.Kind) + ta.SetAPIVersion(gvk.GroupVersion().String()) + + j, err := json.Marshal(o) + if err != nil { + return err + } + decoder := scheme.Codecs.UniversalDecoder() + _, _, err = decoder.Decode(j, nil, obj) + return err +} + +func (c *fakeClient) Status() client.StatusWriter { + return &fakeStatusWriter{client: c} +} + +func getGVRFromObject(obj runtime.Object, scheme *runtime.Scheme) (schema.GroupVersionResource, error) { + gvk, err := apiutil.GVKForObject(obj, scheme) + if err != nil { + return schema.GroupVersionResource{}, err + } + gvr, _ := meta.UnsafeGuessKindToResource(gvk) + return gvr, nil +} + +type fakeStatusWriter struct { + client *fakeClient +} + +func (sw *fakeStatusWriter) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error { + // TODO(droot): This results in full update of the obj (spec + status). Need + // a way to update status field only. + return sw.client.Update(ctx, obj, opts...) +} + +func (sw *fakeStatusWriter) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOption) error { + // TODO(droot): This results in full update of the obj (spec + status). Need + // a way to update status field only. + return sw.client.Patch(ctx, obj, patch, opts...) +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/doc.go b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/doc.go new file mode 100644 index 000000000..a45d70332 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/doc.go @@ -0,0 +1,33 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/* +Package fake provides a fake client for testing. + +Deprecated: please use pkg/envtest for testing. This package will be dropped +before the v1.0.0 release. + +An fake client is backed by its simple object store indexed by GroupVersionResource. +You can create a fake client with optional objects. + + client := NewFakeClient(initObjs...) // initObjs is a slice of runtime.Object + +You can invoke the methods defined in the Client interface. + +When it doubt, it's almost always better not to use this package and instead use +envtest.Environment with a real client and API server. +*/ +package fake diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/doc.go b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/doc.go new file mode 100644 index 000000000..91c5a3e35 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package controllertest contains fake informers for testing controllers +// When in doubt, it's almost always better to test against a real API server +// using envtest.Environment. +package controllertest diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/testing.go b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/testing.go new file mode 100644 index 000000000..570a97e36 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/testing.go @@ -0,0 +1,62 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package controllertest + +import ( + "time" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/util/workqueue" +) + +var _ runtime.Object = &ErrorType{} + +// ErrorType implements runtime.Object but isn't registered in any scheme and should cause errors in tests as a result. +type ErrorType struct{} + +// GetObjectKind implements runtime.Object +func (ErrorType) GetObjectKind() schema.ObjectKind { return nil } + +// DeepCopyObject implements runtime.Object +func (ErrorType) DeepCopyObject() runtime.Object { return nil } + +var _ workqueue.RateLimitingInterface = Queue{} + +// Queue implements a RateLimiting queue as a non-ratelimited queue for testing. +// This helps testing by having functions that use a RateLimiting queue synchronously add items to the queue. +type Queue struct { + workqueue.Interface +} + +// AddAfter implements RateLimitingInterface. +func (q Queue) AddAfter(item interface{}, duration time.Duration) { + q.Add(item) +} + +// AddRateLimited implements RateLimitingInterface. TODO(community): Implement this. +func (q Queue) AddRateLimited(item interface{}) { + q.Add(item) +} + +// Forget implements RateLimitingInterface. TODO(community): Implement this. +func (q Queue) Forget(item interface{}) {} + +// NumRequeues implements RateLimitingInterface. TODO(community): Implement this. +func (q Queue) NumRequeues(item interface{}) int { + return 0 +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/unconventionallisttypecrd.go b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/unconventionallisttypecrd.go new file mode 100644 index 000000000..a4d23f8ab --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/unconventionallisttypecrd.go @@ -0,0 +1,60 @@ +package controllertest + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +var _ runtime.Object = &UnconventionalListType{} +var _ runtime.Object = &UnconventionalListTypeList{} + +// UnconventionalListType is used to test CRDs with List types that +// have a slice of pointers rather than a slice of literals. +type UnconventionalListType struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec string `json:"spec,omitempty"` +} + +// DeepCopyObject implements runtime.Object +// Handwritten for simplicity. +func (u *UnconventionalListType) DeepCopyObject() runtime.Object { + return u.DeepCopy() +} + +// DeepCopy implements *UnconventionalListType +// Handwritten for simplicity. +func (u *UnconventionalListType) DeepCopy() *UnconventionalListType { + return &UnconventionalListType{ + TypeMeta: u.TypeMeta, + ObjectMeta: *u.ObjectMeta.DeepCopy(), + Spec: u.Spec, + } +} + +// UnconventionalListTypeList is used to test CRDs with List types that +// have a slice of pointers rather than a slice of literals. +type UnconventionalListTypeList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []*UnconventionalListType `json:"items"` +} + +// DeepCopyObject implements runtime.Object +// Handwritten for simplicity. +func (u *UnconventionalListTypeList) DeepCopyObject() runtime.Object { + return u.DeepCopy() +} + +// DeepCopy implements *UnconventionalListTypeListt +// Handwritten for simplicity. +func (u *UnconventionalListTypeList) DeepCopy() *UnconventionalListTypeList { + out := &UnconventionalListTypeList{ + TypeMeta: u.TypeMeta, + ListMeta: *u.ListMeta.DeepCopy(), + } + for _, item := range u.Items { + out.Items = append(out.Items, item.DeepCopy()) + } + return out +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/util.go b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/util.go new file mode 100644 index 000000000..5557c80cf --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/controller/controllertest/util.go @@ -0,0 +1,108 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package controllertest + +import ( + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/cache" +) + +var _ cache.SharedIndexInformer = &FakeInformer{} + +// FakeInformer provides fake Informer functionality for testing +type FakeInformer struct { + // Synced is returned by the HasSynced functions to implement the Informer interface + Synced bool + + // RunCount is incremented each time RunInformersAndControllers is called + RunCount int + + handlers []cache.ResourceEventHandler +} + +// AddIndexers does nothing. TODO(community): Implement this. +func (f *FakeInformer) AddIndexers(indexers cache.Indexers) error { + return nil +} + +// GetIndexer does nothing. TODO(community): Implement this. +func (f *FakeInformer) GetIndexer() cache.Indexer { + return nil +} + +// Informer returns the fake Informer. +func (f *FakeInformer) Informer() cache.SharedIndexInformer { + return f +} + +// HasSynced implements the Informer interface. Returns f.Synced +func (f *FakeInformer) HasSynced() bool { + return f.Synced +} + +// AddEventHandler implements the Informer interface. Adds an EventHandler to the fake Informers. +func (f *FakeInformer) AddEventHandler(handler cache.ResourceEventHandler) { + f.handlers = append(f.handlers, handler) +} + +// Run implements the Informer interface. Increments f.RunCount +func (f *FakeInformer) Run(<-chan struct{}) { + f.RunCount++ +} + +// Add fakes an Add event for obj +func (f *FakeInformer) Add(obj metav1.Object) { + for _, h := range f.handlers { + h.OnAdd(obj) + } +} + +// Update fakes an Update event for obj +func (f *FakeInformer) Update(oldObj, newObj metav1.Object) { + for _, h := range f.handlers { + h.OnUpdate(oldObj, newObj) + } +} + +// Delete fakes an Delete event for obj +func (f *FakeInformer) Delete(obj metav1.Object) { + for _, h := range f.handlers { + h.OnDelete(obj) + } +} + +// AddEventHandlerWithResyncPeriod does nothing. TODO(community): Implement this. +func (f *FakeInformer) AddEventHandlerWithResyncPeriod(handler cache.ResourceEventHandler, resyncPeriod time.Duration) { + +} + +// GetStore does nothing. TODO(community): Implement this. +func (f *FakeInformer) GetStore() cache.Store { + return nil +} + +// GetController does nothing. TODO(community): Implement this. +func (f *FakeInformer) GetController() cache.Controller { + return nil +} + +// LastSyncResourceVersion does nothing. TODO(community): Implement this. +func (f *FakeInformer) LastSyncResourceVersion() string { + return "" +} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go b/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go new file mode 100644 index 000000000..8513846e2 --- /dev/null +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/internal/objectutil/filter.go @@ -0,0 +1,42 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package objectutil + +import ( + apimeta "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" +) + +// FilterWithLabels returns a copy of the items in objs matching labelSel +func FilterWithLabels(objs []runtime.Object, labelSel labels.Selector) ([]runtime.Object, error) { + outItems := make([]runtime.Object, 0, len(objs)) + for _, obj := range objs { + meta, err := apimeta.Accessor(obj) + if err != nil { + return nil, err + } + if labelSel != nil { + lbls := labels.Set(meta.GetLabels()) + if !labelSel.Matches(lbls) { + continue + } + } + outItems = append(outItems, obj.DeepCopyObject()) + } + return outItems, nil +} From d4a8f9bf8898b5c871449c5bec85f0947f1dbebc Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Tue, 23 Feb 2021 12:00:01 +0800 Subject: [PATCH 2/7] resolve conversation Signed-off-by: wanjunlei --- .../notification/v2/dingtalkconfig_types.go | 1 + .../notification/v2/dingtalkreceiver_types.go | 1 + pkg/apis/notification/v2/emailconfig_types.go | 1 + .../notification/v2/emailreceiver_types.go | 1 + .../v2/notificationmanager_types.go | 1 + pkg/apis/notification/v2/slackconfig_types.go | 1 + .../notification/v2/slackreceiver_types.go | 1 + .../notification/v2/webhookconfig_types.go | 1 + .../notification/v2/webhookreceiver_types.go | 1 + .../notification/v2/wechatconfig_types.go | 1 + .../notification/v2/wechatreceiver_types.go | 1 + pkg/constants/constants.go | 6 ++-- .../notification/notification_controller.go | 10 +++--- .../notification_controller_test.go | 14 ++++---- pkg/kapis/notification/v2/register.go | 33 ++++++++++--------- pkg/models/notification/notification.go | 31 ++++++++--------- pkg/models/notification/notification_test.go | 8 ++--- 17 files changed, 61 insertions(+), 52 deletions(-) diff --git a/pkg/apis/notification/v2/dingtalkconfig_types.go b/pkg/apis/notification/v2/dingtalkconfig_types.go index cd630c158..615468b54 100644 --- a/pkg/apis/notification/v2/dingtalkconfig_types.go +++ b/pkg/apis/notification/v2/dingtalkconfig_types.go @@ -40,6 +40,7 @@ type DingTalkConfigStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=dc +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // DingTalkConfig is the Schema for the dingtalkconfigs API diff --git a/pkg/apis/notification/v2/dingtalkreceiver_types.go b/pkg/apis/notification/v2/dingtalkreceiver_types.go index 9bc52095d..9e2696ccb 100644 --- a/pkg/apis/notification/v2/dingtalkreceiver_types.go +++ b/pkg/apis/notification/v2/dingtalkreceiver_types.go @@ -55,6 +55,7 @@ type DingTalkReceiverStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=dr +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // DingTalkReceiver is the Schema for the dingtalkreceivers API diff --git a/pkg/apis/notification/v2/emailconfig_types.go b/pkg/apis/notification/v2/emailconfig_types.go index b4035f8ad..fba4529f9 100644 --- a/pkg/apis/notification/v2/emailconfig_types.go +++ b/pkg/apis/notification/v2/emailconfig_types.go @@ -52,6 +52,7 @@ type EmailConfigStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=ec +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // EmailConfig is the Schema for the emailconfigs API diff --git a/pkg/apis/notification/v2/emailreceiver_types.go b/pkg/apis/notification/v2/emailreceiver_types.go index 497aac34c..9bf31ac5b 100644 --- a/pkg/apis/notification/v2/emailreceiver_types.go +++ b/pkg/apis/notification/v2/emailreceiver_types.go @@ -36,6 +36,7 @@ type EmailReceiverStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=er +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // EmailReceiver is the Schema for the emailreceivers API diff --git a/pkg/apis/notification/v2/notificationmanager_types.go b/pkg/apis/notification/v2/notificationmanager_types.go index 4deb6a736..5af543fc6 100644 --- a/pkg/apis/notification/v2/notificationmanager_types.go +++ b/pkg/apis/notification/v2/notificationmanager_types.go @@ -186,6 +186,7 @@ type NotificationManagerStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=nm +// +kubebuilder:subresource:status // NotificationManager is the Schema for the notificationmanagers API type NotificationManager struct { diff --git a/pkg/apis/notification/v2/slackconfig_types.go b/pkg/apis/notification/v2/slackconfig_types.go index 05e7f670a..eb1b75619 100644 --- a/pkg/apis/notification/v2/slackconfig_types.go +++ b/pkg/apis/notification/v2/slackconfig_types.go @@ -32,6 +32,7 @@ type SlackConfigStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=sc +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // SlackConfig is the Schema for the slackconfigs API diff --git a/pkg/apis/notification/v2/slackreceiver_types.go b/pkg/apis/notification/v2/slackreceiver_types.go index 61a5f3e68..bbe78d73f 100644 --- a/pkg/apis/notification/v2/slackreceiver_types.go +++ b/pkg/apis/notification/v2/slackreceiver_types.go @@ -36,6 +36,7 @@ type SlackReceiverStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=sr +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // SlackReceiver is the Schema for the slackreceivers API diff --git a/pkg/apis/notification/v2/webhookconfig_types.go b/pkg/apis/notification/v2/webhookconfig_types.go index 0670cdcf8..d79f519da 100644 --- a/pkg/apis/notification/v2/webhookconfig_types.go +++ b/pkg/apis/notification/v2/webhookconfig_types.go @@ -30,6 +30,7 @@ type WebhookConfigStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=wc +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // WebhookConfig is the Schema for the webhookconfigs API diff --git a/pkg/apis/notification/v2/webhookreceiver_types.go b/pkg/apis/notification/v2/webhookreceiver_types.go index 12f6eb206..19e27b423 100644 --- a/pkg/apis/notification/v2/webhookreceiver_types.go +++ b/pkg/apis/notification/v2/webhookreceiver_types.go @@ -134,6 +134,7 @@ type WebhookReceiverStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=wr +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // WebhookReceiver is the Schema for the webhookreceivers API diff --git a/pkg/apis/notification/v2/wechatconfig_types.go b/pkg/apis/notification/v2/wechatconfig_types.go index 5a6eb6f1f..60bb31ce8 100644 --- a/pkg/apis/notification/v2/wechatconfig_types.go +++ b/pkg/apis/notification/v2/wechatconfig_types.go @@ -38,6 +38,7 @@ type WechatConfigStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=wcc +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // WechatConfig is the Schema for the wechatconfigs API diff --git a/pkg/apis/notification/v2/wechatreceiver_types.go b/pkg/apis/notification/v2/wechatreceiver_types.go index 99198460e..916c0b912 100644 --- a/pkg/apis/notification/v2/wechatreceiver_types.go +++ b/pkg/apis/notification/v2/wechatreceiver_types.go @@ -38,6 +38,7 @@ type WechatReceiverStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:scope=Cluster,shortName=wcr +// +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced // WechatReceiver is the Schema for the wechatreceivers API diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 70affdf96..900093628 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -126,9 +126,9 @@ const ( ApplicationVersion = "app.kubernetes.io/version" AlertingTag = "Alerting" - NotificationTag = "Notification" - KubeSphereNotificationNamespace = "kubesphere-notification-system" - NotificationManagedLabel = "notification-manager/managed" + NotificationTag = "Notification" + NotificationSecretNamespace = "kubesphere-monitoring-federated" + NotificationManagedLabel = "notification-manager/managed" ) var ( diff --git a/pkg/controller/notification/notification_controller.go b/pkg/controller/notification/notification_controller.go index 34d6e5ad3..403189ca6 100644 --- a/pkg/controller/notification/notification_controller.go +++ b/pkg/controller/notification/notification_controller.go @@ -222,7 +222,7 @@ func (c *Controller) reconcile(obj interface{}) error { // Only reconcile the secret which created by notification manager. if secret, ok := obj.(*corev1.Secret); ok { - if secret.Namespace != constants.KubeSphereNotificationNamespace || secret.Labels[constants.NotificationManagedLabel] != "true" { + if secret.Namespace != constants.NotificationSecretNamespace || secret.Labels[constants.NotificationManagedLabel] != "true" { klog.V(8).Infof("No need to reconcile secret %s/%s", accessor.GetNamespace(), accessor.GetName()) return nil } @@ -919,12 +919,12 @@ func (c *Controller) syncFederatedSecret(obj *corev1.Secret) error { func (c *Controller) ensureNotificationNamespaceExist() error { ns := corev1.Namespace{} - if err := c.Get(context.Background(), client.ObjectKey{Name: constants.KubeSphereNotificationNamespace}, &ns); err != nil { + if err := c.Get(context.Background(), client.ObjectKey{Name: constants.NotificationSecretNamespace}, &ns); err != nil { return err } fedNs := v1beta1.FederatedNamespace{} - if err := c.Get(context.Background(), client.ObjectKey{Name: constants.KubeSphereNotificationNamespace, Namespace: constants.KubeSphereNotificationNamespace}, &fedNs); err != nil { + if err := c.Get(context.Background(), client.ObjectKey{Name: constants.NotificationSecretNamespace, Namespace: constants.NotificationSecretNamespace}, &fedNs); err != nil { if errors.IsAlreadyExists(err) { return nil } @@ -936,8 +936,8 @@ func (c *Controller) ensureNotificationNamespaceExist() error { APIVersion: v1beta1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ - Name: constants.KubeSphereNotificationNamespace, - Namespace: constants.KubeSphereNotificationNamespace, + Name: constants.NotificationSecretNamespace, + Namespace: constants.NotificationSecretNamespace, }, Spec: v1beta1.FederatedNamespaceSpec{ Placement: v1beta1.GenericPlacementFields{ diff --git a/pkg/controller/notification/notification_controller_test.go b/pkg/controller/notification/notification_controller_test.go index ef2f0fd23..64b4e3882 100644 --- a/pkg/controller/notification/notification_controller_test.go +++ b/pkg/controller/notification/notification_controller_test.go @@ -39,14 +39,14 @@ var ( namespace := &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ - Name: constants.KubeSphereNotificationNamespace, + Name: constants.NotificationSecretNamespace, }, } secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", - Namespace: constants.KubeSphereNotificationNamespace, + Namespace: constants.NotificationSecretNamespace, Labels: map[string]string{constants.NotificationManagedLabel: "true"}, }, } @@ -101,12 +101,12 @@ var ( fedSecret := &v1beta1.FederatedSecret{} By("Expecting to create federated secret successfully") Eventually(func() bool { - err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.KubeSphereNotificationNamespace}, fedSecret) + err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.NotificationSecretNamespace}, fedSecret) Expect(err).Should(Succeed()) return !fedSecret.CreationTimestamp.IsZero() }, timeout, interval).Should(BeTrue()) - err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.KubeSphereNotificationNamespace}, secret) + err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.NotificationSecretNamespace}, secret) Expect(err).Should(Succeed()) secret.StringData = map[string]string{"foo": "bar"} Expect(cl.Update(context.Background(), secret)).Should(Succeed()) @@ -114,7 +114,7 @@ var ( By("Expecting to update federated secret successfully") Eventually(func() bool { - err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.KubeSphereNotificationNamespace}, fedSecret) + err := ksCache.Get(context.Background(), client.ObjectKey{Name: secret.Name, Namespace: constants.NotificationSecretNamespace}, fedSecret) Expect(err).Should(Succeed()) return string(fedSecret.Spec.Template.Data["foo"]) == "bar" }, timeout, interval).Should(BeTrue()) @@ -130,9 +130,9 @@ var ( obj := &v2.DingTalkConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", - Namespace: constants.KubeSphereNotificationNamespace, + Namespace: constants.NotificationSecretNamespace, Labels: map[string]string{ - "tyep": "default", + "type": "default", }, }, } diff --git a/pkg/kapis/notification/v2/register.go b/pkg/kapis/notification/v2/register.go index abd62d142..07ddf65ee 100644 --- a/pkg/kapis/notification/v2/register.go +++ b/pkg/kapis/notification/v2/register.go @@ -55,8 +55,8 @@ func AddToContainer( To(h.ListSecret). Doc("list the secrets"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.QueryParameter(query.ParameterName, "name used to do filtering").Required(false)). - Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used to do filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). @@ -93,11 +93,11 @@ func AddToContainer( // apis for global notification config and receiver ws.Route(ws.GET("/{resources}"). To(h.ListResource). - Doc("list the notification config or receiver"). + Doc("list the notification configs or receivers"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). - Param(ws.QueryParameter(query.ParameterName, "name used to do filtering").Required(false)). - Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used to do filtering").Required(false)). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). @@ -108,7 +108,7 @@ func AddToContainer( To(h.GetResource). Doc("get the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -116,14 +116,14 @@ func AddToContainer( To(h.CreateResource). Doc("create a notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resource", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resource", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.PUT("/{resources}/{name}"). To(h.UpdateResource). Doc("update the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -131,18 +131,19 @@ func AddToContainer( To(h.DeleteResource). Doc("delete the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, errors.None)) // apis for tenant notification config and receiver ws.Route(ws.GET("/users/{user}/{resources}"). To(h.ListResource). - Doc("list the notification config or receiver"). + Doc("list the notification configs or receivers"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.QueryParameter(query.ParameterName, "name used to do filtering").Required(false)). - Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used to do filtering").Required(false)). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). + Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). @@ -154,7 +155,7 @@ func AddToContainer( Doc("get the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -170,7 +171,7 @@ func AddToContainer( Doc("update the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -179,7 +180,7 @@ func AddToContainer( Doc("delete the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification config or receiver, known values are dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification config or receiver, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, errors.None)) diff --git a/pkg/models/notification/notification.go b/pkg/models/notification/notification.go index c8969773a..885d40968 100644 --- a/pkg/models/notification/notification.go +++ b/pkg/models/notification/notification.go @@ -55,9 +55,8 @@ func NewOperator( } } -// List objects, if the user is nil, it will return the global object. -// If the user it not nil, it will return tenant object which the tenant specified in the labels of object -// equal to this user. +// List objects. Only global objects will be returned if the user is nil. +// If the user is not nil, only tenant objects whose tenant label matches the user will be returned. func (o *operator) List(user, resource string, q *query.Query) (*api.ListResult, error) { // If user is nil, it will list all global object. @@ -86,8 +85,8 @@ func (o *operator) Get(user, resource, name string) (runtime.Object, error) { return obj, nil } -// Create a object, if the user is nil, it only can create a global object. -// If the user is not nil, it only can create a tenant object. +// Create an object. A global object will be created if the user is nil. +// A tenant object will be created if the user is not nil. func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Object, error) { if err := authorizer(user, obj); err != nil { @@ -120,9 +119,8 @@ func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Ob } } -// Delete a object, if the user is nil, it only can delete the global object. -// If the user is not nil, it only can delete the tenant object which the tenant -// specified in the labels of the object equal to this user. +// Delete an object. A global object will be deleted if the user is nil. +// If the user is not nil, a tenant object whose tenant label matches the user will be deleted. func (o *operator) Delete(user, resource, name string) error { if obj, err := o.Get(user, resource, name); err != nil { @@ -159,9 +157,8 @@ func (o *operator) Delete(user, resource, name string) error { } } -// Update a object, if the user is nil, it only can update the global object. -// If the user is not nil, it only can delete the tenant object which the tenant -// specified in the labels of the object equal to this user. +// Update an object, only a global object will be updated if the user is nil. +// If the user is not nil, a tenant object whose tenant label matches the user will be updated. func (o *operator) Update(user, resource string, obj runtime.Object) (runtime.Object, error) { name, err := getName(obj) @@ -206,11 +203,11 @@ func (o *operator) Update(user, resource string, obj runtime.Object) (runtime.Ob func (o *operator) ListSecret(q *query.Query) (*api.ListResult, error) { appendManagedLabel(q) - return o.resourceGetter.List("secrets", constants.KubeSphereNotificationNamespace, q) + return o.resourceGetter.List("secrets", constants.NotificationSecretNamespace, q) } func (o *operator) GetSecret(name string) (interface{}, error) { - obj, err := o.resourceGetter.Get("secrets", constants.KubeSphereNotificationNamespace, name) + obj, err := o.resourceGetter.Get("secrets", constants.NotificationSecretNamespace, name) if err != nil { return nil, err } @@ -225,15 +222,15 @@ func (o *operator) GetSecret(name string) (interface{}, error) { func (o *operator) CreateOrUpdateSecret(obj *corev1.Secret) (*corev1.Secret, error) { - obj.Namespace = constants.KubeSphereNotificationNamespace + obj.Namespace = constants.NotificationSecretNamespace if obj.Labels == nil { obj.Labels = make(map[string]string) } obj.Labels[constants.NotificationManagedLabel] = "true" if obj.ResourceVersion == "" { - return o.k8sClient.CoreV1().Secrets(constants.KubeSphereNotificationNamespace).Create(context.Background(), obj, v1.CreateOptions{}) + return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Create(context.Background(), obj, v1.CreateOptions{}) } else { - return o.k8sClient.CoreV1().Secrets(constants.KubeSphereNotificationNamespace).Update(context.Background(), obj, v1.UpdateOptions{}) + return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Update(context.Background(), obj, v1.UpdateOptions{}) } } @@ -243,7 +240,7 @@ func (o *operator) DeleteSecret(name string) error { return err } - return o.k8sClient.CoreV1().Secrets(constants.KubeSphereNotificationNamespace).Delete(context.Background(), name, v1.DeleteOptions{}) + return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Delete(context.Background(), name, v1.DeleteOptions{}) } func (o *operator) GetObject(resource string) runtime.Object { diff --git a/pkg/models/notification/notification_test.go b/pkg/models/notification/notification_test.go index 6a97dc5d5..9ebfb2008 100644 --- a/pkg/models/notification/notification_test.go +++ b/pkg/models/notification/notification_test.go @@ -109,7 +109,7 @@ func TestOperator_CreateOrUpdateSecret(t *testing.T) { result: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "test", - Namespace: constants.KubeSphereNotificationNamespace, + Namespace: constants.NotificationSecretNamespace, Labels: map[string]string{constants.NotificationManagedLabel: "true"}, }, }, @@ -168,7 +168,7 @@ var ( secret1 = &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "foo1", - Namespace: constants.KubeSphereNotificationNamespace, + Namespace: constants.NotificationSecretNamespace, Labels: map[string]string{constants.NotificationManagedLabel: "true"}, }, } @@ -176,7 +176,7 @@ var ( secret2 = &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "foo2", - Namespace: constants.KubeSphereNotificationNamespace, + Namespace: constants.NotificationSecretNamespace, Labels: map[string]string{constants.NotificationManagedLabel: "true"}, }, } @@ -184,7 +184,7 @@ var ( secret3 = &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "foo3", - Namespace: constants.KubeSphereNotificationNamespace, + Namespace: constants.NotificationSecretNamespace, Labels: map[string]string{constants.NotificationManagedLabel: "true"}, }, } From 5e39b7c75241605c89619bbf225db449b9dc250c Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Wed, 24 Feb 2021 11:14:44 +0800 Subject: [PATCH 3/7] add tenant-level apis for notification secret Signed-off-by: wanjunlei --- pkg/constants/constants.go | 1 - .../notification/notification_controller.go | 2 +- .../notification_controller_test.go | 1 - pkg/kapis/notification/v2/handler.go | 34 +--- pkg/kapis/notification/v2/register.go | 61 ++----- pkg/models/notification/notification.go | 156 ++++++------------ pkg/models/notification/notification_test.go | 35 ++-- 7 files changed, 90 insertions(+), 200 deletions(-) diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 900093628..456782591 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -128,7 +128,6 @@ const ( NotificationTag = "Notification" NotificationSecretNamespace = "kubesphere-monitoring-federated" - NotificationManagedLabel = "notification-manager/managed" ) var ( diff --git a/pkg/controller/notification/notification_controller.go b/pkg/controller/notification/notification_controller.go index 403189ca6..fee776747 100644 --- a/pkg/controller/notification/notification_controller.go +++ b/pkg/controller/notification/notification_controller.go @@ -222,7 +222,7 @@ func (c *Controller) reconcile(obj interface{}) error { // Only reconcile the secret which created by notification manager. if secret, ok := obj.(*corev1.Secret); ok { - if secret.Namespace != constants.NotificationSecretNamespace || secret.Labels[constants.NotificationManagedLabel] != "true" { + if secret.Namespace != constants.NotificationSecretNamespace { klog.V(8).Infof("No need to reconcile secret %s/%s", accessor.GetNamespace(), accessor.GetName()) return nil } diff --git a/pkg/controller/notification/notification_controller_test.go b/pkg/controller/notification/notification_controller_test.go index 64b4e3882..1dcb06331 100644 --- a/pkg/controller/notification/notification_controller_test.go +++ b/pkg/controller/notification/notification_controller_test.go @@ -47,7 +47,6 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "foo", Namespace: constants.NotificationSecretNamespace, - Labels: map[string]string{constants.NotificationManagedLabel: "true"}, }, } diff --git a/pkg/kapis/notification/v2/handler.go b/pkg/kapis/notification/v2/handler.go index 5f99c90cb..b35c015ac 100644 --- a/pkg/kapis/notification/v2/handler.go +++ b/pkg/kapis/notification/v2/handler.go @@ -18,7 +18,6 @@ package v2 import ( "github.com/emicklei/go-restful" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/kubernetes" "k8s.io/klog" @@ -44,36 +43,6 @@ func newNotificationHandler( } } -func (h *handler) ListSecret(req *restful.Request, resp *restful.Response) { - q := query.ParseQueryParameter(req) - objs, err := h.operator.ListSecret(q) - handleResponse(req, resp, objs, err) -} - -func (h *handler) GetSecret(req *restful.Request, resp *restful.Response) { - - obj, err := h.operator.GetSecret(req.PathParameter("secret")) - handleResponse(req, resp, obj, err) -} - -func (h *handler) CreateOrUpdateSecret(req *restful.Request, resp *restful.Response) { - - var obj corev1.Secret - err := req.ReadEntity(&obj) - if err != nil { - api.HandleBadRequest(resp, req, err) - return - } - - created, err := h.operator.CreateOrUpdateSecret(&obj) - handleResponse(req, resp, created, err) -} - -func (h *handler) DeleteSecret(req *restful.Request, resp *restful.Response) { - err := h.operator.DeleteSecret(req.PathParameter("secret")) - handleResponse(req, resp, servererr.None, err) -} - func (h *handler) ListResource(req *restful.Request, resp *restful.Response) { user := req.PathParameter("user") @@ -128,6 +97,7 @@ func (h *handler) UpdateResource(req *restful.Request, resp *restful.Response) { user := req.PathParameter("user") resource := req.PathParameter("resources") + name := req.PathParameter("name") if !h.operator.IsKnownResource(resource) { api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) @@ -140,7 +110,7 @@ func (h *handler) UpdateResource(req *restful.Request, resp *restful.Response) { return } - updated, err := h.operator.Update(user, resource, obj) + updated, err := h.operator.Update(user, resource, name, obj) handleResponse(req, resp, updated, err) } diff --git a/pkg/kapis/notification/v2/register.go b/pkg/kapis/notification/v2/register.go index 07ddf65ee..2a50812f2 100644 --- a/pkg/kapis/notification/v2/register.go +++ b/pkg/kapis/notification/v2/register.go @@ -21,7 +21,6 @@ package v2 import ( "github.com/emicklei/go-restful" openapi "github.com/emicklei/go-restful-openapi" - v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/kubernetes" "kubesphere.io/kubesphere/pkg/api" @@ -50,52 +49,12 @@ func AddToContainer( ws := runtime.NewWebService(GroupVersion) h := newNotificationHandler(informers, k8sClient, ksClient) - // apis for secrets - ws.Route(ws.GET("/secrets"). - To(h.ListSecret). - Doc("list the secrets"). - Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). - Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). - Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). - Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). - Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). - Param(ws.QueryParameter(query.ParameterOrderBy, "sort parameters, e.g. orderBy=createTime")). - Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}})) - - ws.Route(ws.GET("/secrets/{secret}"). - To(h.GetSecret). - Doc("get the secret"). - Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("secret", "secret name")). - Returns(http.StatusOK, api.StatusOK, []v1.Secret{})) - - ws.Route(ws.POST("/secrets"). - To(h.CreateOrUpdateSecret). - Doc("create a secret"). - Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Returns(http.StatusOK, api.StatusOK, []v1.Secret{})) - - ws.Route(ws.PUT("/secrets/{secret}"). - To(h.CreateOrUpdateSecret). - Doc("update the secret"). - Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("secret", "secret name")). - Returns(http.StatusOK, api.StatusOK, []v1.Secret{})) - - ws.Route(ws.DELETE("/secrets/{secret}"). - To(h.DeleteSecret). - Doc("delete the secret"). - Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("secret", "secret name")). - Returns(http.StatusOK, api.StatusOK, errors.None)) - - // apis for global notification config and receiver + // apis for global notification config, receiver, and secret ws.Route(ws.GET("/{resources}"). To(h.ListResource). Doc("list the notification configs or receivers"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). @@ -108,7 +67,7 @@ func AddToContainer( To(h.GetResource). Doc("get the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -116,14 +75,14 @@ func AddToContainer( To(h.CreateResource). Doc("create a notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resource", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resource", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.PUT("/{resources}/{name}"). To(h.UpdateResource). Doc("update the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -131,7 +90,7 @@ func AddToContainer( To(h.DeleteResource). Doc("delete the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, errors.None)) @@ -141,7 +100,7 @@ func AddToContainer( Doc("list the notification configs or receivers"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). @@ -155,7 +114,7 @@ func AddToContainer( Doc("get the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -171,7 +130,7 @@ func AddToContainer( Doc("update the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) @@ -180,7 +139,7 @@ func AddToContainer( Doc("delete the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification config or receiver, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers")). + Param(ws.PathParameter("resources", "notification config or receiver, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). Param(ws.PathParameter("name", "the name of the resource")). Returns(http.StatusOK, api.StatusOK, errors.None)) diff --git a/pkg/models/notification/notification.go b/pkg/models/notification/notification.go index 885d40968..42ed9bdda 100644 --- a/pkg/models/notification/notification.go +++ b/pkg/models/notification/notification.go @@ -24,12 +24,7 @@ type Operator interface { Get(user, resource, name string) (runtime.Object, error) Create(user, resource string, obj runtime.Object) (runtime.Object, error) Delete(user, resource, name string) error - Update(user, resource string, obj runtime.Object) (runtime.Object, error) - - ListSecret(query *query.Query) (*api.ListResult, error) - GetSecret(name string) (interface{}, error) - CreateOrUpdateSecret(obj *corev1.Secret) (*corev1.Secret, error) - DeleteSecret(name string) error + Update(user, resource, name string, obj runtime.Object) (runtime.Object, error) GetObject(resource string) runtime.Object IsKnownResource(resource string) bool @@ -59,21 +54,32 @@ func NewOperator( // If the user is not nil, only tenant objects whose tenant label matches the user will be returned. func (o *operator) List(user, resource string, q *query.Query) (*api.ListResult, error) { - // If user is nil, it will list all global object. - if user == "" { - appendGlobalLabel(resource, q) - } else { - // If the user is not nil, only return the object belong to this user. - appendTenantLabel(user, q) + if len(q.LabelSelector) > 0 { + q.LabelSelector = q.LabelSelector + "," } - return o.resourceGetter.List(resource, "", q) + filter := "" + // If user is nil, it will list all global object. + if user == "" { + if isConfig(o.GetObject(resource)) { + filter = "type=default" + } else { + filter = "type=global" + } + } else { + // If the user is not nil, only return the object belong to this user. + filter = "type=tenant,user=" + user + } + + q.LabelSelector = q.LabelSelector + filter + + return o.resourceGetter.List(resource, constants.NotificationSecretNamespace, q) } // Get the specified object, if you want to get a global object, the user must be nil. // If you want to get a tenant object, the user must equal to the tenant specified in labels of the object. func (o *operator) Get(user, resource, name string) (runtime.Object, error) { - obj, err := o.resourceGetter.Get(resource, "", name) + obj, err := o.resourceGetter.Get(resource, constants.NotificationSecretNamespace, name) if err != nil { return nil, err } @@ -89,7 +95,7 @@ func (o *operator) Get(user, resource, name string) (runtime.Object, error) { // A tenant object will be created if the user is not nil. func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Object, error) { - if err := authorizer(user, obj); err != nil { + if err := appendLabel(user, obj); err != nil { return nil, err } @@ -114,6 +120,8 @@ func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Ob return o.ksClient.NotificationV2().WechatConfigs().Create(context.Background(), obj.(*v2.WechatConfig), v1.CreateOptions{}) case v2.ResourcesPluralWechatReceiver: return o.ksClient.NotificationV2().WechatReceivers().Create(context.Background(), obj.(*v2.WechatReceiver), v1.CreateOptions{}) + case "secrets": + return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Create(context.Background(), obj.(*corev1.Secret), v1.CreateOptions{}) default: return nil, errors.NewInternalError(nil) } @@ -152,6 +160,8 @@ func (o *operator) Delete(user, resource, name string) error { return o.ksClient.NotificationV2().WechatConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) case v2.ResourcesPluralWechatReceiver: return o.ksClient.NotificationV2().WechatReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case "secrets": + return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Delete(context.Background(), name, v1.DeleteOptions{}) default: return errors.NewInternalError(nil) } @@ -159,17 +169,16 @@ func (o *operator) Delete(user, resource, name string) error { // Update an object, only a global object will be updated if the user is nil. // If the user is not nil, a tenant object whose tenant label matches the user will be updated. -func (o *operator) Update(user, resource string, obj runtime.Object) (runtime.Object, error) { +func (o *operator) Update(user, resource, name string, obj runtime.Object) (runtime.Object, error) { - name, err := getName(obj) - if err != nil { + if err := appendLabel(user, obj); err != nil { return nil, err } - if _, err := o.Get(user, resource, name); err != nil { + if old, err := o.Get(user, resource, name); err != nil { return nil, err } else { - if err := authorizer(user, obj); err != nil { + if err := authorizer(user, old); err != nil { return nil, err } } @@ -195,54 +204,13 @@ func (o *operator) Update(user, resource string, obj runtime.Object) (runtime.Ob return o.ksClient.NotificationV2().WechatConfigs().Update(context.Background(), obj.(*v2.WechatConfig), v1.UpdateOptions{}) case v2.ResourcesPluralWechatReceiver: return o.ksClient.NotificationV2().WechatReceivers().Update(context.Background(), obj.(*v2.WechatReceiver), v1.UpdateOptions{}) + case "secrets": + return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Update(context.Background(), obj.(*corev1.Secret), v1.UpdateOptions{}) default: return nil, errors.NewInternalError(nil) } } -func (o *operator) ListSecret(q *query.Query) (*api.ListResult, error) { - - appendManagedLabel(q) - return o.resourceGetter.List("secrets", constants.NotificationSecretNamespace, q) -} - -func (o *operator) GetSecret(name string) (interface{}, error) { - obj, err := o.resourceGetter.Get("secrets", constants.NotificationSecretNamespace, name) - if err != nil { - return nil, err - } - - if !isManagedByNotification(obj.(*corev1.Secret)) { - return nil, errors.NewForbidden(v2.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", - fmt.Errorf("secret '%s' is not managed by notification", name)) - } - - return obj, nil -} - -func (o *operator) CreateOrUpdateSecret(obj *corev1.Secret) (*corev1.Secret, error) { - - obj.Namespace = constants.NotificationSecretNamespace - if obj.Labels == nil { - obj.Labels = make(map[string]string) - } - obj.Labels[constants.NotificationManagedLabel] = "true" - if obj.ResourceVersion == "" { - return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Create(context.Background(), obj, v1.CreateOptions{}) - } else { - return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Update(context.Background(), obj, v1.UpdateOptions{}) - } -} - -func (o *operator) DeleteSecret(name string) error { - - if _, err := o.GetSecret(name); err != nil { - return err - } - - return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Delete(context.Background(), name, v1.DeleteOptions{}) -} - func (o *operator) GetObject(resource string) runtime.Object { switch resource { @@ -266,6 +234,8 @@ func (o *operator) GetObject(resource string) runtime.Object { return &v2.WechatConfig{} case v2.ResourcesPluralWechatReceiver: return &v2.WechatReceiver{} + case "secrets": + return &corev1.Secret{} default: return nil } @@ -333,48 +303,30 @@ func isGlobal(obj runtime.Object) bool { } } -func appendTenantLabel(user string, q *query.Query) { - - if len(q.LabelSelector) > 0 { - q.LabelSelector = q.LabelSelector + "," - } - q.LabelSelector = q.LabelSelector + "type=tenant,user=" + user -} - -func appendGlobalLabel(resource string, q *query.Query) { - - if len(q.LabelSelector) > 0 { - q.LabelSelector = q.LabelSelector + "," - } - - switch resource { - case v2.ResourcesPluralDingTalkConfig, v2.ResourcesPluralEmailConfig, - v2.ResourcesPluralSlackConfig, v2.ResourcesPluralWebhookConfig, v2.ResourcesPluralWechatConfig: - q.LabelSelector = q.LabelSelector + "type=default" - case v2.ResourcesPluralDingTalkReceiver, v2.ResourcesPluralEmailReceiver, - v2.ResourcesPluralSlackReceiver, v2.ResourcesPluralWebhookReceiver, v2.ResourcesPluralWechatReceiver: - q.LabelSelector = q.LabelSelector + "type=global" - } -} - -func appendManagedLabel(q *query.Query) { - - if len(q.LabelSelector) > 0 { - q.LabelSelector = q.LabelSelector + "," - } - q.LabelSelector = q.LabelSelector + constants.NotificationManagedLabel + "=" + "true" -} - -func isManagedByNotification(secret *corev1.Secret) bool { - return secret.Labels[constants.NotificationManagedLabel] == "true" -} - -func getName(obj runtime.Object) (string, error) { +func appendLabel(user string, obj runtime.Object) error { accessor, err := meta.Accessor(obj) if err != nil { - return "", err + klog.Errorln(err) + return err } - return accessor.GetName(), nil + labels := accessor.GetLabels() + if labels == nil { + labels = make(map[string]string) + } + + if user == "" { + if isConfig(obj) { + labels["type"] = "default" + } else { + labels["type"] = "global" + } + } else { + labels["type"] = "tenant" + labels["user"] = user + } + + accessor.SetLabels(labels) + return nil } diff --git a/pkg/models/notification/notification_test.go b/pkg/models/notification/notification_test.go index 9ebfb2008..cce007f81 100644 --- a/pkg/models/notification/notification_test.go +++ b/pkg/models/notification/notification_test.go @@ -31,7 +31,7 @@ import ( "testing" ) -func TestOperator_ListSecret(t *testing.T) { +func TestOperator_List(t *testing.T) { o := prepare() tests := []struct { result *api.ListResult @@ -46,7 +46,7 @@ func TestOperator_ListSecret(t *testing.T) { } for i, test := range tests { - result, err := o.ListSecret(&query.Query{ + result, err := o.List("", "secrets", &query.Query{ SortBy: query.FieldName, Ascending: true, }) @@ -64,7 +64,7 @@ func TestOperator_ListSecret(t *testing.T) { } } -func TestOperator_GetSecret(t *testing.T) { +func TestOperator_Get(t *testing.T) { o := prepare() tests := []struct { result *corev1.Secret @@ -83,7 +83,7 @@ func TestOperator_GetSecret(t *testing.T) { } for _, test := range tests { - result, err := o.GetSecret(test.name) + result, err := o.Get("", "secrets", test.name) if err != nil { if !reflect.DeepEqual(err, test.expectError) { @@ -98,7 +98,7 @@ func TestOperator_GetSecret(t *testing.T) { } } -func TestOperator_CreateOrUpdateSecret(t *testing.T) { +func TestOperator_Create(t *testing.T) { o := prepare() tests := []struct { result *corev1.Secret @@ -110,12 +110,17 @@ func TestOperator_CreateOrUpdateSecret(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: constants.NotificationSecretNamespace, - Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + Labels: map[string]string{ + "type": "global", + }, }, }, secret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "test", + Labels: map[string]string{ + "type": "global", + }, }, }, expectError: nil, @@ -123,7 +128,7 @@ func TestOperator_CreateOrUpdateSecret(t *testing.T) { } for i, test := range tests { - result, err := o.CreateOrUpdateSecret(test.secret) + result, err := o.Create("", "secrets", test.secret) if err != nil { if !reflect.DeepEqual(err, test.expectError) { @@ -138,7 +143,7 @@ func TestOperator_CreateOrUpdateSecret(t *testing.T) { } } -func TestOperator_DeleteSecret(t *testing.T) { +func TestOperator_Delete(t *testing.T) { o := prepare() tests := []struct { name string @@ -151,7 +156,7 @@ func TestOperator_DeleteSecret(t *testing.T) { } for i, test := range tests { - err := o.DeleteSecret(test.name) + err := o.Delete("", "secrets", test.name) if err != nil { if test.expectError != nil && test.expectError.Error() == err.Error() { continue @@ -169,7 +174,9 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "foo1", Namespace: constants.NotificationSecretNamespace, - Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + Labels: map[string]string{ + "type": "global", + }, }, } @@ -177,7 +184,9 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "foo2", Namespace: constants.NotificationSecretNamespace, - Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + Labels: map[string]string{ + "type": "global", + }, }, } @@ -185,7 +194,9 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "foo3", Namespace: constants.NotificationSecretNamespace, - Labels: map[string]string{constants.NotificationManagedLabel: "true"}, + Labels: map[string]string{ + "type": "global", + }, }, } From d79104b8a25df5ecb6cfab63228ef4599ec6ca7f Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Wed, 24 Feb 2021 18:00:06 +0800 Subject: [PATCH 4/7] change api version to v2alpha1 Signed-off-by: wanjunlei --- pkg/apiserver/apiserver.go | 4 ++-- pkg/kapis/notification/{v2 => v2alpha1}/handler.go | 4 ++-- pkg/kapis/notification/{v2 => v2alpha1}/register.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename pkg/kapis/notification/{v2 => v2alpha1}/handler.go (97%) rename pkg/kapis/notification/{v2 => v2alpha1}/register.go (99%) diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index c2f7b689f..2bf94803f 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -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" - notificationv2 "kubesphere.io/kubesphere/pkg/kapis/notification/v2" + notificationv2alpha1 "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(notificationv2.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), + urlruntime.Must(notificationv2alpha1.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), s.KubernetesClient.KubeSphere())) } diff --git a/pkg/kapis/notification/v2/handler.go b/pkg/kapis/notification/v2alpha1/handler.go similarity index 97% rename from pkg/kapis/notification/v2/handler.go rename to pkg/kapis/notification/v2alpha1/handler.go index b35c015ac..f7ca1aa1d 100644 --- a/pkg/kapis/notification/v2/handler.go +++ b/pkg/kapis/notification/v2alpha1/handler.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( "github.com/emicklei/go-restful" @@ -125,7 +125,7 @@ func (h *handler) DeleteResource(req *restful.Request, resp *restful.Response) { return } - handleResponse(req, resp, h.operator.Delete(user, resource, name), servererr.None) + handleResponse(req, resp, servererr.None, h.operator.Delete(user, resource, name)) } func handleResponse(req *restful.Request, resp *restful.Response, obj interface{}, err error) { diff --git a/pkg/kapis/notification/v2/register.go b/pkg/kapis/notification/v2alpha1/register.go similarity index 99% rename from pkg/kapis/notification/v2/register.go rename to pkg/kapis/notification/v2alpha1/register.go index 2a50812f2..f93fbdafc 100644 --- a/pkg/kapis/notification/v2/register.go +++ b/pkg/kapis/notification/v2alpha1/register.go @@ -16,7 +16,7 @@ */ -package v2 +package v2alpha1 import ( "github.com/emicklei/go-restful" @@ -38,7 +38,7 @@ const ( KeyOpenAPITags = openapi.KeyOpenAPITags ) -var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2"} +var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2alpha1"} func AddToContainer( container *restful.Container, From f4f5f8283e2c6abdc84a0365b49b00498a6f66fe Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Thu, 25 Feb 2021 14:57:17 +0800 Subject: [PATCH 5/7] change notification crd version to v2alpha1 Signed-off-by: wanjunlei --- ...ication.kubesphere.io_dingtalkconfigs.yaml | 2 +- ...ation.kubesphere.io_dingtalkreceivers.yaml | 2 +- ...tification.kubesphere.io_emailconfigs.yaml | 2 +- ...fication.kubesphere.io_emailreceivers.yaml | 2 +- ...on.kubesphere.io_notificationmanagers.yaml | 2 +- ...tification.kubesphere.io_slackconfigs.yaml | 2 +- ...fication.kubesphere.io_slackreceivers.yaml | 2 +- ...fication.kubesphere.io_webhookconfigs.yaml | 2 +- ...cation.kubesphere.io_webhookreceivers.yaml | 2 +- ...ification.kubesphere.io_wechatconfigs.yaml | 2 +- ...ication.kubesphere.io_wechatreceivers.yaml | 2 +- ...o => addtoscheme_notification_v2alpha1.go} | 4 +- .../{v2 => v2alpha1}/dingtalkconfig_types.go | 2 +- .../dingtalkreceiver_types.go | 2 +- pkg/apis/notification/{v2 => v2alpha1}/doc.go | 4 +- .../{v2 => v2alpha1}/emailconfig_types.go | 2 +- .../{v2 => v2alpha1}/emailreceiver_types.go | 2 +- .../notificationmanager_types.go | 2 +- .../notification/{v2 => v2alpha1}/register.go | 6 +- .../{v2 => v2alpha1}/slackconfig_types.go | 2 +- .../{v2 => v2alpha1}/slackreceiver_types.go | 2 +- .../notification/{v2 => v2alpha1}/types.go | 2 +- .../v2alpha1_suite_test.go} | 2 +- .../{v2 => v2alpha1}/webhookconfig_types.go | 2 +- .../{v2 => v2alpha1}/webhookreceiver_types.go | 2 +- .../{v2 => v2alpha1}/wechatconfig_types.go | 2 +- .../{v2 => v2alpha1}/wechatreceiver_types.go | 2 +- .../{v2 => v2alpha1}/zz_generated.deepcopy.go | 2 +- .../v1beta1/federateddingtalkconfig_types.go | 4 +- .../federateddingtalkreceiver_types.go | 4 +- .../v1beta1/federatedemailconfig_types.go | 4 +- .../v1beta1/federatedemailreceiver_types.go | 4 +- .../v1beta1/federatedslackconfig_types.go | 4 +- .../v1beta1/federatedslackreceiver_types.go | 4 +- .../v1beta1/federatedwebhookconfig_types.go | 4 +- .../v1beta1/federatedwebhookreceiver_types.go | 4 +- .../v1beta1/federatedwechatconfig_types.go | 4 +- .../v1beta1/federatedwechatreceiver_types.go | 4 +- pkg/apiserver/apiserver.go | 42 ++--- pkg/client/clientset/versioned/clientset.go | 18 +- .../versioned/fake/clientset_generated.go | 11 +- .../clientset/versioned/fake/register.go | 8 + .../clientset/versioned/scheme/register.go | 8 + .../{v2 => v2alpha1}/dingtalkconfig.go | 42 ++--- .../{v2 => v2alpha1}/dingtalkreceiver.go | 42 ++--- .../notification/{v2 => v2alpha1}/doc.go | 2 +- .../{v2 => v2alpha1}/emailconfig.go | 42 ++--- .../{v2 => v2alpha1}/emailreceiver.go | 42 ++--- .../notification/{v2 => v2alpha1}/fake/doc.go | 0 .../fake/fake_dingtalkconfig.go | 50 +++--- .../fake/fake_dingtalkreceiver.go | 50 +++--- .../{v2 => v2alpha1}/fake/fake_emailconfig.go | 50 +++--- .../fake/fake_emailreceiver.go | 50 +++--- .../fake/fake_notification_client.go | 26 +-- .../{v2 => v2alpha1}/fake/fake_slackconfig.go | 50 +++--- .../fake/fake_slackreceiver.go | 50 +++--- .../fake/fake_webhookconfig.go | 50 +++--- .../fake/fake_webhookreceiver.go | 50 +++--- .../fake/fake_wechatconfig.go | 50 +++--- .../fake/fake_wechatreceiver.go | 50 +++--- .../{v2 => v2alpha1}/generated_expansion.go | 2 +- .../{v2 => v2alpha1}/notification_client.go | 50 +++--- .../{v2 => v2alpha1}/slackconfig.go | 42 ++--- .../{v2 => v2alpha1}/slackreceiver.go | 42 ++--- .../{v2 => v2alpha1}/webhookconfig.go | 42 ++--- .../{v2 => v2alpha1}/webhookreceiver.go | 42 ++--- .../{v2 => v2alpha1}/wechatconfig.go | 42 ++--- .../{v2 => v2alpha1}/wechatreceiver.go | 42 ++--- .../informers/externalversions/generic.go | 46 ++--- .../notification/interface.go | 12 +- .../{v2 => v2alpha1}/dingtalkconfig.go | 20 +-- .../{v2 => v2alpha1}/dingtalkreceiver.go | 20 +-- .../{v2 => v2alpha1}/emailconfig.go | 20 +-- .../{v2 => v2alpha1}/emailreceiver.go | 20 +-- .../{v2 => v2alpha1}/interface.go | 2 +- .../{v2 => v2alpha1}/slackconfig.go | 20 +-- .../{v2 => v2alpha1}/slackreceiver.go | 20 +-- .../{v2 => v2alpha1}/webhookconfig.go | 20 +-- .../{v2 => v2alpha1}/webhookreceiver.go | 20 +-- .../{v2 => v2alpha1}/wechatconfig.go | 20 +-- .../{v2 => v2alpha1}/wechatreceiver.go | 20 +-- .../{v2 => v2alpha1}/dingtalkconfig.go | 18 +- .../{v2 => v2alpha1}/dingtalkreceiver.go | 18 +- .../{v2 => v2alpha1}/emailconfig.go | 18 +- .../{v2 => v2alpha1}/emailreceiver.go | 18 +- .../{v2 => v2alpha1}/expansion_generated.go | 2 +- .../{v2 => v2alpha1}/slackconfig.go | 18 +- .../{v2 => v2alpha1}/slackreceiver.go | 18 +- .../{v2 => v2alpha1}/webhookconfig.go | 18 +- .../{v2 => v2alpha1}/webhookreceiver.go | 18 +- .../{v2 => v2alpha1}/wechatconfig.go | 18 +- .../{v2 => v2alpha1}/wechatreceiver.go | 18 +- .../notification/notification_controller.go | 82 ++++----- .../notification_controller_suite_test.go | 4 +- .../notification_controller_test.go | 4 +- pkg/models/notification/notification.go | 168 +++++++++--------- .../v1alpha3/notification/notification.go | 40 ++--- .../notification/notification_test.go | 84 ++++----- .../resources/v1alpha3/resource/resource.go | 22 +-- 99 files changed, 1031 insertions(+), 1006 deletions(-) rename pkg/apis/{addtoscheme_notification_v2.go => addtoscheme_notification_v2alpha1.go} (82%) rename pkg/apis/notification/{v2 => v2alpha1}/dingtalkconfig_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/dingtalkreceiver_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/doc.go (94%) rename pkg/apis/notification/{v2 => v2alpha1}/emailconfig_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/emailreceiver_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/notificationmanager_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/register.go (94%) rename pkg/apis/notification/{v2 => v2alpha1}/slackconfig_types.go (98%) rename pkg/apis/notification/{v2 => v2alpha1}/slackreceiver_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/types.go (98%) rename pkg/apis/notification/{v2/v2_suite_test.go => v2alpha1/v2alpha1_suite_test.go} (98%) rename pkg/apis/notification/{v2 => v2alpha1}/webhookconfig_types.go (98%) rename pkg/apis/notification/{v2 => v2alpha1}/webhookreceiver_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/wechatconfig_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/wechatreceiver_types.go (99%) rename pkg/apis/notification/{v2 => v2alpha1}/zz_generated.deepcopy.go (99%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/dingtalkconfig.go (78%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/dingtalkreceiver.go (78%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/doc.go (97%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/emailconfig.go (79%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/emailreceiver.go (79%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/doc.go (100%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_dingtalkconfig.go (72%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_dingtalkreceiver.go (71%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_emailconfig.go (74%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_emailreceiver.go (73%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_notification_client.go (53%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_slackconfig.go (74%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_slackreceiver.go (73%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_webhookconfig.go (73%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_webhookreceiver.go (72%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_wechatconfig.go (73%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/fake/fake_wechatreceiver.go (72%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/generated_expansion.go (98%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/notification_client.go (55%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/slackconfig.go (79%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/slackreceiver.go (79%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/webhookconfig.go (79%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/webhookreceiver.go (79%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/wechatconfig.go (79%) rename pkg/client/clientset/versioned/typed/notification/{v2 => v2alpha1}/wechatreceiver.go (78%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/dingtalkconfig.go (82%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/dingtalkreceiver.go (81%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/emailconfig.go (82%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/emailreceiver.go (82%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/interface.go (99%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/slackconfig.go (82%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/slackreceiver.go (82%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/webhookconfig.go (82%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/webhookreceiver.go (81%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/wechatconfig.go (82%) rename pkg/client/informers/externalversions/notification/{v2 => v2alpha1}/wechatreceiver.go (82%) rename pkg/client/listers/notification/{v2 => v2alpha1}/dingtalkconfig.go (76%) rename pkg/client/listers/notification/{v2 => v2alpha1}/dingtalkreceiver.go (76%) rename pkg/client/listers/notification/{v2 => v2alpha1}/emailconfig.go (77%) rename pkg/client/listers/notification/{v2 => v2alpha1}/emailreceiver.go (76%) rename pkg/client/listers/notification/{v2 => v2alpha1}/expansion_generated.go (99%) rename pkg/client/listers/notification/{v2 => v2alpha1}/slackconfig.go (77%) rename pkg/client/listers/notification/{v2 => v2alpha1}/slackreceiver.go (76%) rename pkg/client/listers/notification/{v2 => v2alpha1}/webhookconfig.go (76%) rename pkg/client/listers/notification/{v2 => v2alpha1}/webhookreceiver.go (76%) rename pkg/client/listers/notification/{v2 => v2alpha1}/wechatconfig.go (76%) rename pkg/client/listers/notification/{v2 => v2alpha1}/wechatreceiver.go (76%) diff --git a/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml b/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml index f072525eb..fa54137a5 100644 --- a/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml +++ b/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml @@ -18,7 +18,7 @@ spec: singular: dingtalkconfig scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: DingTalkConfig is the Schema for the dingtalkconfigs API diff --git a/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml b/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml index e7a7a4d27..00a64b934 100644 --- a/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml +++ b/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml @@ -18,7 +18,7 @@ spec: singular: dingtalkreceiver scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: DingTalkReceiver is the Schema for the dingtalkreceivers API diff --git a/config/crds/notification.kubesphere.io_emailconfigs.yaml b/config/crds/notification.kubesphere.io_emailconfigs.yaml index 1cf3d019d..104602f31 100644 --- a/config/crds/notification.kubesphere.io_emailconfigs.yaml +++ b/config/crds/notification.kubesphere.io_emailconfigs.yaml @@ -18,7 +18,7 @@ spec: singular: emailconfig scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: EmailConfig is the Schema for the emailconfigs API diff --git a/config/crds/notification.kubesphere.io_emailreceivers.yaml b/config/crds/notification.kubesphere.io_emailreceivers.yaml index cc2c923b7..10357914d 100644 --- a/config/crds/notification.kubesphere.io_emailreceivers.yaml +++ b/config/crds/notification.kubesphere.io_emailreceivers.yaml @@ -18,7 +18,7 @@ spec: singular: emailreceiver scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: EmailReceiver is the Schema for the emailreceivers API diff --git a/config/crds/notification.kubesphere.io_notificationmanagers.yaml b/config/crds/notification.kubesphere.io_notificationmanagers.yaml index 395a0e5d8..a7de41b66 100644 --- a/config/crds/notification.kubesphere.io_notificationmanagers.yaml +++ b/config/crds/notification.kubesphere.io_notificationmanagers.yaml @@ -18,7 +18,7 @@ spec: singular: notificationmanager scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: NotificationManager is the Schema for the notificationmanagers API diff --git a/config/crds/notification.kubesphere.io_slackconfigs.yaml b/config/crds/notification.kubesphere.io_slackconfigs.yaml index 58770ef38..3a4dadfed 100644 --- a/config/crds/notification.kubesphere.io_slackconfigs.yaml +++ b/config/crds/notification.kubesphere.io_slackconfigs.yaml @@ -18,7 +18,7 @@ spec: singular: slackconfig scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: SlackConfig is the Schema for the slackconfigs API diff --git a/config/crds/notification.kubesphere.io_slackreceivers.yaml b/config/crds/notification.kubesphere.io_slackreceivers.yaml index ea61fbeb2..c4d9f345f 100644 --- a/config/crds/notification.kubesphere.io_slackreceivers.yaml +++ b/config/crds/notification.kubesphere.io_slackreceivers.yaml @@ -18,7 +18,7 @@ spec: singular: slackreceiver scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: SlackReceiver is the Schema for the slackreceivers API diff --git a/config/crds/notification.kubesphere.io_webhookconfigs.yaml b/config/crds/notification.kubesphere.io_webhookconfigs.yaml index f2ec846f8..5658720c5 100644 --- a/config/crds/notification.kubesphere.io_webhookconfigs.yaml +++ b/config/crds/notification.kubesphere.io_webhookconfigs.yaml @@ -18,7 +18,7 @@ spec: singular: webhookconfig scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: WebhookConfig is the Schema for the webhookconfigs API diff --git a/config/crds/notification.kubesphere.io_webhookreceivers.yaml b/config/crds/notification.kubesphere.io_webhookreceivers.yaml index 1952eec6a..33f966ce8 100644 --- a/config/crds/notification.kubesphere.io_webhookreceivers.yaml +++ b/config/crds/notification.kubesphere.io_webhookreceivers.yaml @@ -18,7 +18,7 @@ spec: singular: webhookreceiver scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: WebhookReceiver is the Schema for the webhookreceivers API diff --git a/config/crds/notification.kubesphere.io_wechatconfigs.yaml b/config/crds/notification.kubesphere.io_wechatconfigs.yaml index 3d73baadd..5983f08b8 100644 --- a/config/crds/notification.kubesphere.io_wechatconfigs.yaml +++ b/config/crds/notification.kubesphere.io_wechatconfigs.yaml @@ -18,7 +18,7 @@ spec: singular: wechatconfig scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: WechatConfig is the Schema for the wechatconfigs API diff --git a/config/crds/notification.kubesphere.io_wechatreceivers.yaml b/config/crds/notification.kubesphere.io_wechatreceivers.yaml index 7f3ab488a..b36f0aa65 100644 --- a/config/crds/notification.kubesphere.io_wechatreceivers.yaml +++ b/config/crds/notification.kubesphere.io_wechatreceivers.yaml @@ -18,7 +18,7 @@ spec: singular: wechatreceiver scope: Cluster versions: - - name: v2 + - name: v2alpha1 schema: openAPIV3Schema: description: WechatReceiver is the Schema for the wechatreceivers API diff --git a/pkg/apis/addtoscheme_notification_v2.go b/pkg/apis/addtoscheme_notification_v2alpha1.go similarity index 82% rename from pkg/apis/addtoscheme_notification_v2.go rename to pkg/apis/addtoscheme_notification_v2alpha1.go index 541238481..00b75715c 100644 --- a/pkg/apis/addtoscheme_notification_v2.go +++ b/pkg/apis/addtoscheme_notification_v2alpha1.go @@ -17,9 +17,9 @@ limitations under the License. package apis import ( - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) func init() { - AddToSchemes = append(AddToSchemes, v2.SchemeBuilder.AddToScheme) + AddToSchemes = append(AddToSchemes, v2alpha1.SchemeBuilder.AddToScheme) } diff --git a/pkg/apis/notification/v2/dingtalkconfig_types.go b/pkg/apis/notification/v2alpha1/dingtalkconfig_types.go similarity index 99% rename from pkg/apis/notification/v2/dingtalkconfig_types.go rename to pkg/apis/notification/v2alpha1/dingtalkconfig_types.go index 615468b54..bff9f986e 100644 --- a/pkg/apis/notification/v2/dingtalkconfig_types.go +++ b/pkg/apis/notification/v2alpha1/dingtalkconfig_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/dingtalkreceiver_types.go b/pkg/apis/notification/v2alpha1/dingtalkreceiver_types.go similarity index 99% rename from pkg/apis/notification/v2/dingtalkreceiver_types.go rename to pkg/apis/notification/v2alpha1/dingtalkreceiver_types.go index 9e2696ccb..c0df00a02 100644 --- a/pkg/apis/notification/v2/dingtalkreceiver_types.go +++ b/pkg/apis/notification/v2alpha1/dingtalkreceiver_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/doc.go b/pkg/apis/notification/v2alpha1/doc.go similarity index 94% rename from pkg/apis/notification/v2/doc.go rename to pkg/apis/notification/v2alpha1/doc.go index 383ff6b1c..73b0fbc8c 100644 --- a/pkg/apis/notification/v2/doc.go +++ b/pkg/apis/notification/v2alpha1/doc.go @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha1 contains API Schema definitions for the notification v2 API group +// Package v1alpha1 contains API Schema definitions for the notification v2alpha1 API group // +groupName=notification.kubesphere.io // +genclient // +genclient:nonNamespaced -package v2 +package v2alpha1 diff --git a/pkg/apis/notification/v2/emailconfig_types.go b/pkg/apis/notification/v2alpha1/emailconfig_types.go similarity index 99% rename from pkg/apis/notification/v2/emailconfig_types.go rename to pkg/apis/notification/v2alpha1/emailconfig_types.go index fba4529f9..69f50aeed 100644 --- a/pkg/apis/notification/v2/emailconfig_types.go +++ b/pkg/apis/notification/v2alpha1/emailconfig_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/emailreceiver_types.go b/pkg/apis/notification/v2alpha1/emailreceiver_types.go similarity index 99% rename from pkg/apis/notification/v2/emailreceiver_types.go rename to pkg/apis/notification/v2alpha1/emailreceiver_types.go index 9bf31ac5b..d6b23e5a0 100644 --- a/pkg/apis/notification/v2/emailreceiver_types.go +++ b/pkg/apis/notification/v2alpha1/emailreceiver_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/notificationmanager_types.go b/pkg/apis/notification/v2alpha1/notificationmanager_types.go similarity index 99% rename from pkg/apis/notification/v2/notificationmanager_types.go rename to pkg/apis/notification/v2alpha1/notificationmanager_types.go index 5af543fc6..ac8681d82 100644 --- a/pkg/apis/notification/v2/notificationmanager_types.go +++ b/pkg/apis/notification/v2alpha1/notificationmanager_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( "k8s.io/api/core/v1" diff --git a/pkg/apis/notification/v2/register.go b/pkg/apis/notification/v2alpha1/register.go similarity index 94% rename from pkg/apis/notification/v2/register.go rename to pkg/apis/notification/v2alpha1/register.go index 8103b55f0..b36e0bd20 100644 --- a/pkg/apis/notification/v2/register.go +++ b/pkg/apis/notification/v2alpha1/register.go @@ -16,10 +16,10 @@ limitations under the License. // NOTE: Boilerplate only. Ignore this file. -// Package v1alpha1 contains API Schema definitions for the notification v2 API group +// Package v1alpha1 contains API Schema definitions for the notification v2alpha1 API group // +k8s:deepcopy-gen=package,register // +groupName=notification.kubesphere.io -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -28,7 +28,7 @@ import ( var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "notification.kubesphere.io", Version: "v2"} + SchemeGroupVersion = schema.GroupVersion{Group: "notification.kubesphere.io", Version: "v2alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} diff --git a/pkg/apis/notification/v2/slackconfig_types.go b/pkg/apis/notification/v2alpha1/slackconfig_types.go similarity index 98% rename from pkg/apis/notification/v2/slackconfig_types.go rename to pkg/apis/notification/v2alpha1/slackconfig_types.go index eb1b75619..42d86da7f 100644 --- a/pkg/apis/notification/v2/slackconfig_types.go +++ b/pkg/apis/notification/v2alpha1/slackconfig_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/slackreceiver_types.go b/pkg/apis/notification/v2alpha1/slackreceiver_types.go similarity index 99% rename from pkg/apis/notification/v2/slackreceiver_types.go rename to pkg/apis/notification/v2alpha1/slackreceiver_types.go index bbe78d73f..1ccc7df20 100644 --- a/pkg/apis/notification/v2/slackreceiver_types.go +++ b/pkg/apis/notification/v2alpha1/slackreceiver_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/types.go b/pkg/apis/notification/v2alpha1/types.go similarity index 98% rename from pkg/apis/notification/v2/types.go rename to pkg/apis/notification/v2alpha1/types.go index 57c3bbd2a..52b192fd1 100644 --- a/pkg/apis/notification/v2/types.go +++ b/pkg/apis/notification/v2alpha1/types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 const ( ResourcesPluralDingTalkConfig = "dingtalkconfigs" diff --git a/pkg/apis/notification/v2/v2_suite_test.go b/pkg/apis/notification/v2alpha1/v2alpha1_suite_test.go similarity index 98% rename from pkg/apis/notification/v2/v2_suite_test.go rename to pkg/apis/notification/v2alpha1/v2alpha1_suite_test.go index 9e49e5c9d..5309e2eb5 100644 --- a/pkg/apis/notification/v2/v2_suite_test.go +++ b/pkg/apis/notification/v2alpha1/v2alpha1_suite_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( "log" diff --git a/pkg/apis/notification/v2/webhookconfig_types.go b/pkg/apis/notification/v2alpha1/webhookconfig_types.go similarity index 98% rename from pkg/apis/notification/v2/webhookconfig_types.go rename to pkg/apis/notification/v2alpha1/webhookconfig_types.go index d79f519da..4a0771a26 100644 --- a/pkg/apis/notification/v2/webhookconfig_types.go +++ b/pkg/apis/notification/v2alpha1/webhookconfig_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/webhookreceiver_types.go b/pkg/apis/notification/v2alpha1/webhookreceiver_types.go similarity index 99% rename from pkg/apis/notification/v2/webhookreceiver_types.go rename to pkg/apis/notification/v2alpha1/webhookreceiver_types.go index 19e27b423..6b6eeaf04 100644 --- a/pkg/apis/notification/v2/webhookreceiver_types.go +++ b/pkg/apis/notification/v2alpha1/webhookreceiver_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/wechatconfig_types.go b/pkg/apis/notification/v2alpha1/wechatconfig_types.go similarity index 99% rename from pkg/apis/notification/v2/wechatconfig_types.go rename to pkg/apis/notification/v2alpha1/wechatconfig_types.go index 60bb31ce8..9bc974392 100644 --- a/pkg/apis/notification/v2/wechatconfig_types.go +++ b/pkg/apis/notification/v2alpha1/wechatconfig_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/wechatreceiver_types.go b/pkg/apis/notification/v2alpha1/wechatreceiver_types.go similarity index 99% rename from pkg/apis/notification/v2/wechatreceiver_types.go rename to pkg/apis/notification/v2alpha1/wechatreceiver_types.go index 916c0b912..7959b1d2e 100644 --- a/pkg/apis/notification/v2/wechatreceiver_types.go +++ b/pkg/apis/notification/v2alpha1/wechatreceiver_types.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2 +package v2alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/notification/v2/zz_generated.deepcopy.go b/pkg/apis/notification/v2alpha1/zz_generated.deepcopy.go similarity index 99% rename from pkg/apis/notification/v2/zz_generated.deepcopy.go rename to pkg/apis/notification/v2alpha1/zz_generated.deepcopy.go index 021089293..530e0f18e 100644 --- a/pkg/apis/notification/v2/zz_generated.deepcopy.go +++ b/pkg/apis/notification/v2alpha1/zz_generated.deepcopy.go @@ -18,7 +18,7 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( corev1 "k8s.io/api/core/v1" diff --git a/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go b/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go index 3dbeeefb9..fd4436a8a 100644 --- a/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go +++ b/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -50,7 +50,7 @@ type FederatedDingTalkConfigSpec struct { type DingTalkConfigTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.DingTalkConfigSpec `json:"spec,omitempty"` + Spec v2alpha1.DingTalkConfigSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go b/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go index 69f4c5272..0a6fa0172 100644 --- a/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go +++ b/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedDingTalkReceiverSpec struct { type DingTalkReceiverTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.DingTalkReceiverSpec `json:"spec,omitempty"` + Spec v2alpha1.DingTalkReceiverSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedemailconfig_types.go b/pkg/apis/types/v1beta1/federatedemailconfig_types.go index 2dcb93f4c..4fa1e8a26 100644 --- a/pkg/apis/types/v1beta1/federatedemailconfig_types.go +++ b/pkg/apis/types/v1beta1/federatedemailconfig_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedEmailConfigSpec struct { type EmailConfigTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.EmailConfigSpec `json:"spec,omitempty"` + Spec v2alpha1.EmailConfigSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedemailreceiver_types.go b/pkg/apis/types/v1beta1/federatedemailreceiver_types.go index 729043642..dc1cb06a1 100644 --- a/pkg/apis/types/v1beta1/federatedemailreceiver_types.go +++ b/pkg/apis/types/v1beta1/federatedemailreceiver_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedEmailReceiverSpec struct { type EmailReceiverTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.EmailReceiverSpec `json:"spec,omitempty"` + Spec v2alpha1.EmailReceiverSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedslackconfig_types.go b/pkg/apis/types/v1beta1/federatedslackconfig_types.go index e368dba4d..4871bcaac 100644 --- a/pkg/apis/types/v1beta1/federatedslackconfig_types.go +++ b/pkg/apis/types/v1beta1/federatedslackconfig_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedSlackConfigSpec struct { type SlackConfigTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.SlackConfigSpec `json:"spec,omitempty"` + Spec v2alpha1.SlackConfigSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedslackreceiver_types.go b/pkg/apis/types/v1beta1/federatedslackreceiver_types.go index 840d782ba..7ef753fb6 100644 --- a/pkg/apis/types/v1beta1/federatedslackreceiver_types.go +++ b/pkg/apis/types/v1beta1/federatedslackreceiver_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedSlackReceiverSpec struct { type SlackReceiverTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.SlackReceiverSpec `json:"spec,omitempty"` + Spec v2alpha1.SlackReceiverSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go b/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go index 6bfe396ae..d2408a195 100644 --- a/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go +++ b/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedWebhookConfigSpec struct { type WebhookConfigTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.WebhookConfigSpec `json:"spec,omitempty"` + Spec v2alpha1.WebhookConfigSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go b/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go index 4bbbb4755..8e07f76f6 100644 --- a/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go +++ b/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedWebhookReceiverSpec struct { type WebhookReceiverTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.WebhookReceiverSpec `json:"spec,omitempty"` + Spec v2alpha1.WebhookReceiverSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedwechatconfig_types.go b/pkg/apis/types/v1beta1/federatedwechatconfig_types.go index eaf906124..382c563c9 100644 --- a/pkg/apis/types/v1beta1/federatedwechatconfig_types.go +++ b/pkg/apis/types/v1beta1/federatedwechatconfig_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedWechatConfigSpec struct { type WechatConfigTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.WechatConfigSpec `json:"spec,omitempty"` + Spec v2alpha1.WechatConfigSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go b/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go index 957909175..32cfe63a8 100644 --- a/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go +++ b/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go @@ -18,7 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) const ( @@ -49,7 +49,7 @@ type FederatedWechatReceiverSpec struct { type WechatReceiverTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2.WechatReceiverSpec `json:"spec,omitempty"` + Spec v2alpha1.WechatReceiverSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 2bf94803f..cdef0d6b0 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" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationcrd "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" @@ -314,16 +314,16 @@ func (s *APIServer) buildHandlerChain(stopCh <-chan struct{}) { tenantv1alpha2.Resource(clusterv1alpha1.ResourcesPluralCluster), clusterv1alpha1.Resource(clusterv1alpha1.ResourcesPluralCluster), resourcev1alpha3.Resource(clusterv1alpha1.ResourcesPluralCluster), - v2.Resource(v2.ResourcesPluralDingTalkConfig), - v2.Resource(v2.ResourcesPluralDingTalkReceiver), - v2.Resource(v2.ResourcesPluralEmailReceiver), - v2.Resource(v2.ResourcesPluralEmailConfig), - v2.Resource(v2.ResourcesPluralSlackConfig), - v2.Resource(v2.ResourcesPluralSlackReceiver), - v2.Resource(v2.ResourcesPluralWebhookConfig), - v2.Resource(v2.ResourcesPluralWebhookReceiver), - v2.Resource(v2.ResourcesPluralWechatConfig), - v2.Resource(v2.ResourcesPluralWechatReceiver), + 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), }, } @@ -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: "v2", Resource: v2.ResourcesPluralDingTalkConfig}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralDingTalkReceiver}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralEmailConfig}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralEmailReceiver}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralSlackConfig}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralSlackReceiver}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWebhookConfig}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWebhookReceiver}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWechatConfig}, - {Group: "notification.kubesphere.io", Version: "v2", Resource: v2.ResourcesPluralWechatReceiver}, + {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}, } devopsGVRs := []schema.GroupVersionResource{ diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 34da827f2..d898df682 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" - notificationv2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2" quotav1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/quota/v1alpha2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1" 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 - NotificationV2() notificationv2.NotificationV2Interface QuotaV1alpha2() quotav1alpha2.QuotaV1alpha2Interface + NotificationV2alpha1() notificationv2alpha1.NotificationV2alpha1Interface ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface @@ -69,7 +69,7 @@ type Clientset struct { devopsV1alpha3 *devopsv1alpha3.DevopsV1alpha3Client iamV1alpha2 *iamv1alpha2.IamV1alpha2Client networkV1alpha1 *networkv1alpha1.NetworkV1alpha1Client - notificationV2 *notificationv2.NotificationV2Client + notificationV2alpha1 *notificationv2alpha1.NotificationV2alpha1Client quotaV1alpha2 *quotav1alpha2.QuotaV1alpha2Client servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client storageV1alpha1 *storagev1alpha1.StorageV1alpha1Client @@ -113,9 +113,9 @@ func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface { return c.networkV1alpha1 } -// NotificationV2 retrieves the NotificationV2Client -func (c *Clientset) NotificationV2() notificationv2.NotificationV2Interface { - return c.notificationV2 +// NotificationV2alpha1 retrieves the NotificationV2alpha1Client +func (c *Clientset) NotificationV2alpha1() notificationv2alpha1.NotificationV2alpha1Interface { + return c.notificationV2alpha1 } // QuotaV1alpha2 retrieves the QuotaV1alpha2Client @@ -197,7 +197,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.notificationV2, err = notificationv2.NewForConfig(&configShallowCopy) + cs.notificationV2alpha1, err = notificationv2alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -244,7 +244,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.devopsV1alpha3 = devopsv1alpha3.NewForConfigOrDie(c) cs.iamV1alpha2 = iamv1alpha2.NewForConfigOrDie(c) cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c) - cs.notificationV2 = notificationv2.NewForConfigOrDie(c) + cs.notificationV2alpha1 = notificationv2alpha1.NewForConfigOrDie(c) cs.quotaV1alpha2 = quotav1alpha2.NewForConfigOrDie(c) cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c) cs.storageV1alpha1 = storagev1alpha1.NewForConfigOrDie(c) @@ -266,7 +266,7 @@ func New(c rest.Interface) *Clientset { cs.devopsV1alpha3 = devopsv1alpha3.New(c) cs.iamV1alpha2 = iamv1alpha2.New(c) cs.networkV1alpha1 = networkv1alpha1.New(c) - cs.notificationV2 = notificationv2.New(c) + cs.notificationV2alpha1 = notificationv2alpha1.New(c) cs.quotaV1alpha2 = quotav1alpha2.New(c) cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c) cs.storageV1alpha1 = storagev1alpha1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index c63fe54b1..c7aeb6234 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -39,10 +39,15 @@ 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 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" @@ -137,9 +142,9 @@ func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface { return &fakenetworkv1alpha1.FakeNetworkV1alpha1{Fake: &c.Fake} } -// NotificationV2 retrieves the NotificationV2Client -func (c *Clientset) NotificationV2() notificationv2.NotificationV2Interface { - return &fakenotificationv2.FakeNotificationV2{Fake: &c.Fake} +// NotificationV2alpha1 retrieves the NotificationV2alpha1Client +func (c *Clientset) NotificationV2alpha1() notificationv2alpha1.NotificationV2alpha1Interface { + return &fakenotificationv2alpha1.FakeNotificationV2alpha1{Fake: &c.Fake} } // QuotaV1alpha2 retrieves the QuotaV1alpha2Client diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index c7526aa95..cf2870887 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -31,8 +31,12 @@ 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 servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" @@ -51,8 +55,12 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, +<<<<<<< HEAD notificationv2.AddToScheme, quotav1alpha2.AddToScheme, +======= + notificationv2alpha1.AddToScheme, +>>>>>>> change notification crd version to v2alpha1 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 12713803d..cd42e779c 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -31,8 +31,12 @@ 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 servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" @@ -51,8 +55,12 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, +<<<<<<< HEAD notificationv2.AddToScheme, quotav1alpha2.AddToScheme, +======= + notificationv2alpha1.AddToScheme, +>>>>>>> change notification crd version to v2alpha1 servicemeshv1alpha2.AddToScheme, storagev1alpha1.AddToScheme, tenantv1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/typed/notification/v2/dingtalkconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkconfig.go similarity index 78% rename from pkg/client/clientset/versioned/typed/notification/v2/dingtalkconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkconfig.go index f02141ed5..35e116922 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/dingtalkconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type DingTalkConfigsGetter interface { // DingTalkConfigInterface has methods to work with DingTalkConfig resources. type DingTalkConfigInterface interface { - Create(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.CreateOptions) (*v2.DingTalkConfig, error) - Update(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (*v2.DingTalkConfig, error) - UpdateStatus(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (*v2.DingTalkConfig, error) + Create(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.CreateOptions) (*v2alpha1.DingTalkConfig, error) + Update(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (*v2alpha1.DingTalkConfig, error) + UpdateStatus(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (*v2alpha1.DingTalkConfig, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.DingTalkConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.DingTalkConfigList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.DingTalkConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.DingTalkConfigList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkConfig, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkConfig, err error) DingTalkConfigExpansion } @@ -56,15 +56,15 @@ type dingTalkConfigs struct { } // newDingTalkConfigs returns a DingTalkConfigs -func newDingTalkConfigs(c *NotificationV2Client) *dingTalkConfigs { +func newDingTalkConfigs(c *NotificationV2alpha1Client) *dingTalkConfigs { return &dingTalkConfigs{ client: c.RESTClient(), } } // Get takes name of the dingTalkConfig, and returns the corresponding dingTalkConfig object, and an error if there is any. -func (c *dingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkConfig, err error) { - result = &v2.DingTalkConfig{} +func (c *dingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkConfig, err error) { + result = &v2alpha1.DingTalkConfig{} err = c.client.Get(). Resource("dingtalkconfigs"). Name(name). @@ -75,12 +75,12 @@ func (c *dingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOp } // List takes label and field selectors, and returns the list of DingTalkConfigs that match those selectors. -func (c *dingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkConfigList, err error) { +func (c *dingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.DingTalkConfigList{} + result = &v2alpha1.DingTalkConfigList{} err = c.client.Get(). Resource("dingtalkconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *dingTalkConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch } // Create takes the representation of a dingTalkConfig and creates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *dingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.CreateOptions) (result *v2.DingTalkConfig, err error) { - result = &v2.DingTalkConfig{} +func (c *dingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.CreateOptions) (result *v2alpha1.DingTalkConfig, err error) { + result = &v2alpha1.DingTalkConfig{} err = c.client.Post(). Resource("dingtalkconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *dingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2.DingTal } // Update takes the representation of a dingTalkConfig and updates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *dingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (result *v2.DingTalkConfig, err error) { - result = &v2.DingTalkConfig{} +func (c *dingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (result *v2alpha1.DingTalkConfig, err error) { + result = &v2alpha1.DingTalkConfig{} err = c.client.Put(). Resource("dingtalkconfigs"). Name(dingTalkConfig.Name). @@ -131,8 +131,8 @@ func (c *dingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2.DingTal // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (result *v2.DingTalkConfig, err error) { - result = &v2.DingTalkConfig{} +func (c *dingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (result *v2alpha1.DingTalkConfig, err error) { + result = &v2alpha1.DingTalkConfig{} err = c.client.Put(). Resource("dingtalkconfigs"). Name(dingTalkConfig.Name). @@ -170,8 +170,8 @@ func (c *dingTalkConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOp } // Patch applies the patch and returns the patched dingTalkConfig. -func (c *dingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkConfig, err error) { - result = &v2.DingTalkConfig{} +func (c *dingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkConfig, err error) { + result = &v2alpha1.DingTalkConfig{} err = c.client.Patch(pt). Resource("dingtalkconfigs"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/dingtalkreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkreceiver.go similarity index 78% rename from pkg/client/clientset/versioned/typed/notification/v2/dingtalkreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkreceiver.go index ba801ae4f..2eae8ca23 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/dingtalkreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type DingTalkReceiversGetter interface { // DingTalkReceiverInterface has methods to work with DingTalkReceiver resources. type DingTalkReceiverInterface interface { - Create(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.CreateOptions) (*v2.DingTalkReceiver, error) - Update(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (*v2.DingTalkReceiver, error) - UpdateStatus(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (*v2.DingTalkReceiver, error) + Create(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.CreateOptions) (*v2alpha1.DingTalkReceiver, error) + Update(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (*v2alpha1.DingTalkReceiver, error) + UpdateStatus(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (*v2alpha1.DingTalkReceiver, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.DingTalkReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.DingTalkReceiverList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.DingTalkReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.DingTalkReceiverList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkReceiver, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkReceiver, err error) DingTalkReceiverExpansion } @@ -56,15 +56,15 @@ type dingTalkReceivers struct { } // newDingTalkReceivers returns a DingTalkReceivers -func newDingTalkReceivers(c *NotificationV2Client) *dingTalkReceivers { +func newDingTalkReceivers(c *NotificationV2alpha1Client) *dingTalkReceivers { return &dingTalkReceivers{ client: c.RESTClient(), } } // Get takes name of the dingTalkReceiver, and returns the corresponding dingTalkReceiver object, and an error if there is any. -func (c *dingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkReceiver, err error) { - result = &v2.DingTalkReceiver{} +func (c *dingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkReceiver, err error) { + result = &v2alpha1.DingTalkReceiver{} err = c.client.Get(). Resource("dingtalkreceivers"). Name(name). @@ -75,12 +75,12 @@ func (c *dingTalkReceivers) Get(ctx context.Context, name string, options v1.Get } // List takes label and field selectors, and returns the list of DingTalkReceivers that match those selectors. -func (c *dingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkReceiverList, err error) { +func (c *dingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkReceiverList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.DingTalkReceiverList{} + result = &v2alpha1.DingTalkReceiverList{} err = c.client.Get(). Resource("dingtalkreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *dingTalkReceivers) Watch(ctx context.Context, opts v1.ListOptions) (wat } // Create takes the representation of a dingTalkReceiver and creates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *dingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.CreateOptions) (result *v2.DingTalkReceiver, err error) { - result = &v2.DingTalkReceiver{} +func (c *dingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.CreateOptions) (result *v2alpha1.DingTalkReceiver, err error) { + result = &v2alpha1.DingTalkReceiver{} err = c.client.Post(). Resource("dingtalkreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *dingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2.Din } // Update takes the representation of a dingTalkReceiver and updates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *dingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (result *v2.DingTalkReceiver, err error) { - result = &v2.DingTalkReceiver{} +func (c *dingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (result *v2alpha1.DingTalkReceiver, err error) { + result = &v2alpha1.DingTalkReceiver{} err = c.client.Put(). Resource("dingtalkreceivers"). Name(dingTalkReceiver.Name). @@ -131,8 +131,8 @@ func (c *dingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2.Din // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (result *v2.DingTalkReceiver, err error) { - result = &v2.DingTalkReceiver{} +func (c *dingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (result *v2alpha1.DingTalkReceiver, err error) { + result = &v2alpha1.DingTalkReceiver{} err = c.client.Put(). Resource("dingtalkreceivers"). Name(dingTalkReceiver.Name). @@ -170,8 +170,8 @@ func (c *dingTalkReceivers) DeleteCollection(ctx context.Context, opts v1.Delete } // Patch applies the patch and returns the patched dingTalkReceiver. -func (c *dingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkReceiver, err error) { - result = &v2.DingTalkReceiver{} +func (c *dingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkReceiver, err error) { + result = &v2alpha1.DingTalkReceiver{} err = c.client.Patch(pt). Resource("dingtalkreceivers"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/doc.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/doc.go similarity index 97% rename from pkg/client/clientset/versioned/typed/notification/v2/doc.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/doc.go index 35a9a79f7..c24ff03b2 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/doc.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v2 +package v2alpha1 diff --git a/pkg/client/clientset/versioned/typed/notification/v2/emailconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailconfig.go similarity index 79% rename from pkg/client/clientset/versioned/typed/notification/v2/emailconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/emailconfig.go index 13bc00da6..d1fed1056 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/emailconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type EmailConfigsGetter interface { // EmailConfigInterface has methods to work with EmailConfig resources. type EmailConfigInterface interface { - Create(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.CreateOptions) (*v2.EmailConfig, error) - Update(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (*v2.EmailConfig, error) - UpdateStatus(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (*v2.EmailConfig, error) + Create(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.CreateOptions) (*v2alpha1.EmailConfig, error) + Update(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (*v2alpha1.EmailConfig, error) + UpdateStatus(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (*v2alpha1.EmailConfig, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.EmailConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.EmailConfigList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.EmailConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.EmailConfigList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailConfig, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailConfig, err error) EmailConfigExpansion } @@ -56,15 +56,15 @@ type emailConfigs struct { } // newEmailConfigs returns a EmailConfigs -func newEmailConfigs(c *NotificationV2Client) *emailConfigs { +func newEmailConfigs(c *NotificationV2alpha1Client) *emailConfigs { return &emailConfigs{ client: c.RESTClient(), } } // Get takes name of the emailConfig, and returns the corresponding emailConfig object, and an error if there is any. -func (c *emailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailConfig, err error) { - result = &v2.EmailConfig{} +func (c *emailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailConfig, err error) { + result = &v2alpha1.EmailConfig{} err = c.client.Get(). Resource("emailconfigs"). Name(name). @@ -75,12 +75,12 @@ func (c *emailConfigs) Get(ctx context.Context, name string, options v1.GetOptio } // List takes label and field selectors, and returns the list of EmailConfigs that match those selectors. -func (c *emailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailConfigList, err error) { +func (c *emailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.EmailConfigList{} + result = &v2alpha1.EmailConfigList{} err = c.client.Get(). Resource("emailconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *emailConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.In } // Create takes the representation of a emailConfig and creates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *emailConfigs) Create(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.CreateOptions) (result *v2.EmailConfig, err error) { - result = &v2.EmailConfig{} +func (c *emailConfigs) Create(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.CreateOptions) (result *v2alpha1.EmailConfig, err error) { + result = &v2alpha1.EmailConfig{} err = c.client.Post(). Resource("emailconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *emailConfigs) Create(ctx context.Context, emailConfig *v2.EmailConfig, } // Update takes the representation of a emailConfig and updates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *emailConfigs) Update(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (result *v2.EmailConfig, err error) { - result = &v2.EmailConfig{} +func (c *emailConfigs) Update(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (result *v2alpha1.EmailConfig, err error) { + result = &v2alpha1.EmailConfig{} err = c.client.Put(). Resource("emailconfigs"). Name(emailConfig.Name). @@ -131,8 +131,8 @@ func (c *emailConfigs) Update(ctx context.Context, emailConfig *v2.EmailConfig, // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *emailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (result *v2.EmailConfig, err error) { - result = &v2.EmailConfig{} +func (c *emailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (result *v2alpha1.EmailConfig, err error) { + result = &v2alpha1.EmailConfig{} err = c.client.Put(). Resource("emailconfigs"). Name(emailConfig.Name). @@ -170,8 +170,8 @@ func (c *emailConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptio } // Patch applies the patch and returns the patched emailConfig. -func (c *emailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailConfig, err error) { - result = &v2.EmailConfig{} +func (c *emailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailConfig, err error) { + result = &v2alpha1.EmailConfig{} err = c.client.Patch(pt). Resource("emailconfigs"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/emailreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailreceiver.go similarity index 79% rename from pkg/client/clientset/versioned/typed/notification/v2/emailreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/emailreceiver.go index 65964d6cd..2ea00f10c 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/emailreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type EmailReceiversGetter interface { // EmailReceiverInterface has methods to work with EmailReceiver resources. type EmailReceiverInterface interface { - Create(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.CreateOptions) (*v2.EmailReceiver, error) - Update(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (*v2.EmailReceiver, error) - UpdateStatus(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (*v2.EmailReceiver, error) + Create(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.CreateOptions) (*v2alpha1.EmailReceiver, error) + Update(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (*v2alpha1.EmailReceiver, error) + UpdateStatus(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (*v2alpha1.EmailReceiver, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.EmailReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.EmailReceiverList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.EmailReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.EmailReceiverList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailReceiver, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailReceiver, err error) EmailReceiverExpansion } @@ -56,15 +56,15 @@ type emailReceivers struct { } // newEmailReceivers returns a EmailReceivers -func newEmailReceivers(c *NotificationV2Client) *emailReceivers { +func newEmailReceivers(c *NotificationV2alpha1Client) *emailReceivers { return &emailReceivers{ client: c.RESTClient(), } } // Get takes name of the emailReceiver, and returns the corresponding emailReceiver object, and an error if there is any. -func (c *emailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailReceiver, err error) { - result = &v2.EmailReceiver{} +func (c *emailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailReceiver, err error) { + result = &v2alpha1.EmailReceiver{} err = c.client.Get(). Resource("emailreceivers"). Name(name). @@ -75,12 +75,12 @@ func (c *emailReceivers) Get(ctx context.Context, name string, options v1.GetOpt } // List takes label and field selectors, and returns the list of EmailReceivers that match those selectors. -func (c *emailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailReceiverList, err error) { +func (c *emailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailReceiverList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.EmailReceiverList{} + result = &v2alpha1.EmailReceiverList{} err = c.client.Get(). Resource("emailreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *emailReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch. } // Create takes the representation of a emailReceiver and creates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *emailReceivers) Create(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.CreateOptions) (result *v2.EmailReceiver, err error) { - result = &v2.EmailReceiver{} +func (c *emailReceivers) Create(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.CreateOptions) (result *v2alpha1.EmailReceiver, err error) { + result = &v2alpha1.EmailReceiver{} err = c.client.Post(). Resource("emailreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *emailReceivers) Create(ctx context.Context, emailReceiver *v2.EmailRece } // Update takes the representation of a emailReceiver and updates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *emailReceivers) Update(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (result *v2.EmailReceiver, err error) { - result = &v2.EmailReceiver{} +func (c *emailReceivers) Update(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (result *v2alpha1.EmailReceiver, err error) { + result = &v2alpha1.EmailReceiver{} err = c.client.Put(). Resource("emailreceivers"). Name(emailReceiver.Name). @@ -131,8 +131,8 @@ func (c *emailReceivers) Update(ctx context.Context, emailReceiver *v2.EmailRece // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *emailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (result *v2.EmailReceiver, err error) { - result = &v2.EmailReceiver{} +func (c *emailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (result *v2alpha1.EmailReceiver, err error) { + result = &v2alpha1.EmailReceiver{} err = c.client.Put(). Resource("emailreceivers"). Name(emailReceiver.Name). @@ -170,8 +170,8 @@ func (c *emailReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOpt } // Patch applies the patch and returns the patched emailReceiver. -func (c *emailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailReceiver, err error) { - result = &v2.EmailReceiver{} +func (c *emailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailReceiver, err error) { + result = &v2alpha1.EmailReceiver{} err = c.client.Patch(pt). Resource("emailreceivers"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/doc.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/doc.go similarity index 100% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/doc.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/doc.go diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkconfig.go similarity index 72% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkconfig.go index b3d6c754a..389c64f1b 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkconfig.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeDingTalkConfigs implements DingTalkConfigInterface type FakeDingTalkConfigs struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var dingtalkconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "dingtalkconfigs"} +var dingtalkconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "dingtalkconfigs"} -var dingtalkconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "DingTalkConfig"} +var dingtalkconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "DingTalkConfig"} // Get takes name of the dingTalkConfig, and returns the corresponding dingTalkConfig object, and an error if there is any. -func (c *FakeDingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkConfig, err error) { +func (c *FakeDingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(dingtalkconfigsResource, name), &v2.DingTalkConfig{}) + Invokes(testing.NewRootGetAction(dingtalkconfigsResource, name), &v2alpha1.DingTalkConfig{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkConfig), err + return obj.(*v2alpha1.DingTalkConfig), err } // List takes label and field selectors, and returns the list of DingTalkConfigs that match those selectors. -func (c *FakeDingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkConfigList, err error) { +func (c *FakeDingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkConfigList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(dingtalkconfigsResource, dingtalkconfigsKind, opts), &v2.DingTalkConfigList{}) + Invokes(testing.NewRootListAction(dingtalkconfigsResource, dingtalkconfigsKind, opts), &v2alpha1.DingTalkConfigList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeDingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (re if label == nil { label = labels.Everything() } - list := &v2.DingTalkConfigList{ListMeta: obj.(*v2.DingTalkConfigList).ListMeta} - for _, item := range obj.(*v2.DingTalkConfigList).Items { + list := &v2alpha1.DingTalkConfigList{ListMeta: obj.(*v2alpha1.DingTalkConfigList).ListMeta} + for _, item := range obj.(*v2alpha1.DingTalkConfigList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeDingTalkConfigs) Watch(ctx context.Context, opts v1.ListOptions) (w } // Create takes the representation of a dingTalkConfig and creates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *FakeDingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.CreateOptions) (result *v2.DingTalkConfig, err error) { +func (c *FakeDingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.CreateOptions) (result *v2alpha1.DingTalkConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(dingtalkconfigsResource, dingTalkConfig), &v2.DingTalkConfig{}) + Invokes(testing.NewRootCreateAction(dingtalkconfigsResource, dingTalkConfig), &v2alpha1.DingTalkConfig{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkConfig), err + return obj.(*v2alpha1.DingTalkConfig), err } // Update takes the representation of a dingTalkConfig and updates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *FakeDingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (result *v2.DingTalkConfig, err error) { +func (c *FakeDingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (result *v2alpha1.DingTalkConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(dingtalkconfigsResource, dingTalkConfig), &v2.DingTalkConfig{}) + Invokes(testing.NewRootUpdateAction(dingtalkconfigsResource, dingTalkConfig), &v2alpha1.DingTalkConfig{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkConfig), err + return obj.(*v2alpha1.DingTalkConfig), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2.DingTalkConfig, opts v1.UpdateOptions) (*v2.DingTalkConfig, error) { +func (c *FakeDingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (*v2alpha1.DingTalkConfig, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(dingtalkconfigsResource, "status", dingTalkConfig), &v2.DingTalkConfig{}) + Invokes(testing.NewRootUpdateSubresourceAction(dingtalkconfigsResource, "status", dingTalkConfig), &v2alpha1.DingTalkConfig{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkConfig), err + return obj.(*v2alpha1.DingTalkConfig), err } // Delete takes name of the dingTalkConfig and deletes it. Returns an error if one occurs. func (c *FakeDingTalkConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(dingtalkconfigsResource, name), &v2.DingTalkConfig{}) + Invokes(testing.NewRootDeleteAction(dingtalkconfigsResource, name), &v2alpha1.DingTalkConfig{}) return err } @@ -118,16 +118,16 @@ func (c *FakeDingTalkConfigs) Delete(ctx context.Context, name string, opts v1.D func (c *FakeDingTalkConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(dingtalkconfigsResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.DingTalkConfigList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.DingTalkConfigList{}) return err } // Patch applies the patch and returns the patched dingTalkConfig. -func (c *FakeDingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkConfig, err error) { +func (c *FakeDingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(dingtalkconfigsResource, name, pt, data, subresources...), &v2.DingTalkConfig{}) + Invokes(testing.NewRootPatchSubresourceAction(dingtalkconfigsResource, name, pt, data, subresources...), &v2alpha1.DingTalkConfig{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkConfig), err + return obj.(*v2alpha1.DingTalkConfig), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkreceiver.go similarity index 71% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkreceiver.go index 0a918bce5..f0d7c3a2d 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_dingtalkreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkreceiver.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeDingTalkReceivers implements DingTalkReceiverInterface type FakeDingTalkReceivers struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var dingtalkreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "dingtalkreceivers"} +var dingtalkreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "dingtalkreceivers"} -var dingtalkreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "DingTalkReceiver"} +var dingtalkreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "DingTalkReceiver"} // Get takes name of the dingTalkReceiver, and returns the corresponding dingTalkReceiver object, and an error if there is any. -func (c *FakeDingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.DingTalkReceiver, err error) { +func (c *FakeDingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(dingtalkreceiversResource, name), &v2.DingTalkReceiver{}) + Invokes(testing.NewRootGetAction(dingtalkreceiversResource, name), &v2alpha1.DingTalkReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkReceiver), err + return obj.(*v2alpha1.DingTalkReceiver), err } // List takes label and field selectors, and returns the list of DingTalkReceivers that match those selectors. -func (c *FakeDingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.DingTalkReceiverList, err error) { +func (c *FakeDingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkReceiverList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(dingtalkreceiversResource, dingtalkreceiversKind, opts), &v2.DingTalkReceiverList{}) + Invokes(testing.NewRootListAction(dingtalkreceiversResource, dingtalkreceiversKind, opts), &v2alpha1.DingTalkReceiverList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeDingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) ( if label == nil { label = labels.Everything() } - list := &v2.DingTalkReceiverList{ListMeta: obj.(*v2.DingTalkReceiverList).ListMeta} - for _, item := range obj.(*v2.DingTalkReceiverList).Items { + list := &v2alpha1.DingTalkReceiverList{ListMeta: obj.(*v2alpha1.DingTalkReceiverList).ListMeta} + for _, item := range obj.(*v2alpha1.DingTalkReceiverList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeDingTalkReceivers) Watch(ctx context.Context, opts v1.ListOptions) } // Create takes the representation of a dingTalkReceiver and creates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *FakeDingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.CreateOptions) (result *v2.DingTalkReceiver, err error) { +func (c *FakeDingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.CreateOptions) (result *v2alpha1.DingTalkReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(dingtalkreceiversResource, dingTalkReceiver), &v2.DingTalkReceiver{}) + Invokes(testing.NewRootCreateAction(dingtalkreceiversResource, dingTalkReceiver), &v2alpha1.DingTalkReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkReceiver), err + return obj.(*v2alpha1.DingTalkReceiver), err } // Update takes the representation of a dingTalkReceiver and updates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *FakeDingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (result *v2.DingTalkReceiver, err error) { +func (c *FakeDingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (result *v2alpha1.DingTalkReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(dingtalkreceiversResource, dingTalkReceiver), &v2.DingTalkReceiver{}) + Invokes(testing.NewRootUpdateAction(dingtalkreceiversResource, dingTalkReceiver), &v2alpha1.DingTalkReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkReceiver), err + return obj.(*v2alpha1.DingTalkReceiver), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2.DingTalkReceiver, opts v1.UpdateOptions) (*v2.DingTalkReceiver, error) { +func (c *FakeDingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (*v2alpha1.DingTalkReceiver, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(dingtalkreceiversResource, "status", dingTalkReceiver), &v2.DingTalkReceiver{}) + Invokes(testing.NewRootUpdateSubresourceAction(dingtalkreceiversResource, "status", dingTalkReceiver), &v2alpha1.DingTalkReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkReceiver), err + return obj.(*v2alpha1.DingTalkReceiver), err } // Delete takes name of the dingTalkReceiver and deletes it. Returns an error if one occurs. func (c *FakeDingTalkReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(dingtalkreceiversResource, name), &v2.DingTalkReceiver{}) + Invokes(testing.NewRootDeleteAction(dingtalkreceiversResource, name), &v2alpha1.DingTalkReceiver{}) return err } @@ -118,16 +118,16 @@ func (c *FakeDingTalkReceivers) Delete(ctx context.Context, name string, opts v1 func (c *FakeDingTalkReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(dingtalkreceiversResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.DingTalkReceiverList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.DingTalkReceiverList{}) return err } // Patch applies the patch and returns the patched dingTalkReceiver. -func (c *FakeDingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.DingTalkReceiver, err error) { +func (c *FakeDingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(dingtalkreceiversResource, name, pt, data, subresources...), &v2.DingTalkReceiver{}) + Invokes(testing.NewRootPatchSubresourceAction(dingtalkreceiversResource, name, pt, data, subresources...), &v2alpha1.DingTalkReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.DingTalkReceiver), err + return obj.(*v2alpha1.DingTalkReceiver), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailconfig.go similarity index 74% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailconfig.go index 54c7c513c..c0fd91fb3 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailconfig.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeEmailConfigs implements EmailConfigInterface type FakeEmailConfigs struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var emailconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "emailconfigs"} +var emailconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "emailconfigs"} -var emailconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "EmailConfig"} +var emailconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "EmailConfig"} // Get takes name of the emailConfig, and returns the corresponding emailConfig object, and an error if there is any. -func (c *FakeEmailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailConfig, err error) { +func (c *FakeEmailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(emailconfigsResource, name), &v2.EmailConfig{}) + Invokes(testing.NewRootGetAction(emailconfigsResource, name), &v2alpha1.EmailConfig{}) if obj == nil { return nil, err } - return obj.(*v2.EmailConfig), err + return obj.(*v2alpha1.EmailConfig), err } // List takes label and field selectors, and returns the list of EmailConfigs that match those selectors. -func (c *FakeEmailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailConfigList, err error) { +func (c *FakeEmailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailConfigList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(emailconfigsResource, emailconfigsKind, opts), &v2.EmailConfigList{}) + Invokes(testing.NewRootListAction(emailconfigsResource, emailconfigsKind, opts), &v2alpha1.EmailConfigList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeEmailConfigs) List(ctx context.Context, opts v1.ListOptions) (resul if label == nil { label = labels.Everything() } - list := &v2.EmailConfigList{ListMeta: obj.(*v2.EmailConfigList).ListMeta} - for _, item := range obj.(*v2.EmailConfigList).Items { + list := &v2alpha1.EmailConfigList{ListMeta: obj.(*v2alpha1.EmailConfigList).ListMeta} + for _, item := range obj.(*v2alpha1.EmailConfigList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeEmailConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watc } // Create takes the representation of a emailConfig and creates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *FakeEmailConfigs) Create(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.CreateOptions) (result *v2.EmailConfig, err error) { +func (c *FakeEmailConfigs) Create(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.CreateOptions) (result *v2alpha1.EmailConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(emailconfigsResource, emailConfig), &v2.EmailConfig{}) + Invokes(testing.NewRootCreateAction(emailconfigsResource, emailConfig), &v2alpha1.EmailConfig{}) if obj == nil { return nil, err } - return obj.(*v2.EmailConfig), err + return obj.(*v2alpha1.EmailConfig), err } // Update takes the representation of a emailConfig and updates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *FakeEmailConfigs) Update(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (result *v2.EmailConfig, err error) { +func (c *FakeEmailConfigs) Update(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (result *v2alpha1.EmailConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(emailconfigsResource, emailConfig), &v2.EmailConfig{}) + Invokes(testing.NewRootUpdateAction(emailconfigsResource, emailConfig), &v2alpha1.EmailConfig{}) if obj == nil { return nil, err } - return obj.(*v2.EmailConfig), err + return obj.(*v2alpha1.EmailConfig), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeEmailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2.EmailConfig, opts v1.UpdateOptions) (*v2.EmailConfig, error) { +func (c *FakeEmailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (*v2alpha1.EmailConfig, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(emailconfigsResource, "status", emailConfig), &v2.EmailConfig{}) + Invokes(testing.NewRootUpdateSubresourceAction(emailconfigsResource, "status", emailConfig), &v2alpha1.EmailConfig{}) if obj == nil { return nil, err } - return obj.(*v2.EmailConfig), err + return obj.(*v2alpha1.EmailConfig), err } // Delete takes name of the emailConfig and deletes it. Returns an error if one occurs. func (c *FakeEmailConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(emailconfigsResource, name), &v2.EmailConfig{}) + Invokes(testing.NewRootDeleteAction(emailconfigsResource, name), &v2alpha1.EmailConfig{}) return err } @@ -118,16 +118,16 @@ func (c *FakeEmailConfigs) Delete(ctx context.Context, name string, opts v1.Dele func (c *FakeEmailConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(emailconfigsResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.EmailConfigList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.EmailConfigList{}) return err } // Patch applies the patch and returns the patched emailConfig. -func (c *FakeEmailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailConfig, err error) { +func (c *FakeEmailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(emailconfigsResource, name, pt, data, subresources...), &v2.EmailConfig{}) + Invokes(testing.NewRootPatchSubresourceAction(emailconfigsResource, name, pt, data, subresources...), &v2alpha1.EmailConfig{}) if obj == nil { return nil, err } - return obj.(*v2.EmailConfig), err + return obj.(*v2alpha1.EmailConfig), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailreceiver.go similarity index 73% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailreceiver.go index a4fd51cc9..e86ff71a1 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_emailreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailreceiver.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeEmailReceivers implements EmailReceiverInterface type FakeEmailReceivers struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var emailreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "emailreceivers"} +var emailreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "emailreceivers"} -var emailreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "EmailReceiver"} +var emailreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "EmailReceiver"} // Get takes name of the emailReceiver, and returns the corresponding emailReceiver object, and an error if there is any. -func (c *FakeEmailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.EmailReceiver, err error) { +func (c *FakeEmailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(emailreceiversResource, name), &v2.EmailReceiver{}) + Invokes(testing.NewRootGetAction(emailreceiversResource, name), &v2alpha1.EmailReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.EmailReceiver), err + return obj.(*v2alpha1.EmailReceiver), err } // List takes label and field selectors, and returns the list of EmailReceivers that match those selectors. -func (c *FakeEmailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.EmailReceiverList, err error) { +func (c *FakeEmailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailReceiverList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(emailreceiversResource, emailreceiversKind, opts), &v2.EmailReceiverList{}) + Invokes(testing.NewRootListAction(emailreceiversResource, emailreceiversKind, opts), &v2alpha1.EmailReceiverList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeEmailReceivers) List(ctx context.Context, opts v1.ListOptions) (res if label == nil { label = labels.Everything() } - list := &v2.EmailReceiverList{ListMeta: obj.(*v2.EmailReceiverList).ListMeta} - for _, item := range obj.(*v2.EmailReceiverList).Items { + list := &v2alpha1.EmailReceiverList{ListMeta: obj.(*v2alpha1.EmailReceiverList).ListMeta} + for _, item := range obj.(*v2alpha1.EmailReceiverList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeEmailReceivers) Watch(ctx context.Context, opts v1.ListOptions) (wa } // Create takes the representation of a emailReceiver and creates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *FakeEmailReceivers) Create(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.CreateOptions) (result *v2.EmailReceiver, err error) { +func (c *FakeEmailReceivers) Create(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.CreateOptions) (result *v2alpha1.EmailReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(emailreceiversResource, emailReceiver), &v2.EmailReceiver{}) + Invokes(testing.NewRootCreateAction(emailreceiversResource, emailReceiver), &v2alpha1.EmailReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.EmailReceiver), err + return obj.(*v2alpha1.EmailReceiver), err } // Update takes the representation of a emailReceiver and updates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *FakeEmailReceivers) Update(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (result *v2.EmailReceiver, err error) { +func (c *FakeEmailReceivers) Update(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (result *v2alpha1.EmailReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(emailreceiversResource, emailReceiver), &v2.EmailReceiver{}) + Invokes(testing.NewRootUpdateAction(emailreceiversResource, emailReceiver), &v2alpha1.EmailReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.EmailReceiver), err + return obj.(*v2alpha1.EmailReceiver), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeEmailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2.EmailReceiver, opts v1.UpdateOptions) (*v2.EmailReceiver, error) { +func (c *FakeEmailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (*v2alpha1.EmailReceiver, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(emailreceiversResource, "status", emailReceiver), &v2.EmailReceiver{}) + Invokes(testing.NewRootUpdateSubresourceAction(emailreceiversResource, "status", emailReceiver), &v2alpha1.EmailReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.EmailReceiver), err + return obj.(*v2alpha1.EmailReceiver), err } // Delete takes name of the emailReceiver and deletes it. Returns an error if one occurs. func (c *FakeEmailReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(emailreceiversResource, name), &v2.EmailReceiver{}) + Invokes(testing.NewRootDeleteAction(emailreceiversResource, name), &v2alpha1.EmailReceiver{}) return err } @@ -118,16 +118,16 @@ func (c *FakeEmailReceivers) Delete(ctx context.Context, name string, opts v1.De func (c *FakeEmailReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(emailreceiversResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.EmailReceiverList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.EmailReceiverList{}) return err } // Patch applies the patch and returns the patched emailReceiver. -func (c *FakeEmailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.EmailReceiver, err error) { +func (c *FakeEmailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(emailreceiversResource, name, pt, data, subresources...), &v2.EmailReceiver{}) + Invokes(testing.NewRootPatchSubresourceAction(emailreceiversResource, name, pt, data, subresources...), &v2alpha1.EmailReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.EmailReceiver), err + return obj.(*v2alpha1.EmailReceiver), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_notification_client.go similarity index 53% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_notification_client.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_notification_client.go index eeb60aec4..cbab6a87a 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_notification_client.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_notification_client.go @@ -21,56 +21,56 @@ package fake import ( rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1" ) -type FakeNotificationV2 struct { +type FakeNotificationV2alpha1 struct { *testing.Fake } -func (c *FakeNotificationV2) DingTalkConfigs() v2.DingTalkConfigInterface { +func (c *FakeNotificationV2alpha1) DingTalkConfigs() v2alpha1.DingTalkConfigInterface { return &FakeDingTalkConfigs{c} } -func (c *FakeNotificationV2) DingTalkReceivers() v2.DingTalkReceiverInterface { +func (c *FakeNotificationV2alpha1) DingTalkReceivers() v2alpha1.DingTalkReceiverInterface { return &FakeDingTalkReceivers{c} } -func (c *FakeNotificationV2) EmailConfigs() v2.EmailConfigInterface { +func (c *FakeNotificationV2alpha1) EmailConfigs() v2alpha1.EmailConfigInterface { return &FakeEmailConfigs{c} } -func (c *FakeNotificationV2) EmailReceivers() v2.EmailReceiverInterface { +func (c *FakeNotificationV2alpha1) EmailReceivers() v2alpha1.EmailReceiverInterface { return &FakeEmailReceivers{c} } -func (c *FakeNotificationV2) SlackConfigs() v2.SlackConfigInterface { +func (c *FakeNotificationV2alpha1) SlackConfigs() v2alpha1.SlackConfigInterface { return &FakeSlackConfigs{c} } -func (c *FakeNotificationV2) SlackReceivers() v2.SlackReceiverInterface { +func (c *FakeNotificationV2alpha1) SlackReceivers() v2alpha1.SlackReceiverInterface { return &FakeSlackReceivers{c} } -func (c *FakeNotificationV2) WebhookConfigs() v2.WebhookConfigInterface { +func (c *FakeNotificationV2alpha1) WebhookConfigs() v2alpha1.WebhookConfigInterface { return &FakeWebhookConfigs{c} } -func (c *FakeNotificationV2) WebhookReceivers() v2.WebhookReceiverInterface { +func (c *FakeNotificationV2alpha1) WebhookReceivers() v2alpha1.WebhookReceiverInterface { return &FakeWebhookReceivers{c} } -func (c *FakeNotificationV2) WechatConfigs() v2.WechatConfigInterface { +func (c *FakeNotificationV2alpha1) WechatConfigs() v2alpha1.WechatConfigInterface { return &FakeWechatConfigs{c} } -func (c *FakeNotificationV2) WechatReceivers() v2.WechatReceiverInterface { +func (c *FakeNotificationV2alpha1) WechatReceivers() v2alpha1.WechatReceiverInterface { return &FakeWechatReceivers{c} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeNotificationV2) RESTClient() rest.Interface { +func (c *FakeNotificationV2alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackconfig.go similarity index 74% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackconfig.go index 605bb2d4b..ebcde2272 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackconfig.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeSlackConfigs implements SlackConfigInterface type FakeSlackConfigs struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var slackconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "slackconfigs"} +var slackconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "slackconfigs"} -var slackconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "SlackConfig"} +var slackconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "SlackConfig"} // Get takes name of the slackConfig, and returns the corresponding slackConfig object, and an error if there is any. -func (c *FakeSlackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackConfig, err error) { +func (c *FakeSlackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(slackconfigsResource, name), &v2.SlackConfig{}) + Invokes(testing.NewRootGetAction(slackconfigsResource, name), &v2alpha1.SlackConfig{}) if obj == nil { return nil, err } - return obj.(*v2.SlackConfig), err + return obj.(*v2alpha1.SlackConfig), err } // List takes label and field selectors, and returns the list of SlackConfigs that match those selectors. -func (c *FakeSlackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackConfigList, err error) { +func (c *FakeSlackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackConfigList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(slackconfigsResource, slackconfigsKind, opts), &v2.SlackConfigList{}) + Invokes(testing.NewRootListAction(slackconfigsResource, slackconfigsKind, opts), &v2alpha1.SlackConfigList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeSlackConfigs) List(ctx context.Context, opts v1.ListOptions) (resul if label == nil { label = labels.Everything() } - list := &v2.SlackConfigList{ListMeta: obj.(*v2.SlackConfigList).ListMeta} - for _, item := range obj.(*v2.SlackConfigList).Items { + list := &v2alpha1.SlackConfigList{ListMeta: obj.(*v2alpha1.SlackConfigList).ListMeta} + for _, item := range obj.(*v2alpha1.SlackConfigList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeSlackConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watc } // Create takes the representation of a slackConfig and creates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *FakeSlackConfigs) Create(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.CreateOptions) (result *v2.SlackConfig, err error) { +func (c *FakeSlackConfigs) Create(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.CreateOptions) (result *v2alpha1.SlackConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(slackconfigsResource, slackConfig), &v2.SlackConfig{}) + Invokes(testing.NewRootCreateAction(slackconfigsResource, slackConfig), &v2alpha1.SlackConfig{}) if obj == nil { return nil, err } - return obj.(*v2.SlackConfig), err + return obj.(*v2alpha1.SlackConfig), err } // Update takes the representation of a slackConfig and updates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *FakeSlackConfigs) Update(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (result *v2.SlackConfig, err error) { +func (c *FakeSlackConfigs) Update(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (result *v2alpha1.SlackConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(slackconfigsResource, slackConfig), &v2.SlackConfig{}) + Invokes(testing.NewRootUpdateAction(slackconfigsResource, slackConfig), &v2alpha1.SlackConfig{}) if obj == nil { return nil, err } - return obj.(*v2.SlackConfig), err + return obj.(*v2alpha1.SlackConfig), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSlackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (*v2.SlackConfig, error) { +func (c *FakeSlackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (*v2alpha1.SlackConfig, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(slackconfigsResource, "status", slackConfig), &v2.SlackConfig{}) + Invokes(testing.NewRootUpdateSubresourceAction(slackconfigsResource, "status", slackConfig), &v2alpha1.SlackConfig{}) if obj == nil { return nil, err } - return obj.(*v2.SlackConfig), err + return obj.(*v2alpha1.SlackConfig), err } // Delete takes name of the slackConfig and deletes it. Returns an error if one occurs. func (c *FakeSlackConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(slackconfigsResource, name), &v2.SlackConfig{}) + Invokes(testing.NewRootDeleteAction(slackconfigsResource, name), &v2alpha1.SlackConfig{}) return err } @@ -118,16 +118,16 @@ func (c *FakeSlackConfigs) Delete(ctx context.Context, name string, opts v1.Dele func (c *FakeSlackConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(slackconfigsResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.SlackConfigList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.SlackConfigList{}) return err } // Patch applies the patch and returns the patched slackConfig. -func (c *FakeSlackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackConfig, err error) { +func (c *FakeSlackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(slackconfigsResource, name, pt, data, subresources...), &v2.SlackConfig{}) + Invokes(testing.NewRootPatchSubresourceAction(slackconfigsResource, name, pt, data, subresources...), &v2alpha1.SlackConfig{}) if obj == nil { return nil, err } - return obj.(*v2.SlackConfig), err + return obj.(*v2alpha1.SlackConfig), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackreceiver.go similarity index 73% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackreceiver.go index eccd89388..dabac3b2e 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_slackreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackreceiver.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeSlackReceivers implements SlackReceiverInterface type FakeSlackReceivers struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var slackreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "slackreceivers"} +var slackreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "slackreceivers"} -var slackreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "SlackReceiver"} +var slackreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "SlackReceiver"} // Get takes name of the slackReceiver, and returns the corresponding slackReceiver object, and an error if there is any. -func (c *FakeSlackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackReceiver, err error) { +func (c *FakeSlackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(slackreceiversResource, name), &v2.SlackReceiver{}) + Invokes(testing.NewRootGetAction(slackreceiversResource, name), &v2alpha1.SlackReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.SlackReceiver), err + return obj.(*v2alpha1.SlackReceiver), err } // List takes label and field selectors, and returns the list of SlackReceivers that match those selectors. -func (c *FakeSlackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackReceiverList, err error) { +func (c *FakeSlackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackReceiverList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(slackreceiversResource, slackreceiversKind, opts), &v2.SlackReceiverList{}) + Invokes(testing.NewRootListAction(slackreceiversResource, slackreceiversKind, opts), &v2alpha1.SlackReceiverList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeSlackReceivers) List(ctx context.Context, opts v1.ListOptions) (res if label == nil { label = labels.Everything() } - list := &v2.SlackReceiverList{ListMeta: obj.(*v2.SlackReceiverList).ListMeta} - for _, item := range obj.(*v2.SlackReceiverList).Items { + list := &v2alpha1.SlackReceiverList{ListMeta: obj.(*v2alpha1.SlackReceiverList).ListMeta} + for _, item := range obj.(*v2alpha1.SlackReceiverList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeSlackReceivers) Watch(ctx context.Context, opts v1.ListOptions) (wa } // Create takes the representation of a slackReceiver and creates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *FakeSlackReceivers) Create(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.CreateOptions) (result *v2.SlackReceiver, err error) { +func (c *FakeSlackReceivers) Create(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.CreateOptions) (result *v2alpha1.SlackReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(slackreceiversResource, slackReceiver), &v2.SlackReceiver{}) + Invokes(testing.NewRootCreateAction(slackreceiversResource, slackReceiver), &v2alpha1.SlackReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.SlackReceiver), err + return obj.(*v2alpha1.SlackReceiver), err } // Update takes the representation of a slackReceiver and updates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *FakeSlackReceivers) Update(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (result *v2.SlackReceiver, err error) { +func (c *FakeSlackReceivers) Update(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (result *v2alpha1.SlackReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(slackreceiversResource, slackReceiver), &v2.SlackReceiver{}) + Invokes(testing.NewRootUpdateAction(slackreceiversResource, slackReceiver), &v2alpha1.SlackReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.SlackReceiver), err + return obj.(*v2alpha1.SlackReceiver), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSlackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (*v2.SlackReceiver, error) { +func (c *FakeSlackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (*v2alpha1.SlackReceiver, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(slackreceiversResource, "status", slackReceiver), &v2.SlackReceiver{}) + Invokes(testing.NewRootUpdateSubresourceAction(slackreceiversResource, "status", slackReceiver), &v2alpha1.SlackReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.SlackReceiver), err + return obj.(*v2alpha1.SlackReceiver), err } // Delete takes name of the slackReceiver and deletes it. Returns an error if one occurs. func (c *FakeSlackReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(slackreceiversResource, name), &v2.SlackReceiver{}) + Invokes(testing.NewRootDeleteAction(slackreceiversResource, name), &v2alpha1.SlackReceiver{}) return err } @@ -118,16 +118,16 @@ func (c *FakeSlackReceivers) Delete(ctx context.Context, name string, opts v1.De func (c *FakeSlackReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(slackreceiversResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.SlackReceiverList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.SlackReceiverList{}) return err } // Patch applies the patch and returns the patched slackReceiver. -func (c *FakeSlackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackReceiver, err error) { +func (c *FakeSlackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(slackreceiversResource, name, pt, data, subresources...), &v2.SlackReceiver{}) + Invokes(testing.NewRootPatchSubresourceAction(slackreceiversResource, name, pt, data, subresources...), &v2alpha1.SlackReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.SlackReceiver), err + return obj.(*v2alpha1.SlackReceiver), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookconfig.go similarity index 73% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookconfig.go index 750577235..9a2de967d 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookconfig.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeWebhookConfigs implements WebhookConfigInterface type FakeWebhookConfigs struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var webhookconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "webhookconfigs"} +var webhookconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "webhookconfigs"} -var webhookconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WebhookConfig"} +var webhookconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WebhookConfig"} // Get takes name of the webhookConfig, and returns the corresponding webhookConfig object, and an error if there is any. -func (c *FakeWebhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookConfig, err error) { +func (c *FakeWebhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(webhookconfigsResource, name), &v2.WebhookConfig{}) + Invokes(testing.NewRootGetAction(webhookconfigsResource, name), &v2alpha1.WebhookConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookConfig), err + return obj.(*v2alpha1.WebhookConfig), err } // List takes label and field selectors, and returns the list of WebhookConfigs that match those selectors. -func (c *FakeWebhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookConfigList, err error) { +func (c *FakeWebhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookConfigList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(webhookconfigsResource, webhookconfigsKind, opts), &v2.WebhookConfigList{}) + Invokes(testing.NewRootListAction(webhookconfigsResource, webhookconfigsKind, opts), &v2alpha1.WebhookConfigList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeWebhookConfigs) List(ctx context.Context, opts v1.ListOptions) (res if label == nil { label = labels.Everything() } - list := &v2.WebhookConfigList{ListMeta: obj.(*v2.WebhookConfigList).ListMeta} - for _, item := range obj.(*v2.WebhookConfigList).Items { + list := &v2alpha1.WebhookConfigList{ListMeta: obj.(*v2alpha1.WebhookConfigList).ListMeta} + for _, item := range obj.(*v2alpha1.WebhookConfigList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeWebhookConfigs) Watch(ctx context.Context, opts v1.ListOptions) (wa } // Create takes the representation of a webhookConfig and creates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *FakeWebhookConfigs) Create(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.CreateOptions) (result *v2.WebhookConfig, err error) { +func (c *FakeWebhookConfigs) Create(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.CreateOptions) (result *v2alpha1.WebhookConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(webhookconfigsResource, webhookConfig), &v2.WebhookConfig{}) + Invokes(testing.NewRootCreateAction(webhookconfigsResource, webhookConfig), &v2alpha1.WebhookConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookConfig), err + return obj.(*v2alpha1.WebhookConfig), err } // Update takes the representation of a webhookConfig and updates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *FakeWebhookConfigs) Update(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (result *v2.WebhookConfig, err error) { +func (c *FakeWebhookConfigs) Update(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (result *v2alpha1.WebhookConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(webhookconfigsResource, webhookConfig), &v2.WebhookConfig{}) + Invokes(testing.NewRootUpdateAction(webhookconfigsResource, webhookConfig), &v2alpha1.WebhookConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookConfig), err + return obj.(*v2alpha1.WebhookConfig), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWebhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (*v2.WebhookConfig, error) { +func (c *FakeWebhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (*v2alpha1.WebhookConfig, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(webhookconfigsResource, "status", webhookConfig), &v2.WebhookConfig{}) + Invokes(testing.NewRootUpdateSubresourceAction(webhookconfigsResource, "status", webhookConfig), &v2alpha1.WebhookConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookConfig), err + return obj.(*v2alpha1.WebhookConfig), err } // Delete takes name of the webhookConfig and deletes it. Returns an error if one occurs. func (c *FakeWebhookConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(webhookconfigsResource, name), &v2.WebhookConfig{}) + Invokes(testing.NewRootDeleteAction(webhookconfigsResource, name), &v2alpha1.WebhookConfig{}) return err } @@ -118,16 +118,16 @@ func (c *FakeWebhookConfigs) Delete(ctx context.Context, name string, opts v1.De func (c *FakeWebhookConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(webhookconfigsResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.WebhookConfigList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.WebhookConfigList{}) return err } // Patch applies the patch and returns the patched webhookConfig. -func (c *FakeWebhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookConfig, err error) { +func (c *FakeWebhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(webhookconfigsResource, name, pt, data, subresources...), &v2.WebhookConfig{}) + Invokes(testing.NewRootPatchSubresourceAction(webhookconfigsResource, name, pt, data, subresources...), &v2alpha1.WebhookConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookConfig), err + return obj.(*v2alpha1.WebhookConfig), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookreceiver.go similarity index 72% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookreceiver.go index ae59dd3db..09ebc2534 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_webhookreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookreceiver.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeWebhookReceivers implements WebhookReceiverInterface type FakeWebhookReceivers struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var webhookreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "webhookreceivers"} +var webhookreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "webhookreceivers"} -var webhookreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WebhookReceiver"} +var webhookreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WebhookReceiver"} // Get takes name of the webhookReceiver, and returns the corresponding webhookReceiver object, and an error if there is any. -func (c *FakeWebhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookReceiver, err error) { +func (c *FakeWebhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(webhookreceiversResource, name), &v2.WebhookReceiver{}) + Invokes(testing.NewRootGetAction(webhookreceiversResource, name), &v2alpha1.WebhookReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookReceiver), err + return obj.(*v2alpha1.WebhookReceiver), err } // List takes label and field selectors, and returns the list of WebhookReceivers that match those selectors. -func (c *FakeWebhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookReceiverList, err error) { +func (c *FakeWebhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookReceiverList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(webhookreceiversResource, webhookreceiversKind, opts), &v2.WebhookReceiverList{}) + Invokes(testing.NewRootListAction(webhookreceiversResource, webhookreceiversKind, opts), &v2alpha1.WebhookReceiverList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeWebhookReceivers) List(ctx context.Context, opts v1.ListOptions) (r if label == nil { label = labels.Everything() } - list := &v2.WebhookReceiverList{ListMeta: obj.(*v2.WebhookReceiverList).ListMeta} - for _, item := range obj.(*v2.WebhookReceiverList).Items { + list := &v2alpha1.WebhookReceiverList{ListMeta: obj.(*v2alpha1.WebhookReceiverList).ListMeta} + for _, item := range obj.(*v2alpha1.WebhookReceiverList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeWebhookReceivers) Watch(ctx context.Context, opts v1.ListOptions) ( } // Create takes the representation of a webhookReceiver and creates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *FakeWebhookReceivers) Create(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.CreateOptions) (result *v2.WebhookReceiver, err error) { +func (c *FakeWebhookReceivers) Create(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.CreateOptions) (result *v2alpha1.WebhookReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(webhookreceiversResource, webhookReceiver), &v2.WebhookReceiver{}) + Invokes(testing.NewRootCreateAction(webhookreceiversResource, webhookReceiver), &v2alpha1.WebhookReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookReceiver), err + return obj.(*v2alpha1.WebhookReceiver), err } // Update takes the representation of a webhookReceiver and updates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *FakeWebhookReceivers) Update(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (result *v2.WebhookReceiver, err error) { +func (c *FakeWebhookReceivers) Update(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (result *v2alpha1.WebhookReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(webhookreceiversResource, webhookReceiver), &v2.WebhookReceiver{}) + Invokes(testing.NewRootUpdateAction(webhookreceiversResource, webhookReceiver), &v2alpha1.WebhookReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookReceiver), err + return obj.(*v2alpha1.WebhookReceiver), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWebhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (*v2.WebhookReceiver, error) { +func (c *FakeWebhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (*v2alpha1.WebhookReceiver, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(webhookreceiversResource, "status", webhookReceiver), &v2.WebhookReceiver{}) + Invokes(testing.NewRootUpdateSubresourceAction(webhookreceiversResource, "status", webhookReceiver), &v2alpha1.WebhookReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookReceiver), err + return obj.(*v2alpha1.WebhookReceiver), err } // Delete takes name of the webhookReceiver and deletes it. Returns an error if one occurs. func (c *FakeWebhookReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(webhookreceiversResource, name), &v2.WebhookReceiver{}) + Invokes(testing.NewRootDeleteAction(webhookreceiversResource, name), &v2alpha1.WebhookReceiver{}) return err } @@ -118,16 +118,16 @@ func (c *FakeWebhookReceivers) Delete(ctx context.Context, name string, opts v1. func (c *FakeWebhookReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(webhookreceiversResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.WebhookReceiverList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.WebhookReceiverList{}) return err } // Patch applies the patch and returns the patched webhookReceiver. -func (c *FakeWebhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookReceiver, err error) { +func (c *FakeWebhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(webhookreceiversResource, name, pt, data, subresources...), &v2.WebhookReceiver{}) + Invokes(testing.NewRootPatchSubresourceAction(webhookreceiversResource, name, pt, data, subresources...), &v2alpha1.WebhookReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WebhookReceiver), err + return obj.(*v2alpha1.WebhookReceiver), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatconfig.go similarity index 73% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatconfig.go index a30069674..63a2d694a 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatconfig.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeWechatConfigs implements WechatConfigInterface type FakeWechatConfigs struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var wechatconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "wechatconfigs"} +var wechatconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "wechatconfigs"} -var wechatconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WechatConfig"} +var wechatconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WechatConfig"} // Get takes name of the wechatConfig, and returns the corresponding wechatConfig object, and an error if there is any. -func (c *FakeWechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatConfig, err error) { +func (c *FakeWechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(wechatconfigsResource, name), &v2.WechatConfig{}) + Invokes(testing.NewRootGetAction(wechatconfigsResource, name), &v2alpha1.WechatConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WechatConfig), err + return obj.(*v2alpha1.WechatConfig), err } // List takes label and field selectors, and returns the list of WechatConfigs that match those selectors. -func (c *FakeWechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatConfigList, err error) { +func (c *FakeWechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatConfigList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(wechatconfigsResource, wechatconfigsKind, opts), &v2.WechatConfigList{}) + Invokes(testing.NewRootListAction(wechatconfigsResource, wechatconfigsKind, opts), &v2alpha1.WechatConfigList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeWechatConfigs) List(ctx context.Context, opts v1.ListOptions) (resu if label == nil { label = labels.Everything() } - list := &v2.WechatConfigList{ListMeta: obj.(*v2.WechatConfigList).ListMeta} - for _, item := range obj.(*v2.WechatConfigList).Items { + list := &v2alpha1.WechatConfigList{ListMeta: obj.(*v2alpha1.WechatConfigList).ListMeta} + for _, item := range obj.(*v2alpha1.WechatConfigList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeWechatConfigs) Watch(ctx context.Context, opts v1.ListOptions) (wat } // Create takes the representation of a wechatConfig and creates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *FakeWechatConfigs) Create(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.CreateOptions) (result *v2.WechatConfig, err error) { +func (c *FakeWechatConfigs) Create(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.CreateOptions) (result *v2alpha1.WechatConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(wechatconfigsResource, wechatConfig), &v2.WechatConfig{}) + Invokes(testing.NewRootCreateAction(wechatconfigsResource, wechatConfig), &v2alpha1.WechatConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WechatConfig), err + return obj.(*v2alpha1.WechatConfig), err } // Update takes the representation of a wechatConfig and updates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *FakeWechatConfigs) Update(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (result *v2.WechatConfig, err error) { +func (c *FakeWechatConfigs) Update(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (result *v2alpha1.WechatConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(wechatconfigsResource, wechatConfig), &v2.WechatConfig{}) + Invokes(testing.NewRootUpdateAction(wechatconfigsResource, wechatConfig), &v2alpha1.WechatConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WechatConfig), err + return obj.(*v2alpha1.WechatConfig), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (*v2.WechatConfig, error) { +func (c *FakeWechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (*v2alpha1.WechatConfig, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(wechatconfigsResource, "status", wechatConfig), &v2.WechatConfig{}) + Invokes(testing.NewRootUpdateSubresourceAction(wechatconfigsResource, "status", wechatConfig), &v2alpha1.WechatConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WechatConfig), err + return obj.(*v2alpha1.WechatConfig), err } // Delete takes name of the wechatConfig and deletes it. Returns an error if one occurs. func (c *FakeWechatConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(wechatconfigsResource, name), &v2.WechatConfig{}) + Invokes(testing.NewRootDeleteAction(wechatconfigsResource, name), &v2alpha1.WechatConfig{}) return err } @@ -118,16 +118,16 @@ func (c *FakeWechatConfigs) Delete(ctx context.Context, name string, opts v1.Del func (c *FakeWechatConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(wechatconfigsResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.WechatConfigList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.WechatConfigList{}) return err } // Patch applies the patch and returns the patched wechatConfig. -func (c *FakeWechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatConfig, err error) { +func (c *FakeWechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatConfig, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(wechatconfigsResource, name, pt, data, subresources...), &v2.WechatConfig{}) + Invokes(testing.NewRootPatchSubresourceAction(wechatconfigsResource, name, pt, data, subresources...), &v2alpha1.WechatConfig{}) if obj == nil { return nil, err } - return obj.(*v2.WechatConfig), err + return obj.(*v2alpha1.WechatConfig), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatreceiver.go similarity index 72% rename from pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatreceiver.go index e337b10a5..775d4803c 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/fake/fake_wechatreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatreceiver.go @@ -27,32 +27,32 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // FakeWechatReceivers implements WechatReceiverInterface type FakeWechatReceivers struct { - Fake *FakeNotificationV2 + Fake *FakeNotificationV2alpha1 } -var wechatreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2", Resource: "wechatreceivers"} +var wechatreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "wechatreceivers"} -var wechatreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2", Kind: "WechatReceiver"} +var wechatreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WechatReceiver"} // Get takes name of the wechatReceiver, and returns the corresponding wechatReceiver object, and an error if there is any. -func (c *FakeWechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatReceiver, err error) { +func (c *FakeWechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootGetAction(wechatreceiversResource, name), &v2.WechatReceiver{}) + Invokes(testing.NewRootGetAction(wechatreceiversResource, name), &v2alpha1.WechatReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WechatReceiver), err + return obj.(*v2alpha1.WechatReceiver), err } // List takes label and field selectors, and returns the list of WechatReceivers that match those selectors. -func (c *FakeWechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatReceiverList, err error) { +func (c *FakeWechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatReceiverList, err error) { obj, err := c.Fake. - Invokes(testing.NewRootListAction(wechatreceiversResource, wechatreceiversKind, opts), &v2.WechatReceiverList{}) + Invokes(testing.NewRootListAction(wechatreceiversResource, wechatreceiversKind, opts), &v2alpha1.WechatReceiverList{}) if obj == nil { return nil, err } @@ -61,8 +61,8 @@ func (c *FakeWechatReceivers) List(ctx context.Context, opts v1.ListOptions) (re if label == nil { label = labels.Everything() } - list := &v2.WechatReceiverList{ListMeta: obj.(*v2.WechatReceiverList).ListMeta} - for _, item := range obj.(*v2.WechatReceiverList).Items { + list := &v2alpha1.WechatReceiverList{ListMeta: obj.(*v2alpha1.WechatReceiverList).ListMeta} + for _, item := range obj.(*v2alpha1.WechatReceiverList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -77,40 +77,40 @@ func (c *FakeWechatReceivers) Watch(ctx context.Context, opts v1.ListOptions) (w } // Create takes the representation of a wechatReceiver and creates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *FakeWechatReceivers) Create(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.CreateOptions) (result *v2.WechatReceiver, err error) { +func (c *FakeWechatReceivers) Create(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.CreateOptions) (result *v2alpha1.WechatReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(wechatreceiversResource, wechatReceiver), &v2.WechatReceiver{}) + Invokes(testing.NewRootCreateAction(wechatreceiversResource, wechatReceiver), &v2alpha1.WechatReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WechatReceiver), err + return obj.(*v2alpha1.WechatReceiver), err } // Update takes the representation of a wechatReceiver and updates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *FakeWechatReceivers) Update(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (result *v2.WechatReceiver, err error) { +func (c *FakeWechatReceivers) Update(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (result *v2alpha1.WechatReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(wechatreceiversResource, wechatReceiver), &v2.WechatReceiver{}) + Invokes(testing.NewRootUpdateAction(wechatreceiversResource, wechatReceiver), &v2alpha1.WechatReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WechatReceiver), err + return obj.(*v2alpha1.WechatReceiver), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (*v2.WechatReceiver, error) { +func (c *FakeWechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (*v2alpha1.WechatReceiver, error) { obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(wechatreceiversResource, "status", wechatReceiver), &v2.WechatReceiver{}) + Invokes(testing.NewRootUpdateSubresourceAction(wechatreceiversResource, "status", wechatReceiver), &v2alpha1.WechatReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WechatReceiver), err + return obj.(*v2alpha1.WechatReceiver), err } // Delete takes name of the wechatReceiver and deletes it. Returns an error if one occurs. func (c *FakeWechatReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(wechatreceiversResource, name), &v2.WechatReceiver{}) + Invokes(testing.NewRootDeleteAction(wechatreceiversResource, name), &v2alpha1.WechatReceiver{}) return err } @@ -118,16 +118,16 @@ func (c *FakeWechatReceivers) Delete(ctx context.Context, name string, opts v1.D func (c *FakeWechatReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(wechatreceiversResource, listOpts) - _, err := c.Fake.Invokes(action, &v2.WechatReceiverList{}) + _, err := c.Fake.Invokes(action, &v2alpha1.WechatReceiverList{}) return err } // Patch applies the patch and returns the patched wechatReceiver. -func (c *FakeWechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatReceiver, err error) { +func (c *FakeWechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatReceiver, err error) { obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(wechatreceiversResource, name, pt, data, subresources...), &v2.WechatReceiver{}) + Invokes(testing.NewRootPatchSubresourceAction(wechatreceiversResource, name, pt, data, subresources...), &v2alpha1.WechatReceiver{}) if obj == nil { return nil, err } - return obj.(*v2.WechatReceiver), err + return obj.(*v2alpha1.WechatReceiver), err } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/generated_expansion.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/generated_expansion.go similarity index 98% rename from pkg/client/clientset/versioned/typed/notification/v2/generated_expansion.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/generated_expansion.go index 37b7f21a9..c13e64d2d 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/generated_expansion.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 type DingTalkConfigExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/notification/v2/notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/notification_client.go similarity index 55% rename from pkg/client/clientset/versioned/typed/notification/v2/notification_client.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/notification_client.go index ac14cb642..418449cb3 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/notification_client.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/notification_client.go @@ -16,15 +16,15 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) -type NotificationV2Interface interface { +type NotificationV2alpha1Interface interface { RESTClient() rest.Interface DingTalkConfigsGetter DingTalkReceiversGetter @@ -38,53 +38,53 @@ type NotificationV2Interface interface { WechatReceiversGetter } -// NotificationV2Client is used to interact with features provided by the notification.kubesphere.io group. -type NotificationV2Client struct { +// NotificationV2alpha1Client is used to interact with features provided by the notification.kubesphere.io group. +type NotificationV2alpha1Client struct { restClient rest.Interface } -func (c *NotificationV2Client) DingTalkConfigs() DingTalkConfigInterface { +func (c *NotificationV2alpha1Client) DingTalkConfigs() DingTalkConfigInterface { return newDingTalkConfigs(c) } -func (c *NotificationV2Client) DingTalkReceivers() DingTalkReceiverInterface { +func (c *NotificationV2alpha1Client) DingTalkReceivers() DingTalkReceiverInterface { return newDingTalkReceivers(c) } -func (c *NotificationV2Client) EmailConfigs() EmailConfigInterface { +func (c *NotificationV2alpha1Client) EmailConfigs() EmailConfigInterface { return newEmailConfigs(c) } -func (c *NotificationV2Client) EmailReceivers() EmailReceiverInterface { +func (c *NotificationV2alpha1Client) EmailReceivers() EmailReceiverInterface { return newEmailReceivers(c) } -func (c *NotificationV2Client) SlackConfigs() SlackConfigInterface { +func (c *NotificationV2alpha1Client) SlackConfigs() SlackConfigInterface { return newSlackConfigs(c) } -func (c *NotificationV2Client) SlackReceivers() SlackReceiverInterface { +func (c *NotificationV2alpha1Client) SlackReceivers() SlackReceiverInterface { return newSlackReceivers(c) } -func (c *NotificationV2Client) WebhookConfigs() WebhookConfigInterface { +func (c *NotificationV2alpha1Client) WebhookConfigs() WebhookConfigInterface { return newWebhookConfigs(c) } -func (c *NotificationV2Client) WebhookReceivers() WebhookReceiverInterface { +func (c *NotificationV2alpha1Client) WebhookReceivers() WebhookReceiverInterface { return newWebhookReceivers(c) } -func (c *NotificationV2Client) WechatConfigs() WechatConfigInterface { +func (c *NotificationV2alpha1Client) WechatConfigs() WechatConfigInterface { return newWechatConfigs(c) } -func (c *NotificationV2Client) WechatReceivers() WechatReceiverInterface { +func (c *NotificationV2alpha1Client) WechatReceivers() WechatReceiverInterface { return newWechatReceivers(c) } -// NewForConfig creates a new NotificationV2Client for the given config. -func NewForConfig(c *rest.Config) (*NotificationV2Client, error) { +// NewForConfig creates a new NotificationV2alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*NotificationV2alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -93,12 +93,12 @@ func NewForConfig(c *rest.Config) (*NotificationV2Client, error) { if err != nil { return nil, err } - return &NotificationV2Client{client}, nil + return &NotificationV2alpha1Client{client}, nil } -// NewForConfigOrDie creates a new NotificationV2Client for the given config and +// NewForConfigOrDie creates a new NotificationV2alpha1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *NotificationV2Client { +func NewForConfigOrDie(c *rest.Config) *NotificationV2alpha1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -106,13 +106,13 @@ func NewForConfigOrDie(c *rest.Config) *NotificationV2Client { return client } -// New creates a new NotificationV2Client for the given RESTClient. -func New(c rest.Interface) *NotificationV2Client { - return &NotificationV2Client{c} +// New creates a new NotificationV2alpha1Client for the given RESTClient. +func New(c rest.Interface) *NotificationV2alpha1Client { + return &NotificationV2alpha1Client{c} } func setConfigDefaults(config *rest.Config) error { - gv := v2.SchemeGroupVersion + gv := v2alpha1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() @@ -126,7 +126,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *NotificationV2Client) RESTClient() rest.Interface { +func (c *NotificationV2alpha1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/client/clientset/versioned/typed/notification/v2/slackconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackconfig.go similarity index 79% rename from pkg/client/clientset/versioned/typed/notification/v2/slackconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/slackconfig.go index c1919a0f0..e75a1029e 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/slackconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type SlackConfigsGetter interface { // SlackConfigInterface has methods to work with SlackConfig resources. type SlackConfigInterface interface { - Create(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.CreateOptions) (*v2.SlackConfig, error) - Update(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (*v2.SlackConfig, error) - UpdateStatus(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (*v2.SlackConfig, error) + Create(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.CreateOptions) (*v2alpha1.SlackConfig, error) + Update(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (*v2alpha1.SlackConfig, error) + UpdateStatus(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (*v2alpha1.SlackConfig, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.SlackConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.SlackConfigList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.SlackConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.SlackConfigList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackConfig, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackConfig, err error) SlackConfigExpansion } @@ -56,15 +56,15 @@ type slackConfigs struct { } // newSlackConfigs returns a SlackConfigs -func newSlackConfigs(c *NotificationV2Client) *slackConfigs { +func newSlackConfigs(c *NotificationV2alpha1Client) *slackConfigs { return &slackConfigs{ client: c.RESTClient(), } } // Get takes name of the slackConfig, and returns the corresponding slackConfig object, and an error if there is any. -func (c *slackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackConfig, err error) { - result = &v2.SlackConfig{} +func (c *slackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackConfig, err error) { + result = &v2alpha1.SlackConfig{} err = c.client.Get(). Resource("slackconfigs"). Name(name). @@ -75,12 +75,12 @@ func (c *slackConfigs) Get(ctx context.Context, name string, options v1.GetOptio } // List takes label and field selectors, and returns the list of SlackConfigs that match those selectors. -func (c *slackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackConfigList, err error) { +func (c *slackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.SlackConfigList{} + result = &v2alpha1.SlackConfigList{} err = c.client.Get(). Resource("slackconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *slackConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.In } // Create takes the representation of a slackConfig and creates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *slackConfigs) Create(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.CreateOptions) (result *v2.SlackConfig, err error) { - result = &v2.SlackConfig{} +func (c *slackConfigs) Create(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.CreateOptions) (result *v2alpha1.SlackConfig, err error) { + result = &v2alpha1.SlackConfig{} err = c.client.Post(). Resource("slackconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *slackConfigs) Create(ctx context.Context, slackConfig *v2.SlackConfig, } // Update takes the representation of a slackConfig and updates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *slackConfigs) Update(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (result *v2.SlackConfig, err error) { - result = &v2.SlackConfig{} +func (c *slackConfigs) Update(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (result *v2alpha1.SlackConfig, err error) { + result = &v2alpha1.SlackConfig{} err = c.client.Put(). Resource("slackconfigs"). Name(slackConfig.Name). @@ -131,8 +131,8 @@ func (c *slackConfigs) Update(ctx context.Context, slackConfig *v2.SlackConfig, // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *slackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2.SlackConfig, opts v1.UpdateOptions) (result *v2.SlackConfig, err error) { - result = &v2.SlackConfig{} +func (c *slackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (result *v2alpha1.SlackConfig, err error) { + result = &v2alpha1.SlackConfig{} err = c.client.Put(). Resource("slackconfigs"). Name(slackConfig.Name). @@ -170,8 +170,8 @@ func (c *slackConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptio } // Patch applies the patch and returns the patched slackConfig. -func (c *slackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackConfig, err error) { - result = &v2.SlackConfig{} +func (c *slackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackConfig, err error) { + result = &v2alpha1.SlackConfig{} err = c.client.Patch(pt). Resource("slackconfigs"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/slackreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackreceiver.go similarity index 79% rename from pkg/client/clientset/versioned/typed/notification/v2/slackreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/slackreceiver.go index 5a280fa3f..78c6ce257 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/slackreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type SlackReceiversGetter interface { // SlackReceiverInterface has methods to work with SlackReceiver resources. type SlackReceiverInterface interface { - Create(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.CreateOptions) (*v2.SlackReceiver, error) - Update(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (*v2.SlackReceiver, error) - UpdateStatus(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (*v2.SlackReceiver, error) + Create(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.CreateOptions) (*v2alpha1.SlackReceiver, error) + Update(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (*v2alpha1.SlackReceiver, error) + UpdateStatus(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (*v2alpha1.SlackReceiver, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.SlackReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.SlackReceiverList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.SlackReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.SlackReceiverList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackReceiver, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackReceiver, err error) SlackReceiverExpansion } @@ -56,15 +56,15 @@ type slackReceivers struct { } // newSlackReceivers returns a SlackReceivers -func newSlackReceivers(c *NotificationV2Client) *slackReceivers { +func newSlackReceivers(c *NotificationV2alpha1Client) *slackReceivers { return &slackReceivers{ client: c.RESTClient(), } } // Get takes name of the slackReceiver, and returns the corresponding slackReceiver object, and an error if there is any. -func (c *slackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.SlackReceiver, err error) { - result = &v2.SlackReceiver{} +func (c *slackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackReceiver, err error) { + result = &v2alpha1.SlackReceiver{} err = c.client.Get(). Resource("slackreceivers"). Name(name). @@ -75,12 +75,12 @@ func (c *slackReceivers) Get(ctx context.Context, name string, options v1.GetOpt } // List takes label and field selectors, and returns the list of SlackReceivers that match those selectors. -func (c *slackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.SlackReceiverList, err error) { +func (c *slackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackReceiverList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.SlackReceiverList{} + result = &v2alpha1.SlackReceiverList{} err = c.client.Get(). Resource("slackreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *slackReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch. } // Create takes the representation of a slackReceiver and creates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *slackReceivers) Create(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.CreateOptions) (result *v2.SlackReceiver, err error) { - result = &v2.SlackReceiver{} +func (c *slackReceivers) Create(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.CreateOptions) (result *v2alpha1.SlackReceiver, err error) { + result = &v2alpha1.SlackReceiver{} err = c.client.Post(). Resource("slackreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *slackReceivers) Create(ctx context.Context, slackReceiver *v2.SlackRece } // Update takes the representation of a slackReceiver and updates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *slackReceivers) Update(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (result *v2.SlackReceiver, err error) { - result = &v2.SlackReceiver{} +func (c *slackReceivers) Update(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (result *v2alpha1.SlackReceiver, err error) { + result = &v2alpha1.SlackReceiver{} err = c.client.Put(). Resource("slackreceivers"). Name(slackReceiver.Name). @@ -131,8 +131,8 @@ func (c *slackReceivers) Update(ctx context.Context, slackReceiver *v2.SlackRece // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *slackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2.SlackReceiver, opts v1.UpdateOptions) (result *v2.SlackReceiver, err error) { - result = &v2.SlackReceiver{} +func (c *slackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (result *v2alpha1.SlackReceiver, err error) { + result = &v2alpha1.SlackReceiver{} err = c.client.Put(). Resource("slackreceivers"). Name(slackReceiver.Name). @@ -170,8 +170,8 @@ func (c *slackReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOpt } // Patch applies the patch and returns the patched slackReceiver. -func (c *slackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.SlackReceiver, err error) { - result = &v2.SlackReceiver{} +func (c *slackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackReceiver, err error) { + result = &v2alpha1.SlackReceiver{} err = c.client.Patch(pt). Resource("slackreceivers"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/webhookconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookconfig.go similarity index 79% rename from pkg/client/clientset/versioned/typed/notification/v2/webhookconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookconfig.go index 6d69cf2e8..80d879cd9 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/webhookconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type WebhookConfigsGetter interface { // WebhookConfigInterface has methods to work with WebhookConfig resources. type WebhookConfigInterface interface { - Create(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.CreateOptions) (*v2.WebhookConfig, error) - Update(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (*v2.WebhookConfig, error) - UpdateStatus(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (*v2.WebhookConfig, error) + Create(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.CreateOptions) (*v2alpha1.WebhookConfig, error) + Update(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (*v2alpha1.WebhookConfig, error) + UpdateStatus(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (*v2alpha1.WebhookConfig, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WebhookConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.WebhookConfigList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WebhookConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WebhookConfigList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookConfig, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookConfig, err error) WebhookConfigExpansion } @@ -56,15 +56,15 @@ type webhookConfigs struct { } // newWebhookConfigs returns a WebhookConfigs -func newWebhookConfigs(c *NotificationV2Client) *webhookConfigs { +func newWebhookConfigs(c *NotificationV2alpha1Client) *webhookConfigs { return &webhookConfigs{ client: c.RESTClient(), } } // Get takes name of the webhookConfig, and returns the corresponding webhookConfig object, and an error if there is any. -func (c *webhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookConfig, err error) { - result = &v2.WebhookConfig{} +func (c *webhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookConfig, err error) { + result = &v2alpha1.WebhookConfig{} err = c.client.Get(). Resource("webhookconfigs"). Name(name). @@ -75,12 +75,12 @@ func (c *webhookConfigs) Get(ctx context.Context, name string, options v1.GetOpt } // List takes label and field selectors, and returns the list of WebhookConfigs that match those selectors. -func (c *webhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookConfigList, err error) { +func (c *webhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.WebhookConfigList{} + result = &v2alpha1.WebhookConfigList{} err = c.client.Get(). Resource("webhookconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *webhookConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch. } // Create takes the representation of a webhookConfig and creates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *webhookConfigs) Create(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.CreateOptions) (result *v2.WebhookConfig, err error) { - result = &v2.WebhookConfig{} +func (c *webhookConfigs) Create(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.CreateOptions) (result *v2alpha1.WebhookConfig, err error) { + result = &v2alpha1.WebhookConfig{} err = c.client.Post(). Resource("webhookconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *webhookConfigs) Create(ctx context.Context, webhookConfig *v2.WebhookCo } // Update takes the representation of a webhookConfig and updates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *webhookConfigs) Update(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (result *v2.WebhookConfig, err error) { - result = &v2.WebhookConfig{} +func (c *webhookConfigs) Update(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (result *v2alpha1.WebhookConfig, err error) { + result = &v2alpha1.WebhookConfig{} err = c.client.Put(). Resource("webhookconfigs"). Name(webhookConfig.Name). @@ -131,8 +131,8 @@ func (c *webhookConfigs) Update(ctx context.Context, webhookConfig *v2.WebhookCo // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *webhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2.WebhookConfig, opts v1.UpdateOptions) (result *v2.WebhookConfig, err error) { - result = &v2.WebhookConfig{} +func (c *webhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (result *v2alpha1.WebhookConfig, err error) { + result = &v2alpha1.WebhookConfig{} err = c.client.Put(). Resource("webhookconfigs"). Name(webhookConfig.Name). @@ -170,8 +170,8 @@ func (c *webhookConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOpt } // Patch applies the patch and returns the patched webhookConfig. -func (c *webhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookConfig, err error) { - result = &v2.WebhookConfig{} +func (c *webhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookConfig, err error) { + result = &v2alpha1.WebhookConfig{} err = c.client.Patch(pt). Resource("webhookconfigs"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/webhookreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookreceiver.go similarity index 79% rename from pkg/client/clientset/versioned/typed/notification/v2/webhookreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookreceiver.go index 9072d03fd..a48ffdf7f 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/webhookreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type WebhookReceiversGetter interface { // WebhookReceiverInterface has methods to work with WebhookReceiver resources. type WebhookReceiverInterface interface { - Create(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.CreateOptions) (*v2.WebhookReceiver, error) - Update(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (*v2.WebhookReceiver, error) - UpdateStatus(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (*v2.WebhookReceiver, error) + Create(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.CreateOptions) (*v2alpha1.WebhookReceiver, error) + Update(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (*v2alpha1.WebhookReceiver, error) + UpdateStatus(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (*v2alpha1.WebhookReceiver, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WebhookReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.WebhookReceiverList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WebhookReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WebhookReceiverList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookReceiver, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookReceiver, err error) WebhookReceiverExpansion } @@ -56,15 +56,15 @@ type webhookReceivers struct { } // newWebhookReceivers returns a WebhookReceivers -func newWebhookReceivers(c *NotificationV2Client) *webhookReceivers { +func newWebhookReceivers(c *NotificationV2alpha1Client) *webhookReceivers { return &webhookReceivers{ client: c.RESTClient(), } } // Get takes name of the webhookReceiver, and returns the corresponding webhookReceiver object, and an error if there is any. -func (c *webhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WebhookReceiver, err error) { - result = &v2.WebhookReceiver{} +func (c *webhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookReceiver, err error) { + result = &v2alpha1.WebhookReceiver{} err = c.client.Get(). Resource("webhookreceivers"). Name(name). @@ -75,12 +75,12 @@ func (c *webhookReceivers) Get(ctx context.Context, name string, options v1.GetO } // List takes label and field selectors, and returns the list of WebhookReceivers that match those selectors. -func (c *webhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WebhookReceiverList, err error) { +func (c *webhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookReceiverList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.WebhookReceiverList{} + result = &v2alpha1.WebhookReceiverList{} err = c.client.Get(). Resource("webhookreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *webhookReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watc } // Create takes the representation of a webhookReceiver and creates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *webhookReceivers) Create(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.CreateOptions) (result *v2.WebhookReceiver, err error) { - result = &v2.WebhookReceiver{} +func (c *webhookReceivers) Create(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.CreateOptions) (result *v2alpha1.WebhookReceiver, err error) { + result = &v2alpha1.WebhookReceiver{} err = c.client.Post(). Resource("webhookreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *webhookReceivers) Create(ctx context.Context, webhookReceiver *v2.Webho } // Update takes the representation of a webhookReceiver and updates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *webhookReceivers) Update(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (result *v2.WebhookReceiver, err error) { - result = &v2.WebhookReceiver{} +func (c *webhookReceivers) Update(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (result *v2alpha1.WebhookReceiver, err error) { + result = &v2alpha1.WebhookReceiver{} err = c.client.Put(). Resource("webhookreceivers"). Name(webhookReceiver.Name). @@ -131,8 +131,8 @@ func (c *webhookReceivers) Update(ctx context.Context, webhookReceiver *v2.Webho // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *webhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2.WebhookReceiver, opts v1.UpdateOptions) (result *v2.WebhookReceiver, err error) { - result = &v2.WebhookReceiver{} +func (c *webhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (result *v2alpha1.WebhookReceiver, err error) { + result = &v2alpha1.WebhookReceiver{} err = c.client.Put(). Resource("webhookreceivers"). Name(webhookReceiver.Name). @@ -170,8 +170,8 @@ func (c *webhookReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteO } // Patch applies the patch and returns the patched webhookReceiver. -func (c *webhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WebhookReceiver, err error) { - result = &v2.WebhookReceiver{} +func (c *webhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookReceiver, err error) { + result = &v2alpha1.WebhookReceiver{} err = c.client.Patch(pt). Resource("webhookreceivers"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/wechatconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatconfig.go similarity index 79% rename from pkg/client/clientset/versioned/typed/notification/v2/wechatconfig.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatconfig.go index e850bc36e..87d393cb8 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/wechatconfig.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type WechatConfigsGetter interface { // WechatConfigInterface has methods to work with WechatConfig resources. type WechatConfigInterface interface { - Create(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.CreateOptions) (*v2.WechatConfig, error) - Update(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (*v2.WechatConfig, error) - UpdateStatus(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (*v2.WechatConfig, error) + Create(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.CreateOptions) (*v2alpha1.WechatConfig, error) + Update(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (*v2alpha1.WechatConfig, error) + UpdateStatus(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (*v2alpha1.WechatConfig, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WechatConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.WechatConfigList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WechatConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WechatConfigList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatConfig, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatConfig, err error) WechatConfigExpansion } @@ -56,15 +56,15 @@ type wechatConfigs struct { } // newWechatConfigs returns a WechatConfigs -func newWechatConfigs(c *NotificationV2Client) *wechatConfigs { +func newWechatConfigs(c *NotificationV2alpha1Client) *wechatConfigs { return &wechatConfigs{ client: c.RESTClient(), } } // Get takes name of the wechatConfig, and returns the corresponding wechatConfig object, and an error if there is any. -func (c *wechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatConfig, err error) { - result = &v2.WechatConfig{} +func (c *wechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatConfig, err error) { + result = &v2alpha1.WechatConfig{} err = c.client.Get(). Resource("wechatconfigs"). Name(name). @@ -75,12 +75,12 @@ func (c *wechatConfigs) Get(ctx context.Context, name string, options v1.GetOpti } // List takes label and field selectors, and returns the list of WechatConfigs that match those selectors. -func (c *wechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatConfigList, err error) { +func (c *wechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatConfigList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.WechatConfigList{} + result = &v2alpha1.WechatConfigList{} err = c.client.Get(). Resource("wechatconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *wechatConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.I } // Create takes the representation of a wechatConfig and creates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *wechatConfigs) Create(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.CreateOptions) (result *v2.WechatConfig, err error) { - result = &v2.WechatConfig{} +func (c *wechatConfigs) Create(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.CreateOptions) (result *v2alpha1.WechatConfig, err error) { + result = &v2alpha1.WechatConfig{} err = c.client.Post(). Resource("wechatconfigs"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *wechatConfigs) Create(ctx context.Context, wechatConfig *v2.WechatConfi } // Update takes the representation of a wechatConfig and updates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *wechatConfigs) Update(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (result *v2.WechatConfig, err error) { - result = &v2.WechatConfig{} +func (c *wechatConfigs) Update(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (result *v2alpha1.WechatConfig, err error) { + result = &v2alpha1.WechatConfig{} err = c.client.Put(). Resource("wechatconfigs"). Name(wechatConfig.Name). @@ -131,8 +131,8 @@ func (c *wechatConfigs) Update(ctx context.Context, wechatConfig *v2.WechatConfi // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *wechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2.WechatConfig, opts v1.UpdateOptions) (result *v2.WechatConfig, err error) { - result = &v2.WechatConfig{} +func (c *wechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (result *v2alpha1.WechatConfig, err error) { + result = &v2alpha1.WechatConfig{} err = c.client.Put(). Resource("wechatconfigs"). Name(wechatConfig.Name). @@ -170,8 +170,8 @@ func (c *wechatConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOpti } // Patch applies the patch and returns the patched wechatConfig. -func (c *wechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatConfig, err error) { - result = &v2.WechatConfig{} +func (c *wechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatConfig, err error) { + result = &v2alpha1.WechatConfig{} err = c.client.Patch(pt). Resource("wechatconfigs"). Name(name). diff --git a/pkg/client/clientset/versioned/typed/notification/v2/wechatreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatreceiver.go similarity index 78% rename from pkg/client/clientset/versioned/typed/notification/v2/wechatreceiver.go rename to pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatreceiver.go index 9cf9145b0..483d47d58 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2/wechatreceiver.go +++ b/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,7 +26,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" ) @@ -38,15 +38,15 @@ type WechatReceiversGetter interface { // WechatReceiverInterface has methods to work with WechatReceiver resources. type WechatReceiverInterface interface { - Create(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.CreateOptions) (*v2.WechatReceiver, error) - Update(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (*v2.WechatReceiver, error) - UpdateStatus(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (*v2.WechatReceiver, error) + Create(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.CreateOptions) (*v2alpha1.WechatReceiver, error) + Update(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (*v2alpha1.WechatReceiver, error) + UpdateStatus(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (*v2alpha1.WechatReceiver, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.WechatReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2.WechatReceiverList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WechatReceiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WechatReceiverList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatReceiver, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatReceiver, err error) WechatReceiverExpansion } @@ -56,15 +56,15 @@ type wechatReceivers struct { } // newWechatReceivers returns a WechatReceivers -func newWechatReceivers(c *NotificationV2Client) *wechatReceivers { +func newWechatReceivers(c *NotificationV2alpha1Client) *wechatReceivers { return &wechatReceivers{ client: c.RESTClient(), } } // Get takes name of the wechatReceiver, and returns the corresponding wechatReceiver object, and an error if there is any. -func (c *wechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.WechatReceiver, err error) { - result = &v2.WechatReceiver{} +func (c *wechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatReceiver, err error) { + result = &v2alpha1.WechatReceiver{} err = c.client.Get(). Resource("wechatreceivers"). Name(name). @@ -75,12 +75,12 @@ func (c *wechatReceivers) Get(ctx context.Context, name string, options v1.GetOp } // List takes label and field selectors, and returns the list of WechatReceivers that match those selectors. -func (c *wechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2.WechatReceiverList, err error) { +func (c *wechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatReceiverList, err error) { var timeout time.Duration if opts.TimeoutSeconds != nil { timeout = time.Duration(*opts.TimeoutSeconds) * time.Second } - result = &v2.WechatReceiverList{} + result = &v2alpha1.WechatReceiverList{} err = c.client.Get(). Resource("wechatreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -105,8 +105,8 @@ func (c *wechatReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch } // Create takes the representation of a wechatReceiver and creates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *wechatReceivers) Create(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.CreateOptions) (result *v2.WechatReceiver, err error) { - result = &v2.WechatReceiver{} +func (c *wechatReceivers) Create(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.CreateOptions) (result *v2alpha1.WechatReceiver, err error) { + result = &v2alpha1.WechatReceiver{} err = c.client.Post(). Resource("wechatreceivers"). VersionedParams(&opts, scheme.ParameterCodec). @@ -117,8 +117,8 @@ func (c *wechatReceivers) Create(ctx context.Context, wechatReceiver *v2.WechatR } // Update takes the representation of a wechatReceiver and updates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *wechatReceivers) Update(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (result *v2.WechatReceiver, err error) { - result = &v2.WechatReceiver{} +func (c *wechatReceivers) Update(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (result *v2alpha1.WechatReceiver, err error) { + result = &v2alpha1.WechatReceiver{} err = c.client.Put(). Resource("wechatreceivers"). Name(wechatReceiver.Name). @@ -131,8 +131,8 @@ func (c *wechatReceivers) Update(ctx context.Context, wechatReceiver *v2.WechatR // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *wechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2.WechatReceiver, opts v1.UpdateOptions) (result *v2.WechatReceiver, err error) { - result = &v2.WechatReceiver{} +func (c *wechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (result *v2alpha1.WechatReceiver, err error) { + result = &v2alpha1.WechatReceiver{} err = c.client.Put(). Resource("wechatreceivers"). Name(wechatReceiver.Name). @@ -170,8 +170,8 @@ func (c *wechatReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOp } // Patch applies the patch and returns the patched wechatReceiver. -func (c *wechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.WechatReceiver, err error) { - result = &v2.WechatReceiver{} +func (c *wechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatReceiver, err error) { + result = &v2alpha1.WechatReceiver{} err = c.client.Patch(pt). Resource("wechatreceivers"). Name(name). diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index fe74bb2c5..03d3fa0e9 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -30,8 +30,12 @@ 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 servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" @@ -133,27 +137,27 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case networkv1alpha1.SchemeGroupVersion.WithResource("namespacenetworkpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().NamespaceNetworkPolicies().Informer()}, nil - // Group=notification.kubesphere.io, Version=v2 - case v2.SchemeGroupVersion.WithResource("dingtalkconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().DingTalkConfigs().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("dingtalkreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().DingTalkReceivers().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("emailconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().EmailConfigs().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("emailreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().EmailReceivers().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("slackconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().SlackConfigs().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("slackreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().SlackReceivers().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("webhookconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WebhookConfigs().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("webhookreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WebhookReceivers().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("wechatconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WechatConfigs().Informer()}, nil - case v2.SchemeGroupVersion.WithResource("wechatreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2().WechatReceivers().Informer()}, nil + // Group=notification.kubesphere.io, Version=v2alpha1 + case v2alpha1.SchemeGroupVersion.WithResource("dingtalkconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().DingTalkConfigs().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("dingtalkreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().DingTalkReceivers().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("emailconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().EmailConfigs().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("emailreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().EmailReceivers().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("slackconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().SlackConfigs().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("slackreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().SlackReceivers().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("webhookconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WebhookConfigs().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("webhookreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WebhookReceivers().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("wechatconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WechatConfigs().Informer()}, nil + case v2alpha1.SchemeGroupVersion.WithResource("wechatreceivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WechatReceivers().Informer()}, nil // Group=quota.kubesphere.io, Version=v1alpha2 case quotav1alpha2.SchemeGroupVersion.WithResource("resourcequotas"): diff --git a/pkg/client/informers/externalversions/notification/interface.go b/pkg/client/informers/externalversions/notification/interface.go index c5d31fdf3..15992cecc 100644 --- a/pkg/client/informers/externalversions/notification/interface.go +++ b/pkg/client/informers/externalversions/notification/interface.go @@ -20,13 +20,13 @@ package notification import ( internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/notification/v2alpha1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V2 provides access to shared informers for resources in V2. - V2() v2.Interface + // V2alpha1 provides access to shared informers for resources in V2alpha1. + V2alpha1() v2alpha1.Interface } type group struct { @@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V2 returns a new v2.Interface. -func (g *group) V2() v2.Interface { - return v2.New(g.factory, g.namespace, g.tweakListOptions) +// V2alpha1 returns a new v2alpha1.Interface. +func (g *group) V2alpha1() v2alpha1.Interface { + return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/notification/v2/dingtalkconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkconfig.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/dingtalkconfig.go rename to pkg/client/informers/externalversions/notification/v2alpha1/dingtalkconfig.go index 1cbd67536..7cb150816 100644 --- a/pkg/client/informers/externalversions/notification/v2/dingtalkconfig.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // DingTalkConfigInformer provides access to a shared informer and lister for // DingTalkConfigs. type DingTalkConfigInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.DingTalkConfigLister + Lister() v2alpha1.DingTalkConfigLister } type dingTalkConfigInformer struct { @@ -61,16 +61,16 @@ func NewFilteredDingTalkConfigInformer(client versioned.Interface, resyncPeriod if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().DingTalkConfigs().List(context.TODO(), options) + return client.NotificationV2alpha1().DingTalkConfigs().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().DingTalkConfigs().Watch(context.TODO(), options) + return client.NotificationV2alpha1().DingTalkConfigs().Watch(context.TODO(), options) }, }, - ¬ificationv2.DingTalkConfig{}, + ¬ificationv2alpha1.DingTalkConfig{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *dingTalkConfigInformer) defaultInformer(client versioned.Interface, res } func (f *dingTalkConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.DingTalkConfig{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.DingTalkConfig{}, f.defaultInformer) } -func (f *dingTalkConfigInformer) Lister() v2.DingTalkConfigLister { - return v2.NewDingTalkConfigLister(f.Informer().GetIndexer()) +func (f *dingTalkConfigInformer) Lister() v2alpha1.DingTalkConfigLister { + return v2alpha1.NewDingTalkConfigLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/dingtalkreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkreceiver.go similarity index 81% rename from pkg/client/informers/externalversions/notification/v2/dingtalkreceiver.go rename to pkg/client/informers/externalversions/notification/v2alpha1/dingtalkreceiver.go index 3c4f4d362..1607f3f77 100644 --- a/pkg/client/informers/externalversions/notification/v2/dingtalkreceiver.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // DingTalkReceiverInformer provides access to a shared informer and lister for // DingTalkReceivers. type DingTalkReceiverInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.DingTalkReceiverLister + Lister() v2alpha1.DingTalkReceiverLister } type dingTalkReceiverInformer struct { @@ -61,16 +61,16 @@ func NewFilteredDingTalkReceiverInformer(client versioned.Interface, resyncPerio if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().DingTalkReceivers().List(context.TODO(), options) + return client.NotificationV2alpha1().DingTalkReceivers().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().DingTalkReceivers().Watch(context.TODO(), options) + return client.NotificationV2alpha1().DingTalkReceivers().Watch(context.TODO(), options) }, }, - ¬ificationv2.DingTalkReceiver{}, + ¬ificationv2alpha1.DingTalkReceiver{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *dingTalkReceiverInformer) defaultInformer(client versioned.Interface, r } func (f *dingTalkReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.DingTalkReceiver{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.DingTalkReceiver{}, f.defaultInformer) } -func (f *dingTalkReceiverInformer) Lister() v2.DingTalkReceiverLister { - return v2.NewDingTalkReceiverLister(f.Informer().GetIndexer()) +func (f *dingTalkReceiverInformer) Lister() v2alpha1.DingTalkReceiverLister { + return v2alpha1.NewDingTalkReceiverLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/emailconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/emailconfig.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/emailconfig.go rename to pkg/client/informers/externalversions/notification/v2alpha1/emailconfig.go index a7860894a..0762ea5d6 100644 --- a/pkg/client/informers/externalversions/notification/v2/emailconfig.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/emailconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // EmailConfigInformer provides access to a shared informer and lister for // EmailConfigs. type EmailConfigInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.EmailConfigLister + Lister() v2alpha1.EmailConfigLister } type emailConfigInformer struct { @@ -61,16 +61,16 @@ func NewFilteredEmailConfigInformer(client versioned.Interface, resyncPeriod tim if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().EmailConfigs().List(context.TODO(), options) + return client.NotificationV2alpha1().EmailConfigs().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().EmailConfigs().Watch(context.TODO(), options) + return client.NotificationV2alpha1().EmailConfigs().Watch(context.TODO(), options) }, }, - ¬ificationv2.EmailConfig{}, + ¬ificationv2alpha1.EmailConfig{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *emailConfigInformer) defaultInformer(client versioned.Interface, resync } func (f *emailConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.EmailConfig{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.EmailConfig{}, f.defaultInformer) } -func (f *emailConfigInformer) Lister() v2.EmailConfigLister { - return v2.NewEmailConfigLister(f.Informer().GetIndexer()) +func (f *emailConfigInformer) Lister() v2alpha1.EmailConfigLister { + return v2alpha1.NewEmailConfigLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/emailreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/emailreceiver.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/emailreceiver.go rename to pkg/client/informers/externalversions/notification/v2alpha1/emailreceiver.go index a49a32b7d..bf109333e 100644 --- a/pkg/client/informers/externalversions/notification/v2/emailreceiver.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/emailreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // EmailReceiverInformer provides access to a shared informer and lister for // EmailReceivers. type EmailReceiverInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.EmailReceiverLister + Lister() v2alpha1.EmailReceiverLister } type emailReceiverInformer struct { @@ -61,16 +61,16 @@ func NewFilteredEmailReceiverInformer(client versioned.Interface, resyncPeriod t if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().EmailReceivers().List(context.TODO(), options) + return client.NotificationV2alpha1().EmailReceivers().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().EmailReceivers().Watch(context.TODO(), options) + return client.NotificationV2alpha1().EmailReceivers().Watch(context.TODO(), options) }, }, - ¬ificationv2.EmailReceiver{}, + ¬ificationv2alpha1.EmailReceiver{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *emailReceiverInformer) defaultInformer(client versioned.Interface, resy } func (f *emailReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.EmailReceiver{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.EmailReceiver{}, f.defaultInformer) } -func (f *emailReceiverInformer) Lister() v2.EmailReceiverLister { - return v2.NewEmailReceiverLister(f.Informer().GetIndexer()) +func (f *emailReceiverInformer) Lister() v2alpha1.EmailReceiverLister { + return v2alpha1.NewEmailReceiverLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/interface.go b/pkg/client/informers/externalversions/notification/v2alpha1/interface.go similarity index 99% rename from pkg/client/informers/externalversions/notification/v2/interface.go rename to pkg/client/informers/externalversions/notification/v2alpha1/interface.go index a1afb6e0d..b52c7460a 100644 --- a/pkg/client/informers/externalversions/notification/v2/interface.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" diff --git a/pkg/client/informers/externalversions/notification/v2/slackconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/slackconfig.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/slackconfig.go rename to pkg/client/informers/externalversions/notification/v2alpha1/slackconfig.go index c326cd90a..317ead759 100644 --- a/pkg/client/informers/externalversions/notification/v2/slackconfig.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/slackconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // SlackConfigInformer provides access to a shared informer and lister for // SlackConfigs. type SlackConfigInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.SlackConfigLister + Lister() v2alpha1.SlackConfigLister } type slackConfigInformer struct { @@ -61,16 +61,16 @@ func NewFilteredSlackConfigInformer(client versioned.Interface, resyncPeriod tim if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().SlackConfigs().List(context.TODO(), options) + return client.NotificationV2alpha1().SlackConfigs().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().SlackConfigs().Watch(context.TODO(), options) + return client.NotificationV2alpha1().SlackConfigs().Watch(context.TODO(), options) }, }, - ¬ificationv2.SlackConfig{}, + ¬ificationv2alpha1.SlackConfig{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *slackConfigInformer) defaultInformer(client versioned.Interface, resync } func (f *slackConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.SlackConfig{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.SlackConfig{}, f.defaultInformer) } -func (f *slackConfigInformer) Lister() v2.SlackConfigLister { - return v2.NewSlackConfigLister(f.Informer().GetIndexer()) +func (f *slackConfigInformer) Lister() v2alpha1.SlackConfigLister { + return v2alpha1.NewSlackConfigLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/slackreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/slackreceiver.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/slackreceiver.go rename to pkg/client/informers/externalversions/notification/v2alpha1/slackreceiver.go index 89fe1e10e..928e6ee44 100644 --- a/pkg/client/informers/externalversions/notification/v2/slackreceiver.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/slackreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // SlackReceiverInformer provides access to a shared informer and lister for // SlackReceivers. type SlackReceiverInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.SlackReceiverLister + Lister() v2alpha1.SlackReceiverLister } type slackReceiverInformer struct { @@ -61,16 +61,16 @@ func NewFilteredSlackReceiverInformer(client versioned.Interface, resyncPeriod t if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().SlackReceivers().List(context.TODO(), options) + return client.NotificationV2alpha1().SlackReceivers().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().SlackReceivers().Watch(context.TODO(), options) + return client.NotificationV2alpha1().SlackReceivers().Watch(context.TODO(), options) }, }, - ¬ificationv2.SlackReceiver{}, + ¬ificationv2alpha1.SlackReceiver{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *slackReceiverInformer) defaultInformer(client versioned.Interface, resy } func (f *slackReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.SlackReceiver{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.SlackReceiver{}, f.defaultInformer) } -func (f *slackReceiverInformer) Lister() v2.SlackReceiverLister { - return v2.NewSlackReceiverLister(f.Informer().GetIndexer()) +func (f *slackReceiverInformer) Lister() v2alpha1.SlackReceiverLister { + return v2alpha1.NewSlackReceiverLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/webhookconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/webhookconfig.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/webhookconfig.go rename to pkg/client/informers/externalversions/notification/v2alpha1/webhookconfig.go index 492babe9b..70ea50e47 100644 --- a/pkg/client/informers/externalversions/notification/v2/webhookconfig.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/webhookconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // WebhookConfigInformer provides access to a shared informer and lister for // WebhookConfigs. type WebhookConfigInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.WebhookConfigLister + Lister() v2alpha1.WebhookConfigLister } type webhookConfigInformer struct { @@ -61,16 +61,16 @@ func NewFilteredWebhookConfigInformer(client versioned.Interface, resyncPeriod t if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WebhookConfigs().List(context.TODO(), options) + return client.NotificationV2alpha1().WebhookConfigs().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WebhookConfigs().Watch(context.TODO(), options) + return client.NotificationV2alpha1().WebhookConfigs().Watch(context.TODO(), options) }, }, - ¬ificationv2.WebhookConfig{}, + ¬ificationv2alpha1.WebhookConfig{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *webhookConfigInformer) defaultInformer(client versioned.Interface, resy } func (f *webhookConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.WebhookConfig{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.WebhookConfig{}, f.defaultInformer) } -func (f *webhookConfigInformer) Lister() v2.WebhookConfigLister { - return v2.NewWebhookConfigLister(f.Informer().GetIndexer()) +func (f *webhookConfigInformer) Lister() v2alpha1.WebhookConfigLister { + return v2alpha1.NewWebhookConfigLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/webhookreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/webhookreceiver.go similarity index 81% rename from pkg/client/informers/externalversions/notification/v2/webhookreceiver.go rename to pkg/client/informers/externalversions/notification/v2alpha1/webhookreceiver.go index 9a41c6be6..5d9229d6a 100644 --- a/pkg/client/informers/externalversions/notification/v2/webhookreceiver.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/webhookreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // WebhookReceiverInformer provides access to a shared informer and lister for // WebhookReceivers. type WebhookReceiverInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.WebhookReceiverLister + Lister() v2alpha1.WebhookReceiverLister } type webhookReceiverInformer struct { @@ -61,16 +61,16 @@ func NewFilteredWebhookReceiverInformer(client versioned.Interface, resyncPeriod if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WebhookReceivers().List(context.TODO(), options) + return client.NotificationV2alpha1().WebhookReceivers().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WebhookReceivers().Watch(context.TODO(), options) + return client.NotificationV2alpha1().WebhookReceivers().Watch(context.TODO(), options) }, }, - ¬ificationv2.WebhookReceiver{}, + ¬ificationv2alpha1.WebhookReceiver{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *webhookReceiverInformer) defaultInformer(client versioned.Interface, re } func (f *webhookReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.WebhookReceiver{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.WebhookReceiver{}, f.defaultInformer) } -func (f *webhookReceiverInformer) Lister() v2.WebhookReceiverLister { - return v2.NewWebhookReceiverLister(f.Informer().GetIndexer()) +func (f *webhookReceiverInformer) Lister() v2alpha1.WebhookReceiverLister { + return v2alpha1.NewWebhookReceiverLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/wechatconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/wechatconfig.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/wechatconfig.go rename to pkg/client/informers/externalversions/notification/v2alpha1/wechatconfig.go index 26e05061d..b17aac222 100644 --- a/pkg/client/informers/externalversions/notification/v2/wechatconfig.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/wechatconfig.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // WechatConfigInformer provides access to a shared informer and lister for // WechatConfigs. type WechatConfigInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.WechatConfigLister + Lister() v2alpha1.WechatConfigLister } type wechatConfigInformer struct { @@ -61,16 +61,16 @@ func NewFilteredWechatConfigInformer(client versioned.Interface, resyncPeriod ti if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WechatConfigs().List(context.TODO(), options) + return client.NotificationV2alpha1().WechatConfigs().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WechatConfigs().Watch(context.TODO(), options) + return client.NotificationV2alpha1().WechatConfigs().Watch(context.TODO(), options) }, }, - ¬ificationv2.WechatConfig{}, + ¬ificationv2alpha1.WechatConfig{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *wechatConfigInformer) defaultInformer(client versioned.Interface, resyn } func (f *wechatConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.WechatConfig{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.WechatConfig{}, f.defaultInformer) } -func (f *wechatConfigInformer) Lister() v2.WechatConfigLister { - return v2.NewWechatConfigLister(f.Informer().GetIndexer()) +func (f *wechatConfigInformer) Lister() v2alpha1.WechatConfigLister { + return v2alpha1.NewWechatConfigLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2/wechatreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/wechatreceiver.go similarity index 82% rename from pkg/client/informers/externalversions/notification/v2/wechatreceiver.go rename to pkg/client/informers/externalversions/notification/v2alpha1/wechatreceiver.go index 253a69194..9a6569297 100644 --- a/pkg/client/informers/externalversions/notification/v2/wechatreceiver.go +++ b/pkg/client/informers/externalversions/notification/v2alpha1/wechatreceiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "context" @@ -26,17 +26,17 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" ) // WechatReceiverInformer provides access to a shared informer and lister for // WechatReceivers. type WechatReceiverInformer interface { Informer() cache.SharedIndexInformer - Lister() v2.WechatReceiverLister + Lister() v2alpha1.WechatReceiverLister } type wechatReceiverInformer struct { @@ -61,16 +61,16 @@ func NewFilteredWechatReceiverInformer(client versioned.Interface, resyncPeriod if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WechatReceivers().List(context.TODO(), options) + return client.NotificationV2alpha1().WechatReceivers().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2().WechatReceivers().Watch(context.TODO(), options) + return client.NotificationV2alpha1().WechatReceivers().Watch(context.TODO(), options) }, }, - ¬ificationv2.WechatReceiver{}, + ¬ificationv2alpha1.WechatReceiver{}, resyncPeriod, indexers, ) @@ -81,9 +81,9 @@ func (f *wechatReceiverInformer) defaultInformer(client versioned.Interface, res } func (f *wechatReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2.WechatReceiver{}, f.defaultInformer) + return f.factory.InformerFor(¬ificationv2alpha1.WechatReceiver{}, f.defaultInformer) } -func (f *wechatReceiverInformer) Lister() v2.WechatReceiverLister { - return v2.NewWechatReceiverLister(f.Informer().GetIndexer()) +func (f *wechatReceiverInformer) Lister() v2alpha1.WechatReceiverLister { + return v2alpha1.NewWechatReceiverLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/listers/notification/v2/dingtalkconfig.go b/pkg/client/listers/notification/v2alpha1/dingtalkconfig.go similarity index 76% rename from pkg/client/listers/notification/v2/dingtalkconfig.go rename to pkg/client/listers/notification/v2alpha1/dingtalkconfig.go index 28420570b..2e20720d0 100644 --- a/pkg/client/listers/notification/v2/dingtalkconfig.go +++ b/pkg/client/listers/notification/v2alpha1/dingtalkconfig.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // DingTalkConfigLister helps list DingTalkConfigs. type DingTalkConfigLister interface { // List lists all DingTalkConfigs in the indexer. - List(selector labels.Selector) (ret []*v2.DingTalkConfig, err error) + List(selector labels.Selector) (ret []*v2alpha1.DingTalkConfig, err error) // Get retrieves the DingTalkConfig from the index for a given name. - Get(name string) (*v2.DingTalkConfig, error) + Get(name string) (*v2alpha1.DingTalkConfig, error) DingTalkConfigListerExpansion } @@ -45,21 +45,21 @@ func NewDingTalkConfigLister(indexer cache.Indexer) DingTalkConfigLister { } // List lists all DingTalkConfigs in the indexer. -func (s *dingTalkConfigLister) List(selector labels.Selector) (ret []*v2.DingTalkConfig, err error) { +func (s *dingTalkConfigLister) List(selector labels.Selector) (ret []*v2alpha1.DingTalkConfig, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.DingTalkConfig)) + ret = append(ret, m.(*v2alpha1.DingTalkConfig)) }) return ret, err } // Get retrieves the DingTalkConfig from the index for a given name. -func (s *dingTalkConfigLister) Get(name string) (*v2.DingTalkConfig, error) { +func (s *dingTalkConfigLister) Get(name string) (*v2alpha1.DingTalkConfig, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("dingtalkconfig"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("dingtalkconfig"), name) } - return obj.(*v2.DingTalkConfig), nil + return obj.(*v2alpha1.DingTalkConfig), nil } diff --git a/pkg/client/listers/notification/v2/dingtalkreceiver.go b/pkg/client/listers/notification/v2alpha1/dingtalkreceiver.go similarity index 76% rename from pkg/client/listers/notification/v2/dingtalkreceiver.go rename to pkg/client/listers/notification/v2alpha1/dingtalkreceiver.go index da88dc5f5..7019aeb46 100644 --- a/pkg/client/listers/notification/v2/dingtalkreceiver.go +++ b/pkg/client/listers/notification/v2alpha1/dingtalkreceiver.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // DingTalkReceiverLister helps list DingTalkReceivers. type DingTalkReceiverLister interface { // List lists all DingTalkReceivers in the indexer. - List(selector labels.Selector) (ret []*v2.DingTalkReceiver, err error) + List(selector labels.Selector) (ret []*v2alpha1.DingTalkReceiver, err error) // Get retrieves the DingTalkReceiver from the index for a given name. - Get(name string) (*v2.DingTalkReceiver, error) + Get(name string) (*v2alpha1.DingTalkReceiver, error) DingTalkReceiverListerExpansion } @@ -45,21 +45,21 @@ func NewDingTalkReceiverLister(indexer cache.Indexer) DingTalkReceiverLister { } // List lists all DingTalkReceivers in the indexer. -func (s *dingTalkReceiverLister) List(selector labels.Selector) (ret []*v2.DingTalkReceiver, err error) { +func (s *dingTalkReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.DingTalkReceiver, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.DingTalkReceiver)) + ret = append(ret, m.(*v2alpha1.DingTalkReceiver)) }) return ret, err } // Get retrieves the DingTalkReceiver from the index for a given name. -func (s *dingTalkReceiverLister) Get(name string) (*v2.DingTalkReceiver, error) { +func (s *dingTalkReceiverLister) Get(name string) (*v2alpha1.DingTalkReceiver, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("dingtalkreceiver"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("dingtalkreceiver"), name) } - return obj.(*v2.DingTalkReceiver), nil + return obj.(*v2alpha1.DingTalkReceiver), nil } diff --git a/pkg/client/listers/notification/v2/emailconfig.go b/pkg/client/listers/notification/v2alpha1/emailconfig.go similarity index 77% rename from pkg/client/listers/notification/v2/emailconfig.go rename to pkg/client/listers/notification/v2alpha1/emailconfig.go index c0025b95c..7894a2431 100644 --- a/pkg/client/listers/notification/v2/emailconfig.go +++ b/pkg/client/listers/notification/v2alpha1/emailconfig.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // EmailConfigLister helps list EmailConfigs. type EmailConfigLister interface { // List lists all EmailConfigs in the indexer. - List(selector labels.Selector) (ret []*v2.EmailConfig, err error) + List(selector labels.Selector) (ret []*v2alpha1.EmailConfig, err error) // Get retrieves the EmailConfig from the index for a given name. - Get(name string) (*v2.EmailConfig, error) + Get(name string) (*v2alpha1.EmailConfig, error) EmailConfigListerExpansion } @@ -45,21 +45,21 @@ func NewEmailConfigLister(indexer cache.Indexer) EmailConfigLister { } // List lists all EmailConfigs in the indexer. -func (s *emailConfigLister) List(selector labels.Selector) (ret []*v2.EmailConfig, err error) { +func (s *emailConfigLister) List(selector labels.Selector) (ret []*v2alpha1.EmailConfig, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.EmailConfig)) + ret = append(ret, m.(*v2alpha1.EmailConfig)) }) return ret, err } // Get retrieves the EmailConfig from the index for a given name. -func (s *emailConfigLister) Get(name string) (*v2.EmailConfig, error) { +func (s *emailConfigLister) Get(name string) (*v2alpha1.EmailConfig, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("emailconfig"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("emailconfig"), name) } - return obj.(*v2.EmailConfig), nil + return obj.(*v2alpha1.EmailConfig), nil } diff --git a/pkg/client/listers/notification/v2/emailreceiver.go b/pkg/client/listers/notification/v2alpha1/emailreceiver.go similarity index 76% rename from pkg/client/listers/notification/v2/emailreceiver.go rename to pkg/client/listers/notification/v2alpha1/emailreceiver.go index c5d4ed0f8..d5d01e124 100644 --- a/pkg/client/listers/notification/v2/emailreceiver.go +++ b/pkg/client/listers/notification/v2alpha1/emailreceiver.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // EmailReceiverLister helps list EmailReceivers. type EmailReceiverLister interface { // List lists all EmailReceivers in the indexer. - List(selector labels.Selector) (ret []*v2.EmailReceiver, err error) + List(selector labels.Selector) (ret []*v2alpha1.EmailReceiver, err error) // Get retrieves the EmailReceiver from the index for a given name. - Get(name string) (*v2.EmailReceiver, error) + Get(name string) (*v2alpha1.EmailReceiver, error) EmailReceiverListerExpansion } @@ -45,21 +45,21 @@ func NewEmailReceiverLister(indexer cache.Indexer) EmailReceiverLister { } // List lists all EmailReceivers in the indexer. -func (s *emailReceiverLister) List(selector labels.Selector) (ret []*v2.EmailReceiver, err error) { +func (s *emailReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.EmailReceiver, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.EmailReceiver)) + ret = append(ret, m.(*v2alpha1.EmailReceiver)) }) return ret, err } // Get retrieves the EmailReceiver from the index for a given name. -func (s *emailReceiverLister) Get(name string) (*v2.EmailReceiver, error) { +func (s *emailReceiverLister) Get(name string) (*v2alpha1.EmailReceiver, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("emailreceiver"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("emailreceiver"), name) } - return obj.(*v2.EmailReceiver), nil + return obj.(*v2alpha1.EmailReceiver), nil } diff --git a/pkg/client/listers/notification/v2/expansion_generated.go b/pkg/client/listers/notification/v2alpha1/expansion_generated.go similarity index 99% rename from pkg/client/listers/notification/v2/expansion_generated.go rename to pkg/client/listers/notification/v2alpha1/expansion_generated.go index fb646dbc1..5d736045e 100644 --- a/pkg/client/listers/notification/v2/expansion_generated.go +++ b/pkg/client/listers/notification/v2alpha1/expansion_generated.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 // DingTalkConfigListerExpansion allows custom methods to be added to // DingTalkConfigLister. diff --git a/pkg/client/listers/notification/v2/slackconfig.go b/pkg/client/listers/notification/v2alpha1/slackconfig.go similarity index 77% rename from pkg/client/listers/notification/v2/slackconfig.go rename to pkg/client/listers/notification/v2alpha1/slackconfig.go index 77981346f..3509986ab 100644 --- a/pkg/client/listers/notification/v2/slackconfig.go +++ b/pkg/client/listers/notification/v2alpha1/slackconfig.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // SlackConfigLister helps list SlackConfigs. type SlackConfigLister interface { // List lists all SlackConfigs in the indexer. - List(selector labels.Selector) (ret []*v2.SlackConfig, err error) + List(selector labels.Selector) (ret []*v2alpha1.SlackConfig, err error) // Get retrieves the SlackConfig from the index for a given name. - Get(name string) (*v2.SlackConfig, error) + Get(name string) (*v2alpha1.SlackConfig, error) SlackConfigListerExpansion } @@ -45,21 +45,21 @@ func NewSlackConfigLister(indexer cache.Indexer) SlackConfigLister { } // List lists all SlackConfigs in the indexer. -func (s *slackConfigLister) List(selector labels.Selector) (ret []*v2.SlackConfig, err error) { +func (s *slackConfigLister) List(selector labels.Selector) (ret []*v2alpha1.SlackConfig, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.SlackConfig)) + ret = append(ret, m.(*v2alpha1.SlackConfig)) }) return ret, err } // Get retrieves the SlackConfig from the index for a given name. -func (s *slackConfigLister) Get(name string) (*v2.SlackConfig, error) { +func (s *slackConfigLister) Get(name string) (*v2alpha1.SlackConfig, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("slackconfig"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("slackconfig"), name) } - return obj.(*v2.SlackConfig), nil + return obj.(*v2alpha1.SlackConfig), nil } diff --git a/pkg/client/listers/notification/v2/slackreceiver.go b/pkg/client/listers/notification/v2alpha1/slackreceiver.go similarity index 76% rename from pkg/client/listers/notification/v2/slackreceiver.go rename to pkg/client/listers/notification/v2alpha1/slackreceiver.go index 90906b682..ff46ab040 100644 --- a/pkg/client/listers/notification/v2/slackreceiver.go +++ b/pkg/client/listers/notification/v2alpha1/slackreceiver.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // SlackReceiverLister helps list SlackReceivers. type SlackReceiverLister interface { // List lists all SlackReceivers in the indexer. - List(selector labels.Selector) (ret []*v2.SlackReceiver, err error) + List(selector labels.Selector) (ret []*v2alpha1.SlackReceiver, err error) // Get retrieves the SlackReceiver from the index for a given name. - Get(name string) (*v2.SlackReceiver, error) + Get(name string) (*v2alpha1.SlackReceiver, error) SlackReceiverListerExpansion } @@ -45,21 +45,21 @@ func NewSlackReceiverLister(indexer cache.Indexer) SlackReceiverLister { } // List lists all SlackReceivers in the indexer. -func (s *slackReceiverLister) List(selector labels.Selector) (ret []*v2.SlackReceiver, err error) { +func (s *slackReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.SlackReceiver, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.SlackReceiver)) + ret = append(ret, m.(*v2alpha1.SlackReceiver)) }) return ret, err } // Get retrieves the SlackReceiver from the index for a given name. -func (s *slackReceiverLister) Get(name string) (*v2.SlackReceiver, error) { +func (s *slackReceiverLister) Get(name string) (*v2alpha1.SlackReceiver, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("slackreceiver"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("slackreceiver"), name) } - return obj.(*v2.SlackReceiver), nil + return obj.(*v2alpha1.SlackReceiver), nil } diff --git a/pkg/client/listers/notification/v2/webhookconfig.go b/pkg/client/listers/notification/v2alpha1/webhookconfig.go similarity index 76% rename from pkg/client/listers/notification/v2/webhookconfig.go rename to pkg/client/listers/notification/v2alpha1/webhookconfig.go index 41470f642..8e87599da 100644 --- a/pkg/client/listers/notification/v2/webhookconfig.go +++ b/pkg/client/listers/notification/v2alpha1/webhookconfig.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // WebhookConfigLister helps list WebhookConfigs. type WebhookConfigLister interface { // List lists all WebhookConfigs in the indexer. - List(selector labels.Selector) (ret []*v2.WebhookConfig, err error) + List(selector labels.Selector) (ret []*v2alpha1.WebhookConfig, err error) // Get retrieves the WebhookConfig from the index for a given name. - Get(name string) (*v2.WebhookConfig, error) + Get(name string) (*v2alpha1.WebhookConfig, error) WebhookConfigListerExpansion } @@ -45,21 +45,21 @@ func NewWebhookConfigLister(indexer cache.Indexer) WebhookConfigLister { } // List lists all WebhookConfigs in the indexer. -func (s *webhookConfigLister) List(selector labels.Selector) (ret []*v2.WebhookConfig, err error) { +func (s *webhookConfigLister) List(selector labels.Selector) (ret []*v2alpha1.WebhookConfig, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.WebhookConfig)) + ret = append(ret, m.(*v2alpha1.WebhookConfig)) }) return ret, err } // Get retrieves the WebhookConfig from the index for a given name. -func (s *webhookConfigLister) Get(name string) (*v2.WebhookConfig, error) { +func (s *webhookConfigLister) Get(name string) (*v2alpha1.WebhookConfig, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("webhookconfig"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("webhookconfig"), name) } - return obj.(*v2.WebhookConfig), nil + return obj.(*v2alpha1.WebhookConfig), nil } diff --git a/pkg/client/listers/notification/v2/webhookreceiver.go b/pkg/client/listers/notification/v2alpha1/webhookreceiver.go similarity index 76% rename from pkg/client/listers/notification/v2/webhookreceiver.go rename to pkg/client/listers/notification/v2alpha1/webhookreceiver.go index 07359add3..2a207cfb3 100644 --- a/pkg/client/listers/notification/v2/webhookreceiver.go +++ b/pkg/client/listers/notification/v2alpha1/webhookreceiver.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // WebhookReceiverLister helps list WebhookReceivers. type WebhookReceiverLister interface { // List lists all WebhookReceivers in the indexer. - List(selector labels.Selector) (ret []*v2.WebhookReceiver, err error) + List(selector labels.Selector) (ret []*v2alpha1.WebhookReceiver, err error) // Get retrieves the WebhookReceiver from the index for a given name. - Get(name string) (*v2.WebhookReceiver, error) + Get(name string) (*v2alpha1.WebhookReceiver, error) WebhookReceiverListerExpansion } @@ -45,21 +45,21 @@ func NewWebhookReceiverLister(indexer cache.Indexer) WebhookReceiverLister { } // List lists all WebhookReceivers in the indexer. -func (s *webhookReceiverLister) List(selector labels.Selector) (ret []*v2.WebhookReceiver, err error) { +func (s *webhookReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.WebhookReceiver, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.WebhookReceiver)) + ret = append(ret, m.(*v2alpha1.WebhookReceiver)) }) return ret, err } // Get retrieves the WebhookReceiver from the index for a given name. -func (s *webhookReceiverLister) Get(name string) (*v2.WebhookReceiver, error) { +func (s *webhookReceiverLister) Get(name string) (*v2alpha1.WebhookReceiver, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("webhookreceiver"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("webhookreceiver"), name) } - return obj.(*v2.WebhookReceiver), nil + return obj.(*v2alpha1.WebhookReceiver), nil } diff --git a/pkg/client/listers/notification/v2/wechatconfig.go b/pkg/client/listers/notification/v2alpha1/wechatconfig.go similarity index 76% rename from pkg/client/listers/notification/v2/wechatconfig.go rename to pkg/client/listers/notification/v2alpha1/wechatconfig.go index ccccb4716..431a36631 100644 --- a/pkg/client/listers/notification/v2/wechatconfig.go +++ b/pkg/client/listers/notification/v2alpha1/wechatconfig.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // WechatConfigLister helps list WechatConfigs. type WechatConfigLister interface { // List lists all WechatConfigs in the indexer. - List(selector labels.Selector) (ret []*v2.WechatConfig, err error) + List(selector labels.Selector) (ret []*v2alpha1.WechatConfig, err error) // Get retrieves the WechatConfig from the index for a given name. - Get(name string) (*v2.WechatConfig, error) + Get(name string) (*v2alpha1.WechatConfig, error) WechatConfigListerExpansion } @@ -45,21 +45,21 @@ func NewWechatConfigLister(indexer cache.Indexer) WechatConfigLister { } // List lists all WechatConfigs in the indexer. -func (s *wechatConfigLister) List(selector labels.Selector) (ret []*v2.WechatConfig, err error) { +func (s *wechatConfigLister) List(selector labels.Selector) (ret []*v2alpha1.WechatConfig, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.WechatConfig)) + ret = append(ret, m.(*v2alpha1.WechatConfig)) }) return ret, err } // Get retrieves the WechatConfig from the index for a given name. -func (s *wechatConfigLister) Get(name string) (*v2.WechatConfig, error) { +func (s *wechatConfigLister) Get(name string) (*v2alpha1.WechatConfig, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("wechatconfig"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("wechatconfig"), name) } - return obj.(*v2.WechatConfig), nil + return obj.(*v2alpha1.WechatConfig), nil } diff --git a/pkg/client/listers/notification/v2/wechatreceiver.go b/pkg/client/listers/notification/v2alpha1/wechatreceiver.go similarity index 76% rename from pkg/client/listers/notification/v2/wechatreceiver.go rename to pkg/client/listers/notification/v2alpha1/wechatreceiver.go index 14b15669a..9365e2f21 100644 --- a/pkg/client/listers/notification/v2/wechatreceiver.go +++ b/pkg/client/listers/notification/v2alpha1/wechatreceiver.go @@ -16,21 +16,21 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v2 +package v2alpha1 import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" ) // WechatReceiverLister helps list WechatReceivers. type WechatReceiverLister interface { // List lists all WechatReceivers in the indexer. - List(selector labels.Selector) (ret []*v2.WechatReceiver, err error) + List(selector labels.Selector) (ret []*v2alpha1.WechatReceiver, err error) // Get retrieves the WechatReceiver from the index for a given name. - Get(name string) (*v2.WechatReceiver, error) + Get(name string) (*v2alpha1.WechatReceiver, error) WechatReceiverListerExpansion } @@ -45,21 +45,21 @@ func NewWechatReceiverLister(indexer cache.Indexer) WechatReceiverLister { } // List lists all WechatReceivers in the indexer. -func (s *wechatReceiverLister) List(selector labels.Selector) (ret []*v2.WechatReceiver, err error) { +func (s *wechatReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.WechatReceiver, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2.WechatReceiver)) + ret = append(ret, m.(*v2alpha1.WechatReceiver)) }) return ret, err } // Get retrieves the WechatReceiver from the index for a given name. -func (s *wechatReceiverLister) Get(name string) (*v2.WechatReceiver, error) { +func (s *wechatReceiverLister) Get(name string) (*v2alpha1.WechatReceiver, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { - return nil, errors.NewNotFound(v2.Resource("wechatreceiver"), name) + return nil, errors.NewNotFound(v2alpha1.Resource("wechatreceiver"), name) } - return obj.(*v2.WechatReceiver), nil + return obj.(*v2alpha1.WechatReceiver), nil } diff --git a/pkg/controller/notification/notification_controller.go b/pkg/controller/notification/notification_controller.go index fee776747..afef76589 100644 --- a/pkg/controller/notification/notification_controller.go +++ b/pkg/controller/notification/notification_controller.go @@ -33,7 +33,7 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" "k8s.io/klog" - "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" "kubesphere.io/kubesphere/pkg/constants" "reflect" @@ -95,16 +95,16 @@ func (c *Controller) setEventHandlers() error { if c.reconciledObjs != nil && len(c.reconciledObjs) > 0 { c.reconciledObjs = c.reconciledObjs[:0] } - c.reconciledObjs = append(c.reconciledObjs, &v2.DingTalkConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.DingTalkReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.EmailConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.EmailReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.SlackConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.SlackReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.WebhookConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.WebhookReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.WechatConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2.WechatReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.DingTalkConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.DingTalkReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.EmailConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.EmailReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.SlackConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.SlackReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WebhookConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WebhookReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WechatConfig{}) + c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WechatReceiver{}) c.reconciledObjs = append(c.reconciledObjs, &corev1.Secret{}) if c.informerSynced != nil && len(c.informerSynced) > 0 { @@ -269,26 +269,26 @@ func (c *Controller) multiClusterSync(ctx context.Context, obj runtime.Object) e } switch obj.(type) { - case *v2.DingTalkConfig: - return c.syncFederatedDingTalkConfig(obj.(*v2.DingTalkConfig)) - case *v2.DingTalkReceiver: - return c.syncFederatedDingTalkReceiver(obj.(*v2.DingTalkReceiver)) - case *v2.EmailConfig: - return c.syncFederatedEmailConfig(obj.(*v2.EmailConfig)) - case *v2.EmailReceiver: - return c.syncFederatedEmailReceiver(obj.(*v2.EmailReceiver)) - case *v2.SlackConfig: - return c.syncFederatedSlackConfig(obj.(*v2.SlackConfig)) - case *v2.SlackReceiver: - return c.syncFederatedSlackReceiver(obj.(*v2.SlackReceiver)) - case *v2.WebhookConfig: - return c.syncFederatedWebhookConfig(obj.(*v2.WebhookConfig)) - case *v2.WebhookReceiver: - return c.syncFederatedWebhookReceiver(obj.(*v2.WebhookReceiver)) - case *v2.WechatConfig: - return c.syncFederatedWechatConfig(obj.(*v2.WechatConfig)) - case *v2.WechatReceiver: - return c.syncFederatedWechatReceiver(obj.(*v2.WechatReceiver)) + case *v2alpha1.DingTalkConfig: + return c.syncFederatedDingTalkConfig(obj.(*v2alpha1.DingTalkConfig)) + case *v2alpha1.DingTalkReceiver: + return c.syncFederatedDingTalkReceiver(obj.(*v2alpha1.DingTalkReceiver)) + case *v2alpha1.EmailConfig: + return c.syncFederatedEmailConfig(obj.(*v2alpha1.EmailConfig)) + case *v2alpha1.EmailReceiver: + return c.syncFederatedEmailReceiver(obj.(*v2alpha1.EmailReceiver)) + case *v2alpha1.SlackConfig: + return c.syncFederatedSlackConfig(obj.(*v2alpha1.SlackConfig)) + case *v2alpha1.SlackReceiver: + return c.syncFederatedSlackReceiver(obj.(*v2alpha1.SlackReceiver)) + case *v2alpha1.WebhookConfig: + return c.syncFederatedWebhookConfig(obj.(*v2alpha1.WebhookConfig)) + case *v2alpha1.WebhookReceiver: + return c.syncFederatedWebhookReceiver(obj.(*v2alpha1.WebhookReceiver)) + case *v2alpha1.WechatConfig: + return c.syncFederatedWechatConfig(obj.(*v2alpha1.WechatConfig)) + case *v2alpha1.WechatReceiver: + return c.syncFederatedWechatReceiver(obj.(*v2alpha1.WechatReceiver)) case *corev1.Secret: return c.syncFederatedSecret(obj.(*corev1.Secret)) default: @@ -297,7 +297,7 @@ func (c *Controller) multiClusterSync(ctx context.Context, obj runtime.Object) e } } -func (c *Controller) syncFederatedDingTalkConfig(obj *v2.DingTalkConfig) error { +func (c *Controller) syncFederatedDingTalkConfig(obj *v2alpha1.DingTalkConfig) error { fedObj := &v1beta1.FederatedDingTalkConfig{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -353,7 +353,7 @@ func (c *Controller) syncFederatedDingTalkConfig(obj *v2.DingTalkConfig) error { return nil } -func (c *Controller) syncFederatedDingTalkReceiver(obj *v2.DingTalkReceiver) error { +func (c *Controller) syncFederatedDingTalkReceiver(obj *v2alpha1.DingTalkReceiver) error { fedObj := &v1beta1.FederatedDingTalkReceiver{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -409,7 +409,7 @@ func (c *Controller) syncFederatedDingTalkReceiver(obj *v2.DingTalkReceiver) err return nil } -func (c *Controller) syncFederatedEmailConfig(obj *v2.EmailConfig) error { +func (c *Controller) syncFederatedEmailConfig(obj *v2alpha1.EmailConfig) error { fedObj := &v1beta1.FederatedEmailConfig{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -465,7 +465,7 @@ func (c *Controller) syncFederatedEmailConfig(obj *v2.EmailConfig) error { return nil } -func (c *Controller) syncFederatedEmailReceiver(obj *v2.EmailReceiver) error { +func (c *Controller) syncFederatedEmailReceiver(obj *v2alpha1.EmailReceiver) error { fedObj := &v1beta1.FederatedEmailReceiver{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -521,7 +521,7 @@ func (c *Controller) syncFederatedEmailReceiver(obj *v2.EmailReceiver) error { return nil } -func (c *Controller) syncFederatedSlackConfig(obj *v2.SlackConfig) error { +func (c *Controller) syncFederatedSlackConfig(obj *v2alpha1.SlackConfig) error { fedObj := &v1beta1.FederatedSlackConfig{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -577,7 +577,7 @@ func (c *Controller) syncFederatedSlackConfig(obj *v2.SlackConfig) error { return nil } -func (c *Controller) syncFederatedSlackReceiver(obj *v2.SlackReceiver) error { +func (c *Controller) syncFederatedSlackReceiver(obj *v2alpha1.SlackReceiver) error { fedObj := &v1beta1.FederatedSlackReceiver{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -633,7 +633,7 @@ func (c *Controller) syncFederatedSlackReceiver(obj *v2.SlackReceiver) error { return nil } -func (c *Controller) syncFederatedWebhookConfig(obj *v2.WebhookConfig) error { +func (c *Controller) syncFederatedWebhookConfig(obj *v2alpha1.WebhookConfig) error { fedObj := &v1beta1.FederatedWebhookConfig{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -689,7 +689,7 @@ func (c *Controller) syncFederatedWebhookConfig(obj *v2.WebhookConfig) error { return nil } -func (c *Controller) syncFederatedWebhookReceiver(obj *v2.WebhookReceiver) error { +func (c *Controller) syncFederatedWebhookReceiver(obj *v2alpha1.WebhookReceiver) error { fedObj := &v1beta1.FederatedWebhookReceiver{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -745,7 +745,7 @@ func (c *Controller) syncFederatedWebhookReceiver(obj *v2.WebhookReceiver) error return nil } -func (c *Controller) syncFederatedWechatConfig(obj *v2.WechatConfig) error { +func (c *Controller) syncFederatedWechatConfig(obj *v2alpha1.WechatConfig) error { fedObj := &v1beta1.FederatedWechatConfig{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) @@ -801,7 +801,7 @@ func (c *Controller) syncFederatedWechatConfig(obj *v2.WechatConfig) error { return nil } -func (c *Controller) syncFederatedWechatReceiver(obj *v2.WechatReceiver) error { +func (c *Controller) syncFederatedWechatReceiver(obj *v2alpha1.WechatReceiver) error { fedObj := &v1beta1.FederatedWechatReceiver{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) diff --git a/pkg/controller/notification/notification_controller_suite_test.go b/pkg/controller/notification/notification_controller_suite_test.go index 0a2d23362..3ddba360f 100644 --- a/pkg/controller/notification/notification_controller_suite_test.go +++ b/pkg/controller/notification/notification_controller_suite_test.go @@ -20,7 +20,7 @@ import ( "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/scheme" "kubesphere.io/kubesphere/pkg/apis" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" "path/filepath" "testing" @@ -53,7 +53,7 @@ var _ = BeforeSuite(func(done Done) { Expect(err).NotTo(HaveOccurred()) Expect(cfg).ToNot(BeNil()) - err = v2.AddToScheme(scheme.Scheme) + err = v2alpha1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) err = apis.AddToScheme(scheme.Scheme) diff --git a/pkg/controller/notification/notification_controller_test.go b/pkg/controller/notification/notification_controller_test.go index 1dcb06331..4bc0a1d9c 100644 --- a/pkg/controller/notification/notification_controller_test.go +++ b/pkg/controller/notification/notification_controller_test.go @@ -23,7 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" "kubesphere.io/kubesphere/pkg/constants" "sigs.k8s.io/controller-runtime/pkg/cache" @@ -126,7 +126,7 @@ var ( const timeout = time.Second * 30 const interval = time.Second * 1 - obj := &v2.DingTalkConfig{ + obj := &v2alpha1.DingTalkConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", Namespace: constants.NotificationSecretNamespace, diff --git a/pkg/models/notification/notification.go b/pkg/models/notification/notification.go index 42ed9bdda..807389f4f 100644 --- a/pkg/models/notification/notification.go +++ b/pkg/models/notification/notification.go @@ -11,7 +11,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/klog" "kubesphere.io/kubesphere/pkg/api" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" "kubesphere.io/kubesphere/pkg/apiserver/query" kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned" "kubesphere.io/kubesphere/pkg/constants" @@ -100,26 +100,26 @@ func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Ob } switch resource { - case v2.ResourcesPluralDingTalkConfig: - return o.ksClient.NotificationV2().DingTalkConfigs().Create(context.Background(), obj.(*v2.DingTalkConfig), v1.CreateOptions{}) - case v2.ResourcesPluralDingTalkReceiver: - return o.ksClient.NotificationV2().DingTalkReceivers().Create(context.Background(), obj.(*v2.DingTalkReceiver), v1.CreateOptions{}) - case v2.ResourcesPluralEmailConfig: - return o.ksClient.NotificationV2().EmailConfigs().Create(context.Background(), obj.(*v2.EmailConfig), v1.CreateOptions{}) - case v2.ResourcesPluralEmailReceiver: - return o.ksClient.NotificationV2().EmailReceivers().Create(context.Background(), obj.(*v2.EmailReceiver), v1.CreateOptions{}) - case v2.ResourcesPluralSlackConfig: - return o.ksClient.NotificationV2().SlackConfigs().Create(context.Background(), obj.(*v2.SlackConfig), v1.CreateOptions{}) - case v2.ResourcesPluralSlackReceiver: - return o.ksClient.NotificationV2().SlackReceivers().Create(context.Background(), obj.(*v2.SlackReceiver), v1.CreateOptions{}) - case v2.ResourcesPluralWebhookConfig: - return o.ksClient.NotificationV2().WebhookConfigs().Create(context.Background(), obj.(*v2.WebhookConfig), v1.CreateOptions{}) - case v2.ResourcesPluralWebhookReceiver: - return o.ksClient.NotificationV2().WebhookReceivers().Create(context.Background(), obj.(*v2.WebhookReceiver), v1.CreateOptions{}) - case v2.ResourcesPluralWechatConfig: - return o.ksClient.NotificationV2().WechatConfigs().Create(context.Background(), obj.(*v2.WechatConfig), v1.CreateOptions{}) - case v2.ResourcesPluralWechatReceiver: - return o.ksClient.NotificationV2().WechatReceivers().Create(context.Background(), obj.(*v2.WechatReceiver), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralDingTalkConfig: + return o.ksClient.NotificationV2alpha1().DingTalkConfigs().Create(context.Background(), obj.(*v2alpha1.DingTalkConfig), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralDingTalkReceiver: + return o.ksClient.NotificationV2alpha1().DingTalkReceivers().Create(context.Background(), obj.(*v2alpha1.DingTalkReceiver), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralEmailConfig: + return o.ksClient.NotificationV2alpha1().EmailConfigs().Create(context.Background(), obj.(*v2alpha1.EmailConfig), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralEmailReceiver: + return o.ksClient.NotificationV2alpha1().EmailReceivers().Create(context.Background(), obj.(*v2alpha1.EmailReceiver), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralSlackConfig: + return o.ksClient.NotificationV2alpha1().SlackConfigs().Create(context.Background(), obj.(*v2alpha1.SlackConfig), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralSlackReceiver: + return o.ksClient.NotificationV2alpha1().SlackReceivers().Create(context.Background(), obj.(*v2alpha1.SlackReceiver), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralWebhookConfig: + return o.ksClient.NotificationV2alpha1().WebhookConfigs().Create(context.Background(), obj.(*v2alpha1.WebhookConfig), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralWebhookReceiver: + return o.ksClient.NotificationV2alpha1().WebhookReceivers().Create(context.Background(), obj.(*v2alpha1.WebhookReceiver), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralWechatConfig: + return o.ksClient.NotificationV2alpha1().WechatConfigs().Create(context.Background(), obj.(*v2alpha1.WechatConfig), v1.CreateOptions{}) + case v2alpha1.ResourcesPluralWechatReceiver: + return o.ksClient.NotificationV2alpha1().WechatReceivers().Create(context.Background(), obj.(*v2alpha1.WechatReceiver), v1.CreateOptions{}) case "secrets": return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Create(context.Background(), obj.(*corev1.Secret), v1.CreateOptions{}) default: @@ -140,26 +140,26 @@ func (o *operator) Delete(user, resource, name string) error { } switch resource { - case v2.ResourcesPluralDingTalkConfig: - return o.ksClient.NotificationV2().DingTalkConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralDingTalkReceiver: - return o.ksClient.NotificationV2().DingTalkReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralEmailConfig: - return o.ksClient.NotificationV2().EmailConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralEmailReceiver: - return o.ksClient.NotificationV2().EmailReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralSlackConfig: - return o.ksClient.NotificationV2().SlackConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralSlackReceiver: - return o.ksClient.NotificationV2().SlackReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralWebhookConfig: - return o.ksClient.NotificationV2().WebhookConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralWebhookReceiver: - return o.ksClient.NotificationV2().WebhookReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralWechatConfig: - return o.ksClient.NotificationV2().WechatConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2.ResourcesPluralWechatReceiver: - return o.ksClient.NotificationV2().WechatReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralDingTalkConfig: + return o.ksClient.NotificationV2alpha1().DingTalkConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralDingTalkReceiver: + return o.ksClient.NotificationV2alpha1().DingTalkReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralEmailConfig: + return o.ksClient.NotificationV2alpha1().EmailConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralEmailReceiver: + return o.ksClient.NotificationV2alpha1().EmailReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralSlackConfig: + return o.ksClient.NotificationV2alpha1().SlackConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralSlackReceiver: + return o.ksClient.NotificationV2alpha1().SlackReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralWebhookConfig: + return o.ksClient.NotificationV2alpha1().WebhookConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralWebhookReceiver: + return o.ksClient.NotificationV2alpha1().WebhookReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralWechatConfig: + return o.ksClient.NotificationV2alpha1().WechatConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2alpha1.ResourcesPluralWechatReceiver: + return o.ksClient.NotificationV2alpha1().WechatReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) case "secrets": return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Delete(context.Background(), name, v1.DeleteOptions{}) default: @@ -184,26 +184,26 @@ func (o *operator) Update(user, resource, name string, obj runtime.Object) (runt } switch resource { - case v2.ResourcesPluralDingTalkConfig: - return o.ksClient.NotificationV2().DingTalkConfigs().Update(context.Background(), obj.(*v2.DingTalkConfig), v1.UpdateOptions{}) - case v2.ResourcesPluralDingTalkReceiver: - return o.ksClient.NotificationV2().DingTalkReceivers().Update(context.Background(), obj.(*v2.DingTalkReceiver), v1.UpdateOptions{}) - case v2.ResourcesPluralEmailConfig: - return o.ksClient.NotificationV2().EmailConfigs().Update(context.Background(), obj.(*v2.EmailConfig), v1.UpdateOptions{}) - case v2.ResourcesPluralEmailReceiver: - return o.ksClient.NotificationV2().EmailReceivers().Update(context.Background(), obj.(*v2.EmailReceiver), v1.UpdateOptions{}) - case v2.ResourcesPluralSlackConfig: - return o.ksClient.NotificationV2().SlackConfigs().Update(context.Background(), obj.(*v2.SlackConfig), v1.UpdateOptions{}) - case v2.ResourcesPluralSlackReceiver: - return o.ksClient.NotificationV2().SlackReceivers().Update(context.Background(), obj.(*v2.SlackReceiver), v1.UpdateOptions{}) - case v2.ResourcesPluralWebhookConfig: - return o.ksClient.NotificationV2().WebhookConfigs().Update(context.Background(), obj.(*v2.WebhookConfig), v1.UpdateOptions{}) - case v2.ResourcesPluralWebhookReceiver: - return o.ksClient.NotificationV2().WebhookReceivers().Update(context.Background(), obj.(*v2.WebhookReceiver), v1.UpdateOptions{}) - case v2.ResourcesPluralWechatConfig: - return o.ksClient.NotificationV2().WechatConfigs().Update(context.Background(), obj.(*v2.WechatConfig), v1.UpdateOptions{}) - case v2.ResourcesPluralWechatReceiver: - return o.ksClient.NotificationV2().WechatReceivers().Update(context.Background(), obj.(*v2.WechatReceiver), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralDingTalkConfig: + return o.ksClient.NotificationV2alpha1().DingTalkConfigs().Update(context.Background(), obj.(*v2alpha1.DingTalkConfig), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralDingTalkReceiver: + return o.ksClient.NotificationV2alpha1().DingTalkReceivers().Update(context.Background(), obj.(*v2alpha1.DingTalkReceiver), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralEmailConfig: + return o.ksClient.NotificationV2alpha1().EmailConfigs().Update(context.Background(), obj.(*v2alpha1.EmailConfig), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralEmailReceiver: + return o.ksClient.NotificationV2alpha1().EmailReceivers().Update(context.Background(), obj.(*v2alpha1.EmailReceiver), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralSlackConfig: + return o.ksClient.NotificationV2alpha1().SlackConfigs().Update(context.Background(), obj.(*v2alpha1.SlackConfig), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralSlackReceiver: + return o.ksClient.NotificationV2alpha1().SlackReceivers().Update(context.Background(), obj.(*v2alpha1.SlackReceiver), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralWebhookConfig: + return o.ksClient.NotificationV2alpha1().WebhookConfigs().Update(context.Background(), obj.(*v2alpha1.WebhookConfig), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralWebhookReceiver: + return o.ksClient.NotificationV2alpha1().WebhookReceivers().Update(context.Background(), obj.(*v2alpha1.WebhookReceiver), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralWechatConfig: + return o.ksClient.NotificationV2alpha1().WechatConfigs().Update(context.Background(), obj.(*v2alpha1.WechatConfig), v1.UpdateOptions{}) + case v2alpha1.ResourcesPluralWechatReceiver: + return o.ksClient.NotificationV2alpha1().WechatReceivers().Update(context.Background(), obj.(*v2alpha1.WechatReceiver), v1.UpdateOptions{}) case "secrets": return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Update(context.Background(), obj.(*corev1.Secret), v1.UpdateOptions{}) default: @@ -214,26 +214,26 @@ func (o *operator) Update(user, resource, name string, obj runtime.Object) (runt func (o *operator) GetObject(resource string) runtime.Object { switch resource { - case v2.ResourcesPluralDingTalkConfig: - return &v2.DingTalkConfig{} - case v2.ResourcesPluralDingTalkReceiver: - return &v2.DingTalkReceiver{} - case v2.ResourcesPluralEmailConfig: - return &v2.EmailConfig{} - case v2.ResourcesPluralEmailReceiver: - return &v2.EmailReceiver{} - case v2.ResourcesPluralSlackConfig: - return &v2.SlackConfig{} - case v2.ResourcesPluralSlackReceiver: - return &v2.SlackReceiver{} - case v2.ResourcesPluralWebhookConfig: - return &v2.WebhookConfig{} - case v2.ResourcesPluralWebhookReceiver: - return &v2.WebhookReceiver{} - case v2.ResourcesPluralWechatConfig: - return &v2.WechatConfig{} - case v2.ResourcesPluralWechatReceiver: - return &v2.WechatReceiver{} + case v2alpha1.ResourcesPluralDingTalkConfig: + return &v2alpha1.DingTalkConfig{} + case v2alpha1.ResourcesPluralDingTalkReceiver: + return &v2alpha1.DingTalkReceiver{} + case v2alpha1.ResourcesPluralEmailConfig: + return &v2alpha1.EmailConfig{} + case v2alpha1.ResourcesPluralEmailReceiver: + return &v2alpha1.EmailReceiver{} + case v2alpha1.ResourcesPluralSlackConfig: + return &v2alpha1.SlackConfig{} + case v2alpha1.ResourcesPluralSlackReceiver: + return &v2alpha1.SlackReceiver{} + case v2alpha1.ResourcesPluralWebhookConfig: + return &v2alpha1.WebhookConfig{} + case v2alpha1.ResourcesPluralWebhookReceiver: + return &v2alpha1.WebhookReceiver{} + case v2alpha1.ResourcesPluralWechatConfig: + return &v2alpha1.WechatConfig{} + case v2alpha1.ResourcesPluralWechatReceiver: + return &v2alpha1.WechatReceiver{} case "secrets": return &corev1.Secret{} default: @@ -254,13 +254,13 @@ func (o *operator) IsKnownResource(resource string) bool { func authorizer(user string, obj runtime.Object) error { // If the user is not nil, it must equal to the tenant specified in labels of the object. if user != "" && !isOwner(user, obj) { - return errors.NewForbidden(v2.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", + return errors.NewForbidden(v2alpha1.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", fmt.Errorf("user '%s' is not the owner of object", user)) } // If the user is nil, the object must be a global object. if user == "" && !isGlobal(obj) { - return errors.NewForbidden(v2.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", + return errors.NewForbidden(v2alpha1.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", fmt.Errorf("object is not a global object")) } @@ -281,7 +281,7 @@ func isOwner(user string, obj interface{}) bool { func isConfig(obj runtime.Object) bool { switch obj.(type) { - case *v2.DingTalkConfig, *v2.EmailConfig, *v2.SlackConfig, *v2.WebhookConfig, *v2.WechatConfig: + case *v2alpha1.DingTalkConfig, *v2alpha1.EmailConfig, *v2alpha1.SlackConfig, *v2alpha1.WebhookConfig, *v2alpha1.WechatConfig: return true default: return false diff --git a/pkg/models/resources/v1alpha3/notification/notification.go b/pkg/models/resources/v1alpha3/notification/notification.go index aa77737ad..92e3aee69 100644 --- a/pkg/models/resources/v1alpha3/notification/notification.go +++ b/pkg/models/resources/v1alpha3/notification/notification.go @@ -34,11 +34,11 @@ func NewDingTalkConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha } func (g *dingtalkConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().DingTalkConfigs().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().DingTalkConfigs().Lister().Get(name) } func (g *dingtalkConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().DingTalkConfigs().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().DingTalkConfigs().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -59,11 +59,11 @@ func NewDingTalkReceiverGetter(informer ksinformers.SharedInformerFactory) v1alp } func (g *dingtalkReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().DingTalkReceivers().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().DingTalkReceivers().Lister().Get(name) } func (g *dingtalkReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().DingTalkReceivers().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().DingTalkReceivers().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -84,11 +84,11 @@ func NewEmailConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.I } func (g *emailConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().EmailConfigs().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().EmailConfigs().Lister().Get(name) } func (g *emailConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().EmailConfigs().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().EmailConfigs().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -109,11 +109,11 @@ func NewEmailReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3 } func (g *emailReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().EmailReceivers().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().EmailReceivers().Lister().Get(name) } func (g *emailReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().EmailReceivers().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().EmailReceivers().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -134,11 +134,11 @@ func NewSlackConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.I } func (g *slackConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().SlackConfigs().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().SlackConfigs().Lister().Get(name) } func (g *slackConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().SlackConfigs().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().SlackConfigs().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -159,11 +159,11 @@ func NewSlackReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3 } func (g *slackReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().SlackReceivers().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().SlackReceivers().Lister().Get(name) } func (g *slackReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().SlackReceivers().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().SlackReceivers().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -184,11 +184,11 @@ func NewWebhookConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3 } func (g *webhookConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().WebhookConfigs().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().WebhookConfigs().Lister().Get(name) } func (g *webhookConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().WebhookConfigs().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().WebhookConfigs().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -209,11 +209,11 @@ func NewWebhookReceiverGetter(informer ksinformers.SharedInformerFactory) v1alph } func (g *webhookReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().WebhookReceivers().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().WebhookReceivers().Lister().Get(name) } func (g *webhookReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().WebhookReceivers().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().WebhookReceivers().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -234,11 +234,11 @@ func NewWechatConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3. } func (g *wechatConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().WechatConfigs().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().WechatConfigs().Lister().Get(name) } func (g *wechatConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().WechatConfigs().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().WechatConfigs().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -259,11 +259,11 @@ func NewWechatReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha } func (g *wechatReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2().WechatReceivers().Lister().Get(name) + return g.ksInformer.Notification().V2alpha1().WechatReceivers().Lister().Get(name) } func (g *wechatReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2().WechatReceivers().Lister().List(query.Selector()) + objs, err := g.ksInformer.Notification().V2alpha1().WechatReceivers().Lister().List(query.Selector()) if err != nil { return nil, err } diff --git a/pkg/models/resources/v1alpha3/notification/notification_test.go b/pkg/models/resources/v1alpha3/notification/notification_test.go index e8023250c..52bbb0b1a 100644 --- a/pkg/models/resources/v1alpha3/notification/notification_test.go +++ b/pkg/models/resources/v1alpha3/notification/notification_test.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/cache" "kubesphere.io/kubesphere/pkg/api" - v2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" "kubesphere.io/kubesphere/pkg/apiserver/query" "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" ksinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" @@ -47,43 +47,43 @@ func TestListObjects(t *testing.T) { }{ { "test name filter", - v2.ResourcesPluralDingTalkConfig, + v2alpha1.ResourcesPluralDingTalkConfig, }, { "test name filter", - v2.ResourcesPluralDingTalkReceiver, + v2alpha1.ResourcesPluralDingTalkReceiver, }, { "test name filter", - v2.ResourcesPluralEmailConfig, + v2alpha1.ResourcesPluralEmailConfig, }, { "test name filter", - v2.ResourcesPluralEmailReceiver, + v2alpha1.ResourcesPluralEmailReceiver, }, { "test name filter", - v2.ResourcesPluralSlackConfig, + v2alpha1.ResourcesPluralSlackConfig, }, { "test name filter", - v2.ResourcesPluralSlackReceiver, + v2alpha1.ResourcesPluralSlackReceiver, }, { "test name filter", - v2.ResourcesPluralWebhookConfig, + v2alpha1.ResourcesPluralWebhookConfig, }, { "test name filter", - v2.ResourcesPluralWebhookReceiver, + v2alpha1.ResourcesPluralWebhookReceiver, }, { "test name filter", - v2.ResourcesPluralWechatConfig, + v2alpha1.ResourcesPluralWechatConfig, }, { "test name filter", - v2.ResourcesPluralWechatReceiver, + v2alpha1.ResourcesPluralWechatReceiver, }, } @@ -128,48 +128,48 @@ func prepare(key string) (v1alpha3.Interface, []interface{}, error) { var indexer cache.Indexer var getter func(informer ksinformers.SharedInformerFactory) v1alpha3.Interface switch key { - case v2.ResourcesPluralDingTalkConfig: - indexer = informer.Notification().V2().DingTalkConfigs().Informer().GetIndexer() + case v2alpha1.ResourcesPluralDingTalkConfig: + indexer = informer.Notification().V2alpha1().DingTalkConfigs().Informer().GetIndexer() getter = NewDingTalkConfigGetter - obj = &v2.DingTalkConfig{} - case v2.ResourcesPluralDingTalkReceiver: - indexer = informer.Notification().V2().DingTalkReceivers().Informer().GetIndexer() + obj = &v2alpha1.DingTalkConfig{} + case v2alpha1.ResourcesPluralDingTalkReceiver: + indexer = informer.Notification().V2alpha1().DingTalkReceivers().Informer().GetIndexer() getter = NewDingTalkReceiverGetter - obj = &v2.DingTalkReceiver{} - case v2.ResourcesPluralEmailConfig: - indexer = informer.Notification().V2().EmailConfigs().Informer().GetIndexer() + obj = &v2alpha1.DingTalkReceiver{} + case v2alpha1.ResourcesPluralEmailConfig: + indexer = informer.Notification().V2alpha1().EmailConfigs().Informer().GetIndexer() getter = NewEmailConfigGetter - obj = &v2.EmailConfig{} - case v2.ResourcesPluralEmailReceiver: - indexer = informer.Notification().V2().EmailReceivers().Informer().GetIndexer() + obj = &v2alpha1.EmailConfig{} + case v2alpha1.ResourcesPluralEmailReceiver: + indexer = informer.Notification().V2alpha1().EmailReceivers().Informer().GetIndexer() getter = NewEmailReceiverGetter - obj = &v2.EmailReceiver{} - case v2.ResourcesPluralSlackConfig: - indexer = informer.Notification().V2().SlackConfigs().Informer().GetIndexer() + obj = &v2alpha1.EmailReceiver{} + case v2alpha1.ResourcesPluralSlackConfig: + indexer = informer.Notification().V2alpha1().SlackConfigs().Informer().GetIndexer() getter = NewSlackConfigGetter - obj = &v2.SlackConfig{} - case v2.ResourcesPluralSlackReceiver: - indexer = informer.Notification().V2().SlackReceivers().Informer().GetIndexer() + obj = &v2alpha1.SlackConfig{} + case v2alpha1.ResourcesPluralSlackReceiver: + indexer = informer.Notification().V2alpha1().SlackReceivers().Informer().GetIndexer() getter = NewSlackReceiverGetter - obj = &v2.SlackReceiver{} - case v2.ResourcesPluralWebhookConfig: - indexer = informer.Notification().V2().WebhookConfigs().Informer().GetIndexer() + obj = &v2alpha1.SlackReceiver{} + case v2alpha1.ResourcesPluralWebhookConfig: + indexer = informer.Notification().V2alpha1().WebhookConfigs().Informer().GetIndexer() getter = NewWebhookConfigGetter - obj = &v2.WebhookConfig{} - case v2.ResourcesPluralWebhookReceiver: - indexer = informer.Notification().V2().WebhookReceivers().Informer().GetIndexer() + obj = &v2alpha1.WebhookConfig{} + case v2alpha1.ResourcesPluralWebhookReceiver: + indexer = informer.Notification().V2alpha1().WebhookReceivers().Informer().GetIndexer() getter = NewWebhookReceiverGetter - obj = &v2.WebhookReceiver{} - case v2.ResourcesPluralWechatConfig: - indexer = informer.Notification().V2().WechatConfigs().Informer().GetIndexer() + obj = &v2alpha1.WebhookReceiver{} + case v2alpha1.ResourcesPluralWechatConfig: + indexer = informer.Notification().V2alpha1().WechatConfigs().Informer().GetIndexer() getter = NewWechatConfigGetter - obj = &v2.WechatConfig{} - case v2.ResourcesPluralWechatReceiver: - indexer = informer.Notification().V2().WechatReceivers().Informer().GetIndexer() + obj = &v2alpha1.WechatConfig{} + case v2alpha1.ResourcesPluralWechatReceiver: + indexer = informer.Notification().V2alpha1().WechatReceivers().Informer().GetIndexer() getter = NewWechatReceiverGetter - obj = &v2.WechatReceiver{} + obj = &v2alpha1.WechatReceiver{} default: - return nil, nil, errors.New("unkonwed type %s", key) + return nil, nil, errors.New("unowned type %s", key) } num := rand.Intn(LengthMax) diff --git a/pkg/models/resources/v1alpha3/resource/resource.go b/pkg/models/resources/v1alpha3/resource/resource.go index 23f1e82c3..a205b0922 100644 --- a/pkg/models/resources/v1alpha3/resource/resource.go +++ b/pkg/models/resources/v1alpha3/resource/resource.go @@ -26,7 +26,7 @@ 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" - notificationv2 "kubesphere.io/kubesphere/pkg/apis/notification/v2" + notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2" typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" @@ -126,16 +126,16 @@ func NewResourceGetter(factory informers.InformerFactory, cache cache.Cache) *Re getters[schema.GroupVersionResource{Group: "cluster.kubesphere.io", Version: "v1alpha1", Resource: "clusters"}] = cluster.New(factory.KubeSphereSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "v1", Resource: "customresourcedefinitions"}] = customresourcedefinition.New(factory.ApiExtensionSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralDingTalkConfig)] = notification.NewDingTalkConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralDingTalkReceiver)] = notification.NewDingTalkReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralEmailConfig)] = notification.NewEmailConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralEmailReceiver)] = notification.NewEmailReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralSlackConfig)] = notification.NewSlackConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralSlackReceiver)] = notification.NewSlackReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWebhookConfig)] = notification.NewWebhookConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWebhookReceiver)] = notification.NewWebhookReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWechatConfig)] = notification.NewWechatConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2.SchemeGroupVersion.WithResource(notificationv2.ResourcesPluralWechatReceiver)] = notification.NewWechatReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralDingTalkConfig)] = notification.NewDingTalkConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralDingTalkReceiver)] = notification.NewDingTalkReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralEmailConfig)] = notification.NewEmailConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralEmailReceiver)] = notification.NewEmailReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralSlackConfig)] = notification.NewSlackConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralSlackReceiver)] = notification.NewSlackReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWebhookConfig)] = notification.NewWebhookConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWebhookReceiver)] = notification.NewWebhookReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWechatConfig)] = notification.NewWechatConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWechatReceiver)] = notification.NewWechatReceiverGetter(factory.KubeSphereSharedInformerFactory()) // federated resources getters[typesv1beta1.SchemeGroupVersion.WithResource(typesv1beta1.ResourcePluralFederatedNamespace)] = federatednamespace.New(factory.KubeSphereSharedInformerFactory()) From d6d2cf002fd91c7bc94f2822661dca03722381a5 Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Wed, 3 Mar 2021 09:48:51 +0800 Subject: [PATCH 6/7] 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" From e3cf58e84b286d311b9675aee9f34d8cdef1730d Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Wed, 10 Mar 2021 18:36:54 +0800 Subject: [PATCH 7/7] Integrate all receivers into one crd, and all configs into another crd Signed-off-by: wanjunlei --- .../notification.kubesphere.io_configs.yaml | 283 +++ ...ication.kubesphere.io_dingtalkconfigs.yaml | 83 - ...ation.kubesphere.io_dingtalkreceivers.yaml | 158 -- ...tification.kubesphere.io_emailconfigs.yaml | 167 -- ...fication.kubesphere.io_emailreceivers.yaml | 116 -- ...on.kubesphere.io_notificationmanagers.yaml | 1519 ----------------- .../notification.kubesphere.io_receivers.yaml | 590 +++++++ ...tification.kubesphere.io_slackconfigs.yaml | 64 - ...fication.kubesphere.io_slackreceivers.yaml | 114 -- ...fication.kubesphere.io_webhookconfigs.yaml | 48 - ...cation.kubesphere.io_webhookreceivers.yaml | 239 --- ...ification.kubesphere.io_wechatconfigs.yaml | 77 - ...ication.kubesphere.io_wechatreceivers.yaml | 115 -- ...s.kubefed.io_federateddingtalkconfigs.yaml | 197 --- ...kubefed.io_federateddingtalkreceivers.yaml | 272 --- ...ypes.kubefed.io_federatedemailconfigs.yaml | 281 --- ...es.kubefed.io_federatedemailreceivers.yaml | 230 --- ...efed.io_federatednotificationconfigs.yaml} | 244 +-- ...fed.io_federatednotificationreceivers.yaml | 700 ++++++++ ...ypes.kubefed.io_federatedslackconfigs.yaml | 178 -- ...es.kubefed.io_federatedslackreceivers.yaml | 228 --- ...es.kubefed.io_federatedwebhookconfigs.yaml | 162 -- ...pes.kubefed.io_federatedwechatconfigs.yaml | 191 --- ...s.kubefed.io_federatedwechatreceivers.yaml | 229 --- hack/generate_client.sh | 2 +- ...go => addtoscheme_notification_v2beta1.go} | 4 +- .../v2alpha1/dingtalkconfig_types.go | 66 - .../v2alpha1/dingtalkreceiver_types.go | 81 - .../v2alpha1/emailconfig_types.go | 78 - .../v2alpha1/emailreceiver_types.go | 62 - .../v2alpha1/slackconfig_types.go | 58 - .../v2alpha1/slackreceiver_types.go | 62 - pkg/apis/notification/v2alpha1/types.go | 41 - .../v2alpha1/webhookconfig_types.go | 56 - .../v2alpha1/wechatconfig_types.go | 64 - .../v2alpha1/wechatreceiver_types.go | 64 - pkg/apis/notification/v2beta1/config_types.go | 161 ++ .../notification/{v2alpha1 => v2beta1}/doc.go | 4 +- .../notificationmanager_types.go | 8 +- .../receiver_types.go} | 127 +- .../{v2alpha1 => v2beta1}/register.go | 6 +- pkg/apis/notification/v2beta1/types.go | 27 + .../v2beta1_suite_test.go} | 2 +- .../zz_generated.deepcopy.go | 1227 +++++-------- .../federateddingtalkreceiver_types.go | 62 - .../v1beta1/federatedemailconfig_types.go | 62 - .../v1beta1/federatedemailreceiver_types.go | 62 - ...o => federatednotificationconfig_types.go} | 30 +- ...=> federatednotificationreceiver_types.go} | 30 +- .../v1beta1/federatedslackconfig_types.go | 62 - .../v1beta1/federatedslackreceiver_types.go | 62 - .../v1beta1/federatedwebhookconfig_types.go | 62 - .../v1beta1/federatedwebhookreceiver_types.go | 62 - .../v1beta1/federatedwechatreceiver_types.go | 62 - pkg/apis/types/v1beta1/register.go | 24 +- .../types/v1beta1/zz_generated.deepcopy.go | 1314 +++----------- pkg/apiserver/apiserver.go | 31 +- pkg/client/clientset/versioned/clientset.go | 18 +- .../versioned/fake/clientset_generated.go | 10 +- .../clientset/versioned/fake/register.go | 4 +- .../clientset/versioned/scheme/register.go | 4 +- .../notification/v2alpha1/dingtalkconfig.go | 184 -- .../notification/v2alpha1/dingtalkreceiver.go | 184 -- .../notification/v2alpha1/emailconfig.go | 184 -- .../notification/v2alpha1/emailreceiver.go | 184 -- .../v2alpha1/fake/fake_dingtalkconfig.go | 133 -- .../v2alpha1/fake/fake_dingtalkreceiver.go | 133 -- .../v2alpha1/fake/fake_emailconfig.go | 133 -- .../v2alpha1/fake/fake_emailreceiver.go | 133 -- .../v2alpha1/fake/fake_notification_client.go | 76 - .../v2alpha1/fake/fake_slackconfig.go | 133 -- .../v2alpha1/fake/fake_slackreceiver.go | 133 -- .../v2alpha1/fake/fake_webhookconfig.go | 133 -- .../v2alpha1/fake/fake_webhookreceiver.go | 133 -- .../v2alpha1/fake/fake_wechatconfig.go | 133 -- .../v2alpha1/fake/fake_wechatreceiver.go | 133 -- .../v2alpha1/notification_client.go | 134 -- .../notification/v2alpha1/slackconfig.go | 184 -- .../notification/v2alpha1/slackreceiver.go | 184 -- .../notification/v2alpha1/webhookconfig.go | 184 -- .../notification/v2alpha1/webhookreceiver.go | 184 -- .../notification/v2alpha1/wechatconfig.go | 184 -- .../notification/v2alpha1/wechatreceiver.go | 184 -- .../typed/notification/v2beta1/config.go | 184 ++ .../notification/{v2alpha1 => v2beta1}/doc.go | 2 +- .../{v2alpha1 => v2beta1}/fake/doc.go | 0 .../notification/v2beta1/fake/fake_config.go | 133 ++ .../v2beta1/fake/fake_notification_client.go | 44 + .../v2beta1/fake/fake_receiver.go | 133 ++ .../generated_expansion.go | 22 +- .../v2beta1/notification_client.go | 94 + .../typed/notification/v2beta1/receiver.go | 184 ++ .../informers/externalversions/generic.go | 28 +- .../notification/interface.go | 12 +- .../notification/v2alpha1/dingtalkconfig.go | 89 - .../notification/v2alpha1/dingtalkreceiver.go | 89 - .../notification/v2alpha1/emailreceiver.go | 89 - .../notification/v2alpha1/interface.go | 108 -- .../notification/v2alpha1/slackreceiver.go | 89 - .../notification/v2alpha1/webhookconfig.go | 89 - .../notification/v2alpha1/webhookreceiver.go | 89 - .../notification/v2alpha1/wechatconfig.go | 89 - .../notification/v2alpha1/wechatreceiver.go | 89 - .../emailconfig.go => v2beta1/config.go} | 44 +- .../notification/v2beta1/interface.go | 52 + .../slackconfig.go => v2beta1/receiver.go} | 44 +- .../notification/v2alpha1/dingtalkconfig.go | 65 - .../notification/v2alpha1/dingtalkreceiver.go | 65 - .../notification/v2alpha1/emailconfig.go | 65 - .../notification/v2alpha1/emailreceiver.go | 65 - .../v2alpha1/expansion_generated.go | 59 - .../notification/v2alpha1/slackconfig.go | 65 - .../notification/v2alpha1/slackreceiver.go | 65 - .../notification/v2alpha1/webhookconfig.go | 65 - .../notification/v2alpha1/webhookreceiver.go | 65 - .../notification/v2alpha1/wechatconfig.go | 65 - .../notification/v2alpha1/wechatreceiver.go | 65 - .../listers/notification/v2beta1/config.go | 65 + .../v2beta1/expansion_generated.go | 27 + .../listers/notification/v2beta1/receiver.go | 65 + .../notification/notification_controller.go | 510 +----- .../notification_controller_suite_test.go | 4 +- .../notification_controller_test.go | 6 +- .../{v2alpha1 => v2beta1}/handler.go | 22 +- .../{v2alpha1 => v2beta1}/register.go | 39 +- pkg/models/notification/notification.go | 214 ++- pkg/models/notification/notification_test.go | 4 +- .../v1alpha3/notification/notification.go | 243 +-- .../notification/notification_test.go | 86 +- .../resources/v1alpha3/resource/resource.go | 14 +- 130 files changed, 3980 insertions(+), 13850 deletions(-) create mode 100644 config/crds/notification.kubesphere.io_configs.yaml delete mode 100644 config/crds/notification.kubesphere.io_dingtalkconfigs.yaml delete mode 100644 config/crds/notification.kubesphere.io_dingtalkreceivers.yaml delete mode 100644 config/crds/notification.kubesphere.io_emailconfigs.yaml delete mode 100644 config/crds/notification.kubesphere.io_emailreceivers.yaml delete mode 100644 config/crds/notification.kubesphere.io_notificationmanagers.yaml create mode 100644 config/crds/notification.kubesphere.io_receivers.yaml delete mode 100644 config/crds/notification.kubesphere.io_slackconfigs.yaml delete mode 100644 config/crds/notification.kubesphere.io_slackreceivers.yaml delete mode 100644 config/crds/notification.kubesphere.io_webhookconfigs.yaml delete mode 100644 config/crds/notification.kubesphere.io_webhookreceivers.yaml delete mode 100644 config/crds/notification.kubesphere.io_wechatconfigs.yaml delete mode 100644 config/crds/notification.kubesphere.io_wechatreceivers.yaml delete mode 100644 config/crds/types.kubefed.io_federateddingtalkconfigs.yaml delete mode 100644 config/crds/types.kubefed.io_federateddingtalkreceivers.yaml delete mode 100644 config/crds/types.kubefed.io_federatedemailconfigs.yaml delete mode 100644 config/crds/types.kubefed.io_federatedemailreceivers.yaml rename config/crds/{types.kubefed.io_federatedwebhookreceivers.yaml => types.kubefed.io_federatednotificationconfigs.yaml} (63%) create mode 100644 config/crds/types.kubefed.io_federatednotificationreceivers.yaml delete mode 100644 config/crds/types.kubefed.io_federatedslackconfigs.yaml delete mode 100644 config/crds/types.kubefed.io_federatedslackreceivers.yaml delete mode 100644 config/crds/types.kubefed.io_federatedwebhookconfigs.yaml delete mode 100644 config/crds/types.kubefed.io_federatedwechatconfigs.yaml delete mode 100644 config/crds/types.kubefed.io_federatedwechatreceivers.yaml rename pkg/apis/{addtoscheme_notification_v2alpha1.go => addtoscheme_notification_v2beta1.go} (82%) delete mode 100644 pkg/apis/notification/v2alpha1/dingtalkconfig_types.go delete mode 100644 pkg/apis/notification/v2alpha1/dingtalkreceiver_types.go delete mode 100644 pkg/apis/notification/v2alpha1/emailconfig_types.go delete mode 100644 pkg/apis/notification/v2alpha1/emailreceiver_types.go delete mode 100644 pkg/apis/notification/v2alpha1/slackconfig_types.go delete mode 100644 pkg/apis/notification/v2alpha1/slackreceiver_types.go delete mode 100644 pkg/apis/notification/v2alpha1/types.go delete mode 100644 pkg/apis/notification/v2alpha1/webhookconfig_types.go delete mode 100644 pkg/apis/notification/v2alpha1/wechatconfig_types.go delete mode 100644 pkg/apis/notification/v2alpha1/wechatreceiver_types.go create mode 100644 pkg/apis/notification/v2beta1/config_types.go rename pkg/apis/notification/{v2alpha1 => v2beta1}/doc.go (85%) rename pkg/apis/notification/{v2alpha1 => v2beta1}/notificationmanager_types.go (97%) rename pkg/apis/notification/{v2alpha1/webhookreceiver_types.go => v2beta1/receiver_types.go} (51%) rename pkg/apis/notification/{v2alpha1 => v2beta1}/register.go (89%) create mode 100644 pkg/apis/notification/v2beta1/types.go rename pkg/apis/notification/{v2alpha1/v2alpha1_suite_test.go => v2beta1/v2beta1_suite_test.go} (98%) rename pkg/apis/notification/{v2alpha1 => v2beta1}/zz_generated.deepcopy.go (59%) delete mode 100644 pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go delete mode 100644 pkg/apis/types/v1beta1/federatedemailconfig_types.go delete mode 100644 pkg/apis/types/v1beta1/federatedemailreceiver_types.go rename pkg/apis/types/v1beta1/{federateddingtalkconfig_types.go => federatednotificationconfig_types.go} (58%) rename pkg/apis/types/v1beta1/{federatedwechatconfig_types.go => federatednotificationreceiver_types.go} (56%) delete mode 100644 pkg/apis/types/v1beta1/federatedslackconfig_types.go delete mode 100644 pkg/apis/types/v1beta1/federatedslackreceiver_types.go delete mode 100644 pkg/apis/types/v1beta1/federatedwebhookconfig_types.go delete mode 100644 pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go delete mode 100644 pkg/apis/types/v1beta1/federatedwechatreceiver_types.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/emailconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/emailreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_notification_client.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/notification_client.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/slackconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/slackreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookreceiver.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatconfig.go delete mode 100644 pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatreceiver.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2beta1/config.go rename pkg/client/clientset/versioned/typed/notification/{v2alpha1 => v2beta1}/doc.go (97%) rename pkg/client/clientset/versioned/typed/notification/{v2alpha1 => v2beta1}/fake/doc.go (100%) create mode 100644 pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_config.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_notification_client.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_receiver.go rename pkg/client/clientset/versioned/typed/notification/{v2alpha1 => v2beta1}/generated_expansion.go (59%) create mode 100644 pkg/client/clientset/versioned/typed/notification/v2beta1/notification_client.go create mode 100644 pkg/client/clientset/versioned/typed/notification/v2beta1/receiver.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/dingtalkconfig.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/dingtalkreceiver.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/emailreceiver.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/interface.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/slackreceiver.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/webhookconfig.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/webhookreceiver.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/wechatconfig.go delete mode 100644 pkg/client/informers/externalversions/notification/v2alpha1/wechatreceiver.go rename pkg/client/informers/externalversions/notification/{v2alpha1/emailconfig.go => v2beta1/config.go} (52%) create mode 100644 pkg/client/informers/externalversions/notification/v2beta1/interface.go rename pkg/client/informers/externalversions/notification/{v2alpha1/slackconfig.go => v2beta1/receiver.go} (52%) delete mode 100644 pkg/client/listers/notification/v2alpha1/dingtalkconfig.go delete mode 100644 pkg/client/listers/notification/v2alpha1/dingtalkreceiver.go delete mode 100644 pkg/client/listers/notification/v2alpha1/emailconfig.go delete mode 100644 pkg/client/listers/notification/v2alpha1/emailreceiver.go delete mode 100644 pkg/client/listers/notification/v2alpha1/expansion_generated.go delete mode 100644 pkg/client/listers/notification/v2alpha1/slackconfig.go delete mode 100644 pkg/client/listers/notification/v2alpha1/slackreceiver.go delete mode 100644 pkg/client/listers/notification/v2alpha1/webhookconfig.go delete mode 100644 pkg/client/listers/notification/v2alpha1/webhookreceiver.go delete mode 100644 pkg/client/listers/notification/v2alpha1/wechatconfig.go delete mode 100644 pkg/client/listers/notification/v2alpha1/wechatreceiver.go create mode 100644 pkg/client/listers/notification/v2beta1/config.go create mode 100644 pkg/client/listers/notification/v2beta1/expansion_generated.go create mode 100644 pkg/client/listers/notification/v2beta1/receiver.go rename pkg/kapis/notification/{v2alpha1 => v2beta1}/handler.go (86%) rename pkg/kapis/notification/{v2alpha1 => v2beta1}/register.go (66%) diff --git a/config/crds/notification.kubesphere.io_configs.yaml b/config/crds/notification.kubesphere.io_configs.yaml new file mode 100644 index 000000000..d86a2b6f8 --- /dev/null +++ b/config/crds/notification.kubesphere.io_configs.yaml @@ -0,0 +1,283 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: configs.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + categories: + - notification-manager + kind: Config + listKind: ConfigList + plural: configs + shortNames: + - nc + singular: config + scope: Cluster + versions: + - name: v2beta1 + schema: + openAPIV3Schema: + description: DingTalkConfig is the Schema for the dingtalkconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ConfigSpec defines the desired state of Config + properties: + dingtalk: + properties: + conversation: + description: Only needed when send alerts to the conversation. + properties: + appkey: + description: The key of the application with which to send messages. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + appsecret: + description: The key in the secret to be used. Must be a valid secret key. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + labels: + additionalProperties: + type: string + type: object + type: object + email: + properties: + authIdentify: + description: The identity for PLAIN authentication. + type: string + authPassword: + description: The secret contains the SMTP password for LOGIN and PLAIN authentications. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + authSecret: + description: The secret contains the SMTP secret for CRAM-MD5 authentication. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + authUsername: + description: The username for CRAM-MD5, LOGIN and PLAIN authentications. + type: string + from: + description: The sender address. + type: string + hello: + description: The hostname to use when identifying to the SMTP server. + type: string + labels: + additionalProperties: + type: string + type: object + requireTLS: + description: The default SMTP TLS requirement. + type: boolean + smartHost: + description: The address of the SMTP server. + properties: + host: + type: string + port: + type: integer + required: + - host + - port + type: object + tls: + description: TLSConfig configures the options for TLS connections. + properties: + clientCertificate: + description: The certificate of the client. + properties: + cert: + description: The client cert file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + key: + description: The client key file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + insecureSkipVerify: + description: Disable target certificate validation. + type: boolean + rootCA: + description: RootCA defines the root certificate authorities that clients use when verifying server certificates. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + serverName: + description: Used to verify the hostname for the targets. + type: string + type: object + required: + - from + - smartHost + type: object + slack: + properties: + labels: + additionalProperties: + type: string + type: object + slackTokenSecret: + description: The token of user or bot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + webhook: + properties: + labels: + additionalProperties: + type: string + type: object + type: object + wechat: + properties: + labels: + additionalProperties: + type: string + type: object + wechatApiAgentId: + description: The id of the application which sending message. + type: string + wechatApiCorpId: + description: The corp id for authentication. + type: string + wechatApiSecret: + description: The API key to use when talking to the WeChat API. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + wechatApiUrl: + description: The WeChat API URL. + type: string + required: + - wechatApiAgentId + - wechatApiCorpId + - wechatApiSecret + type: object + type: object + status: + description: ConfigStatus defines the observed state of Config + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml b/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml deleted file mode 100644 index fa54137a5..000000000 --- a/config/crds/notification.kubesphere.io_dingtalkconfigs.yaml +++ /dev/null @@ -1,83 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: dingtalkconfigs.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: DingTalkConfig - listKind: DingTalkConfigList - plural: dingtalkconfigs - shortNames: - - dc - singular: dingtalkconfig - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: DingTalkConfig is the Schema for the dingtalkconfigs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: DingTalkConfigSpec defines the desired state of DingTalkConfig - properties: - conversation: - description: Only needed when send alerts to the conversation. - properties: - appkey: - description: The key of the application with which to send messages. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - appsecret: - description: The key in the secret to be used. Must be a valid secret key. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - type: object - type: object - status: - description: DingTalkConfigStatus defines the observed state of DingTalkConfig - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml b/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml deleted file mode 100644 index 00a64b934..000000000 --- a/config/crds/notification.kubesphere.io_dingtalkreceivers.yaml +++ /dev/null @@ -1,158 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: dingtalkreceivers.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: DingTalkReceiver - listKind: DingTalkReceiverList - plural: dingtalkreceivers - shortNames: - - dr - singular: dingtalkreceiver - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: DingTalkReceiver is the Schema for the dingtalkreceivers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: DingTalkReceiverSpec defines the desired state of DingTalkReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - chatbot: - description: Be careful, a ChatBot only can send 20 message per minute. - properties: - keywords: - description: Custom keywords of ChatBot - items: - type: string - type: array - secret: - description: Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - webhook: - description: The webhook of ChatBot which the message will send to. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - required: - - webhook - type: object - conversation: - description: The conversation which message will send to. - properties: - chatid: - type: string - required: - - chatid - type: object - dingtalkConfigSelector: - description: DingTalkConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - type: object - status: - description: DingTalkReceiverStatus defines the observed state of DingTalkReceiver - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_emailconfigs.yaml b/config/crds/notification.kubesphere.io_emailconfigs.yaml deleted file mode 100644 index 104602f31..000000000 --- a/config/crds/notification.kubesphere.io_emailconfigs.yaml +++ /dev/null @@ -1,167 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: emailconfigs.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: EmailConfig - listKind: EmailConfigList - plural: emailconfigs - shortNames: - - ec - singular: emailconfig - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: EmailConfig is the Schema for the emailconfigs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: EmailConfigSpec defines the desired state of EmailConfig - properties: - authIdentify: - description: The identity for PLAIN authentication. - type: string - authPassword: - description: The secret contains the SMTP password for LOGIN and PLAIN authentications. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - authSecret: - description: The secret contains the SMTP secret for CRAM-MD5 authentication. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - authUsername: - description: The username for CRAM-MD5, LOGIN and PLAIN authentications. - type: string - from: - description: The sender address. - type: string - hello: - description: The hostname to use when identifying to the SMTP server. - type: string - requireTLS: - description: The default SMTP TLS requirement. - type: boolean - smartHost: - description: The address of the SMTP server. - properties: - host: - type: string - port: - type: string - required: - - host - - port - type: object - tls: - description: TLSConfig configures the options for TLS connections. - properties: - clientCertificate: - description: The certificate of the client. - properties: - cert: - description: The client cert file for the targets. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - key: - description: The client key file for the targets. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - type: object - insecureSkipVerify: - description: Disable target certificate validation. - type: boolean - rootCA: - description: RootCA defines the root certificate authorities that clients use when verifying server certificates. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - serverName: - description: Used to verify the hostname for the targets. - type: string - type: object - required: - - from - - smartHost - type: object - status: - description: EmailConfigStatus defines the observed state of EmailConfig - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_emailreceivers.yaml b/config/crds/notification.kubesphere.io_emailreceivers.yaml deleted file mode 100644 index 10357914d..000000000 --- a/config/crds/notification.kubesphere.io_emailreceivers.yaml +++ /dev/null @@ -1,116 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: emailreceivers.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: EmailReceiver - listKind: EmailReceiverList - plural: emailreceivers - shortNames: - - er - singular: emailreceiver - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: EmailReceiver is the Schema for the emailreceivers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: EmailReceiverSpec defines the desired state of EmailReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - emailConfigSelector: - description: EmailConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - to: - description: Receivers' email addresses - items: - type: string - type: array - required: - - to - type: object - status: - description: EmailReceiverStatus defines the observed state of EmailReceiver - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_notificationmanagers.yaml b/config/crds/notification.kubesphere.io_notificationmanagers.yaml deleted file mode 100644 index a7de41b66..000000000 --- a/config/crds/notification.kubesphere.io_notificationmanagers.yaml +++ /dev/null @@ -1,1519 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: notificationmanagers.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: NotificationManager - listKind: NotificationManagerList - plural: notificationmanagers - shortNames: - - nm - singular: notificationmanager - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: NotificationManager is the Schema for the notificationmanagers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: NotificationManagerSpec defines the desired state of NotificationManager - properties: - affinity: - description: Pod's scheduling constraints. - properties: - nodeAffinity: - description: Describes node affinity scheduling rules for the pod. - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred. - items: - description: An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). - properties: - preference: - description: A node selector term, associated with the corresponding weight. - properties: - matchExpressions: - description: A list of node selector requirements by node's labels. - items: - description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: The label key that the selector applies to. - type: string - operator: - description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - description: A list of node selector requirements by node's fields. - items: - description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: The label key that the selector applies to. - type: string - operator: - description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - weight: - description: Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node. - properties: - nodeSelectorTerms: - description: Required. A list of node selector terms. The terms are ORed. - items: - description: A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. - properties: - matchExpressions: - description: A list of node selector requirements by node's labels. - items: - description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: The label key that the selector applies to. - type: string - operator: - description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - description: A list of node selector requirements by node's fields. - items: - description: A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: The label key that the selector applies to. - type: string - operator: - description: Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - type: array - required: - - nodeSelectorTerms - type: object - type: object - podAffinity: - description: Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, associated with the corresponding weight. - properties: - labelSelector: - description: A label query over a set of resources, in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - namespaces: - description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" - items: - type: string - type: array - topologyKey: - description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: weight associated with matching the corresponding podAffinityTerm, in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running - properties: - labelSelector: - description: A label query over a set of resources, in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - namespaces: - description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" - items: - type: string - type: array - topologyKey: - description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - description: Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)). - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, associated with the corresponding weight. - properties: - labelSelector: - description: A label query over a set of resources, in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - namespaces: - description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" - items: - type: string - type: array - topologyKey: - description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: weight associated with matching the corresponding podAffinityTerm, in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - description: If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running - properties: - labelSelector: - description: A label query over a set of resources, in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - namespaces: - description: namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace" - items: - type: string - type: array - topologyKey: - description: This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - type: object - type: object - args: - description: 'Arguments to the entrypoint. The docker image''s CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container''s environment. If a variable cannot be resolved, the reference in the input string will remain unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated.' - items: - type: string - type: array - defaultConfigSelector: - description: Default Email/Wechat/Slack/Webhook Config to be selected - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - image: - description: Docker Image used to start Notification Manager container, for example kubesphere/notification-manager:v0.1.0 - type: string - imagePullPolicy: - description: Image pull policy. One of Always, Never, IfNotPresent. Defaults to IfNotPresent if not specified - type: string - nodeSelector: - additionalProperties: - type: string - description: Define which Nodes the Pods will be scheduled to. - type: object - portName: - description: Port name used for the pods and service, defaults to webhook - type: string - receivers: - description: Receivers to send notifications to - properties: - globalReceiverSelector: - description: Selector to find global notification receivers which will be used when tenant receivers cannot be found. Only matchLabels expression is allowed. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - options: - description: Various receiver options - properties: - dingtalk: - properties: - chatBotThrottle: - description: The flow control fo chatbot. - properties: - maxWaitTime: - description: The maximum tolerable waiting time when the calls trigger flow control, if the actual waiting time is more than this time, it will return a error, else it will wait for the flow restriction lifted, and send the message. Nil means do not wait, the maximum value is `Unit`. - format: int64 - type: integer - threshold: - description: The maximum calls in `Unit`. - type: integer - unit: - description: A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years. - format: int64 - type: integer - type: object - chatbotMessageMaxSize: - description: The maximum message size that can be sent to chatbot in a request. - type: integer - conversationMessageMaxSize: - description: The maximum message size that can be sent to conversation in a request. - type: integer - conversationThrottle: - description: The flow control fo conversation. - properties: - maxWaitTime: - description: The maximum tolerable waiting time when the calls trigger flow control, if the actual waiting time is more than this time, it will return a error, else it will wait for the flow restriction lifted, and send the message. Nil means do not wait, the maximum value is `Unit`. - format: int64 - type: integer - threshold: - description: The maximum calls in `Unit`. - type: integer - unit: - description: A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years. - format: int64 - type: integer - type: object - notificationTimeout: - description: Notification Sending Timeout - format: int32 - type: integer - template: - description: The name of the template to generate DingTalk message. If the global template is not set, it will use default. - type: string - tokenExpires: - description: The time of token expired. - format: int64 - type: integer - type: object - email: - properties: - deliveryType: - description: Type of sending email, bulk or single - type: string - maxEmailReceivers: - description: The maximum size of receivers in one email. - type: integer - notificationTimeout: - description: Notification Sending Timeout - format: int32 - type: integer - subjectTemplate: - description: The name of the template to generate email subject - type: string - template: - description: The name of the template to generate email message. If the global template is not set, it will use default. - type: string - type: object - global: - properties: - cluster: - description: The name of the cluster in which the notification manager is deployed. - type: string - template: - description: The name of the template to generate message. If the receiver dose not setup template, it will use this. - type: string - templateFile: - description: Template file path, must be a absolute path. - items: - type: string - type: array - type: object - slack: - properties: - notificationTimeout: - description: Notification Sending Timeout - format: int32 - type: integer - template: - description: The name of the template to generate slack message. If the global template is not set, it will use default. - type: string - type: object - webhook: - properties: - notificationTimeout: - description: Notification Sending Timeout - format: int32 - type: integer - template: - description: The name of the template to generate webhook message. If the global template is not set, it will use default. - type: string - type: object - wechat: - properties: - messageMaxSize: - description: The maximum message size that can be sent in a request. - type: integer - notificationTimeout: - description: Notification Sending Timeout - format: int32 - type: integer - template: - description: The name of the template to generate wechat message. - type: string - tokenExpires: - description: The time of token expired. - format: int64 - type: integer - type: object - type: object - tenantKey: - description: Key used to identify tenant, default to be "namespace" if not specified - type: string - tenantReceiverSelector: - description: Selector to find tenant notification receivers. Only matchLabels expression is allowed. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - required: - - globalReceiverSelector - - tenantKey - - tenantReceiverSelector - type: object - replicas: - description: Number of instances to deploy for Notification Manager deployment. - format: int32 - type: integer - resources: - description: Compute Resources required by container. - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' - type: object - type: object - serviceAccountName: - description: ServiceAccountName is the name of the ServiceAccount to use to run Notification Manager Pods. ServiceAccount 'default' in notification manager's namespace will be used if not specified. - type: string - tolerations: - description: Pod's tolerations. - items: - description: The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator . - properties: - effect: - description: Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. - type: string - key: - description: Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. - type: string - operator: - description: Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category. - type: string - tolerationSeconds: - description: TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. - format: int64 - type: integer - value: - description: Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string. - type: string - type: object - type: array - volumeMounts: - description: Pod volumes to mount into the container's filesystem. Cannot be updated. - items: - description: VolumeMount describes a mounting of a Volume within a container. - properties: - mountPath: - description: Path within the container at which the volume should be mounted. Must not contain ':'. - type: string - mountPropagation: - description: mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. - type: string - name: - description: This must match the Name of a Volume. - type: string - readOnly: - description: Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false. - type: boolean - subPath: - description: Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root). - type: string - subPathExpr: - description: Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to "" (volume's root). SubPathExpr and SubPath are mutually exclusive. - type: string - required: - - mountPath - - name - type: object - type: array - volumes: - description: List of volumes that can be mounted by containers belonging to the pod. - items: - description: Volume represents a named volume in a pod that may be accessed by any container in the pod. - properties: - awsElasticBlockStore: - description: 'AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet''s host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' - properties: - fsType: - description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore TODO: how do we prevent errors in the filesystem from compromising the machine' - type: string - partition: - description: 'The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).' - format: int32 - type: integer - readOnly: - description: 'Specify "true" to force and set the ReadOnly property in VolumeMounts to "true". If omitted, the default is "false". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' - type: boolean - volumeID: - description: 'Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' - type: string - required: - - volumeID - type: object - azureDisk: - description: AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. - properties: - cachingMode: - description: 'Host Caching mode: None, Read Only, Read Write.' - type: string - diskName: - description: The Name of the data disk in the blob storage - type: string - diskURI: - description: The URI the data disk in the blob storage - type: string - fsType: - description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - kind: - description: 'Expected values Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared' - type: string - readOnly: - description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - description: AzureFile represents an Azure File Service mount on the host and bind mount to the pod. - properties: - readOnly: - description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. - type: boolean - secretName: - description: the name of secret that contains Azure Storage Account Name and Key - type: string - shareName: - description: Share Name - type: string - required: - - secretName - - shareName - type: object - cephfs: - description: CephFS represents a Ceph FS mount on the host that shares a pod's lifetime - properties: - monitors: - description: 'Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' - items: - type: string - type: array - path: - description: 'Optional: Used as the mounted root, rather than the full Ceph tree, default is /' - type: string - readOnly: - description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' - type: boolean - secretFile: - description: 'Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' - type: string - secretRef: - description: 'Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - user: - description: 'Optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' - type: string - required: - - monitors - type: object - cinder: - description: 'Cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' - properties: - fsType: - description: 'Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' - type: string - readOnly: - description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' - type: boolean - secretRef: - description: 'Optional: points to a secret object containing parameters used to connect to OpenStack.' - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - volumeID: - description: 'volume id used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' - type: string - required: - - volumeID - type: object - configMap: - description: ConfigMap represents a configMap that should populate this volume - properties: - defaultMode: - description: 'Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - items: - description: If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within a volume. - properties: - key: - description: The key to project. - type: string - mode: - description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - path: - description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the ConfigMap or its keys must be defined - type: boolean - type: object - csi: - description: CSI (Container Storage Interface) represents storage that is handled by an external CSI driver (Alpha feature). - properties: - driver: - description: Driver is the name of the CSI driver that handles this volume. Consult with your admin for the correct name as registered in the cluster. - type: string - fsType: - description: Filesystem type to mount. Ex. "ext4", "xfs", "ntfs". If not provided, the empty value is passed to the associated CSI driver which will determine the default filesystem to apply. - type: string - nodePublishSecretRef: - description: NodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed. - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - readOnly: - description: Specifies a read-only configuration for the volume. Defaults to false (read/write). - type: boolean - volumeAttributes: - additionalProperties: - type: string - description: VolumeAttributes stores driver-specific properties that are passed to the CSI driver. Consult your driver's documentation for supported values. - type: object - required: - - driver - type: object - downwardAPI: - description: DownwardAPI represents downward API about the pod that should populate this volume - properties: - defaultMode: - description: 'Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - items: - description: Items is a list of downward API volume file - items: - description: DownwardAPIVolumeFile represents information to create the file containing the pod field - properties: - fieldRef: - description: 'Required: Selects a field of the pod: only annotations, labels, name and namespace are supported.' - properties: - apiVersion: - description: Version of the schema the FieldPath is written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in the specified API version. - type: string - required: - - fieldPath - type: object - mode: - description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - path: - description: 'Required: Path is the relative path name of the file to be created. Must not be absolute or contain the ''..'' path. Must be utf-8 encoded. The first item of the relative path must not start with ''..''' - type: string - resourceFieldRef: - description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.' - properties: - containerName: - description: 'Container name: required for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of the exposed resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - emptyDir: - description: 'EmptyDir represents a temporary directory that shares a pod''s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' - properties: - medium: - description: 'What type of storage medium should back this directory. The default is "" which means to use the node''s default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - description: 'Total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - fc: - description: FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. - properties: - fsType: - description: 'Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. TODO: how do we prevent errors in the filesystem from compromising the machine' - type: string - lun: - description: 'Optional: FC target lun number' - format: int32 - type: integer - readOnly: - description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.' - type: boolean - targetWWNs: - description: 'Optional: FC target worldwide names (WWNs)' - items: - type: string - type: array - wwids: - description: 'Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.' - items: - type: string - type: array - type: object - flexVolume: - description: FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. - properties: - driver: - description: Driver is the name of the driver to use for this volume. - type: string - fsType: - description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. - type: string - options: - additionalProperties: - type: string - description: 'Optional: Extra command options if any.' - type: object - readOnly: - description: 'Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.' - type: boolean - secretRef: - description: 'Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.' - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - required: - - driver - type: object - flocker: - description: Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running - properties: - datasetName: - description: Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated - type: string - datasetUUID: - description: UUID of the dataset. This is unique identifier of a Flocker dataset - type: string - type: object - gcePersistentDisk: - description: 'GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet''s host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' - properties: - fsType: - description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk TODO: how do we prevent errors in the filesystem from compromising the machine' - type: string - partition: - description: 'The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' - format: int32 - type: integer - pdName: - description: 'Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' - type: string - readOnly: - description: 'ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' - type: boolean - required: - - pdName - type: object - gitRepo: - description: 'GitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod''s container.' - properties: - directory: - description: Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. - type: string - repository: - description: Repository URL - type: string - revision: - description: Commit hash for the specified revision. - type: string - required: - - repository - type: object - glusterfs: - description: 'Glusterfs represents a Glusterfs mount on the host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md' - properties: - endpoints: - description: 'EndpointsName is the endpoint name that details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' - type: string - path: - description: 'Path is the Glusterfs volume path. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' - type: string - readOnly: - description: 'ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' - type: boolean - required: - - endpoints - - path - type: object - hostPath: - description: 'HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath --- TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not mount host directories as read/write.' - properties: - path: - description: 'Path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' - type: string - type: - description: 'Type for HostPath Volume Defaults to "" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' - type: string - required: - - path - type: object - iscsi: - description: 'ISCSI represents an ISCSI Disk resource that is attached to a kubelet''s host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md' - properties: - chapAuthDiscovery: - description: whether support iSCSI Discovery CHAP authentication - type: boolean - chapAuthSession: - description: whether support iSCSI Session CHAP authentication - type: boolean - fsType: - description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi TODO: how do we prevent errors in the filesystem from compromising the machine' - type: string - initiatorName: - description: Custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection. - type: string - iqn: - description: Target iSCSI Qualified Name. - type: string - iscsiInterface: - description: iSCSI Interface Name that uses an iSCSI transport. Defaults to 'default' (tcp). - type: string - lun: - description: iSCSI Target Lun number. - format: int32 - type: integer - portals: - description: iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). - items: - type: string - type: array - readOnly: - description: ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. - type: boolean - secretRef: - description: CHAP Secret for iSCSI target and initiator authentication - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - targetPortal: - description: iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260). - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - description: 'Volume''s name. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' - type: string - nfs: - description: 'NFS represents an NFS mount on the host that shares a pod''s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' - properties: - path: - description: 'Path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' - type: string - readOnly: - description: 'ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' - type: boolean - server: - description: 'Server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - description: 'PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' - properties: - claimName: - description: 'ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' - type: string - readOnly: - description: Will force the ReadOnly setting in VolumeMounts. Default false. - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - description: PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine - properties: - fsType: - description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - pdID: - description: ID that identifies Photon Controller persistent disk - type: string - required: - - pdID - type: object - portworxVolume: - description: PortworxVolume represents a portworx volume attached and mounted on kubelets host machine - properties: - fsType: - description: FSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. - type: string - readOnly: - description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. - type: boolean - volumeID: - description: VolumeID uniquely identifies a Portworx volume - type: string - required: - - volumeID - type: object - projected: - description: Items for all in one resources secrets, configmaps, and downward API - properties: - defaultMode: - description: Mode bits to use on created files by default. Must be a value between 0 and 0777. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. - format: int32 - type: integer - sources: - description: list of volume projections - items: - description: Projection that may be projected along with other supported volume types - properties: - configMap: - description: information about the configMap data to project - properties: - items: - description: If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within a volume. - properties: - key: - description: The key to project. - type: string - mode: - description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - path: - description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the ConfigMap or its keys must be defined - type: boolean - type: object - downwardAPI: - description: information about the downwardAPI data to project - properties: - items: - description: Items is a list of DownwardAPIVolume file - items: - description: DownwardAPIVolumeFile represents information to create the file containing the pod field - properties: - fieldRef: - description: 'Required: Selects a field of the pod: only annotations, labels, name and namespace are supported.' - properties: - apiVersion: - description: Version of the schema the FieldPath is written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in the specified API version. - type: string - required: - - fieldPath - type: object - mode: - description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - path: - description: 'Required: Path is the relative path name of the file to be created. Must not be absolute or contain the ''..'' path. Must be utf-8 encoded. The first item of the relative path must not start with ''..''' - type: string - resourceFieldRef: - description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.' - properties: - containerName: - description: 'Container name: required for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of the exposed resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - required: - - path - type: object - type: array - type: object - secret: - description: information about the secret data to project - properties: - items: - description: If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within a volume. - properties: - key: - description: The key to project. - type: string - mode: - description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - path: - description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the Secret or its key must be defined - type: boolean - type: object - serviceAccountToken: - description: information about the serviceAccountToken data to project - properties: - audience: - description: Audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver. - type: string - expirationSeconds: - description: ExpirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes. - format: int64 - type: integer - path: - description: Path is the path relative to the mount point of the file to project the token into. - type: string - required: - - path - type: object - type: object - type: array - required: - - sources - type: object - quobyte: - description: Quobyte represents a Quobyte mount on the host that shares a pod's lifetime - properties: - group: - description: Group to map volume access to Default is no group - type: string - readOnly: - description: ReadOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false. - type: boolean - registry: - description: Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes - type: string - tenant: - description: Tenant owning the given Quobyte volume in the Backend Used with dynamically provisioned Quobyte volumes, value is set by the plugin - type: string - user: - description: User to map volume access to Defaults to serivceaccount user - type: string - volume: - description: Volume is a string that references an already created Quobyte volume by name. - type: string - required: - - registry - - volume - type: object - rbd: - description: 'RBD represents a Rados Block Device mount on the host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md' - properties: - fsType: - description: 'Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd TODO: how do we prevent errors in the filesystem from compromising the machine' - type: string - image: - description: 'The rados image name. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' - type: string - keyring: - description: 'Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' - type: string - monitors: - description: 'A collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' - items: - type: string - type: array - pool: - description: 'The rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' - type: string - readOnly: - description: 'ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' - type: boolean - secretRef: - description: 'SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - user: - description: 'The rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' - type: string - required: - - image - - monitors - type: object - scaleIO: - description: ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. - properties: - fsType: - description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs". - type: string - gateway: - description: The host address of the ScaleIO API Gateway. - type: string - protectionDomain: - description: The name of the ScaleIO Protection Domain for the configured storage. - type: string - readOnly: - description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. - type: boolean - secretRef: - description: SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail. - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - sslEnabled: - description: Flag to enable/disable SSL communication with Gateway, default false - type: boolean - storageMode: - description: Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. - type: string - storagePool: - description: The ScaleIO Storage Pool associated with the protection domain. - type: string - system: - description: The name of the storage system as configured in ScaleIO. - type: string - volumeName: - description: The name of a volume already created in the ScaleIO system that is associated with this volume source. - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - description: 'Secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' - properties: - defaultMode: - description: 'Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - items: - description: If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'. - items: - description: Maps a string key to a path within a volume. - properties: - key: - description: The key to project. - type: string - mode: - description: 'Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.' - format: int32 - type: integer - path: - description: The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'. - type: string - required: - - key - - path - type: object - type: array - optional: - description: Specify whether the Secret or its keys must be defined - type: boolean - secretName: - description: 'Name of the secret in the pod''s namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' - type: string - type: object - storageos: - description: StorageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. - properties: - fsType: - description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - readOnly: - description: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. - type: boolean - secretRef: - description: SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted. - properties: - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - type: object - volumeName: - description: VolumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace. - type: string - volumeNamespace: - description: VolumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to "default" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created. - type: string - type: object - vsphereVolume: - description: VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine - properties: - fsType: - description: Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. - type: string - storagePolicyID: - description: Storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName. - type: string - storagePolicyName: - description: Storage Policy Based Management (SPBM) profile name. - type: string - volumePath: - description: Path that identifies vSphere volume vmdk - type: string - required: - - volumePath - type: object - required: - - name - type: object - type: array - required: - - receivers - type: object - status: - description: NotificationManagerStatus defines the observed state of NotificationManager - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_receivers.yaml b/config/crds/notification.kubesphere.io_receivers.yaml new file mode 100644 index 000000000..4b48a61d3 --- /dev/null +++ b/config/crds/notification.kubesphere.io_receivers.yaml @@ -0,0 +1,590 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: receivers.notification.kubesphere.io +spec: + group: notification.kubesphere.io + names: + categories: + - notification-manager + kind: Receiver + listKind: ReceiverList + plural: receivers + shortNames: + - nr + singular: receiver + scope: Cluster + versions: + - name: v2beta1 + schema: + openAPIV3Schema: + description: Receiver is the Schema for the receivers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ReceiverSpec defines the desired state of Receiver + properties: + dingtalk: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + chatbot: + description: Be careful, a ChatBot only can send 20 message per minute. + properties: + keywords: + description: Custom keywords of ChatBot + items: + type: string + type: array + secret: + description: Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + webhook: + description: The webhook of ChatBot which the message will send to. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + required: + - webhook + type: object + conversation: + description: The conversation which message will send to. + properties: + chatids: + items: + type: string + type: array + required: + - chatids + type: object + dingtalkConfigSelector: + description: DingTalkConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + type: object + email: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + emailConfigSelector: + description: EmailConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + to: + description: Receivers' email addresses + items: + type: string + type: array + required: + - to + type: object + slack: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + channels: + description: The channel or user to send notifications to. + items: + type: string + type: array + enabled: + description: whether the receiver is enabled + type: boolean + slackConfigSelector: + description: SlackConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + required: + - channels + type: object + webhook: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + httpConfig: + description: HTTPClientConfig configures an HTTP client. + properties: + basicAuth: + description: The HTTP basic authentication credentials for the targets. + properties: + password: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + username: + type: string + required: + - username + type: object + bearerToken: + description: The bearer token for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + proxyUrl: + description: HTTP proxy server to use to connect to the targets. + type: string + tlsConfig: + description: TLSConfig to use to connect to the targets. + properties: + clientCertificate: + description: The certificate of the client. + properties: + cert: + description: The client cert file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + key: + description: The client key file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + insecureSkipVerify: + description: Disable target certificate validation. + type: boolean + rootCA: + description: RootCA defines the root certificate authorities that clients use when verifying server certificates. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + serverName: + description: Used to verify the hostname for the targets. + type: string + type: object + type: object + service: + description: "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified. \n If the webhook is running within the cluster, then you should use `service`." + properties: + name: + description: '`name` is the name of the service. Required' + type: string + namespace: + description: '`namespace` is the namespace of the service. Required' + type: string + path: + description: '`path` is an optional URL path which will be sent in any request to this service.' + type: string + port: + description: If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + format: int32 + type: integer + scheme: + description: Http scheme, default is http. + type: string + required: + - name + - namespace + type: object + url: + description: "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. \n The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some api servers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. \n Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. \n A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. \n Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either." + type: string + webhookConfigSelector: + description: WebhookConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + wechat: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + toParty: + items: + type: string + type: array + toTag: + items: + type: string + type: array + toUser: + items: + type: string + type: array + wechatConfigSelector: + description: WechatConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + type: object + status: + description: ReceiverStatus defines the observed state of Receiver + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_slackconfigs.yaml b/config/crds/notification.kubesphere.io_slackconfigs.yaml deleted file mode 100644 index 3a4dadfed..000000000 --- a/config/crds/notification.kubesphere.io_slackconfigs.yaml +++ /dev/null @@ -1,64 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: slackconfigs.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: SlackConfig - listKind: SlackConfigList - plural: slackconfigs - shortNames: - - sc - singular: slackconfig - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: SlackConfig is the Schema for the slackconfigs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: SlackConfigSpec defines the desired state of SlackConfig - properties: - slackTokenSecret: - description: The token of user or bot. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - type: object - status: - description: SlackConfigStatus defines the observed state of SlackConfig - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_slackreceivers.yaml b/config/crds/notification.kubesphere.io_slackreceivers.yaml deleted file mode 100644 index c4d9f345f..000000000 --- a/config/crds/notification.kubesphere.io_slackreceivers.yaml +++ /dev/null @@ -1,114 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: slackreceivers.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: SlackReceiver - listKind: SlackReceiverList - plural: slackreceivers - shortNames: - - sr - singular: slackreceiver - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: SlackReceiver is the Schema for the slackreceivers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: SlackReceiverSpec defines the desired state of SlackReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - channel: - description: The channel or user to send notifications to. - type: string - slackConfigSelector: - description: SlackConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - required: - - channel - type: object - status: - description: SlackReceiverStatus defines the observed state of SlackReceiver - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_webhookconfigs.yaml b/config/crds/notification.kubesphere.io_webhookconfigs.yaml deleted file mode 100644 index 5658720c5..000000000 --- a/config/crds/notification.kubesphere.io_webhookconfigs.yaml +++ /dev/null @@ -1,48 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: webhookconfigs.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: WebhookConfig - listKind: WebhookConfigList - plural: webhookconfigs - shortNames: - - wc - singular: webhookconfig - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: WebhookConfig is the Schema for the webhookconfigs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: WebhookConfigSpec defines the desired state of WebhookConfig - type: object - status: - description: WebhookConfigStatus defines the observed state of WebhookConfig - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_webhookreceivers.yaml b/config/crds/notification.kubesphere.io_webhookreceivers.yaml deleted file mode 100644 index 33f966ce8..000000000 --- a/config/crds/notification.kubesphere.io_webhookreceivers.yaml +++ /dev/null @@ -1,239 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: webhookreceivers.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: WebhookReceiver - listKind: WebhookReceiverList - plural: webhookreceivers - shortNames: - - wr - singular: webhookreceiver - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: WebhookReceiver is the Schema for the webhookreceivers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: WebhookReceiverSpec defines the desired state of WebhookReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - httpConfig: - description: HTTPClientConfig configures an HTTP client. - properties: - basicAuth: - description: The HTTP basic authentication credentials for the targets. - properties: - password: - description: SecretKeySelector selects a key of a Secret. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - username: - type: string - required: - - username - type: object - bearerToken: - description: The bearer token for the targets. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - proxyUrl: - description: HTTP proxy server to use to connect to the targets. - type: string - tlsConfig: - description: TLSConfig to use to connect to the targets. - properties: - clientCertificate: - description: The certificate of the client. - properties: - cert: - description: The client cert file for the targets. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - key: - description: The client key file for the targets. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - type: object - insecureSkipVerify: - description: Disable target certificate validation. - type: boolean - rootCA: - description: RootCA defines the root certificate authorities that clients use when verifying server certificates. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - serverName: - description: Used to verify the hostname for the targets. - type: string - type: object - type: object - service: - description: "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified. \n If the webhook is running within the cluster, then you should use `service`." - properties: - name: - description: '`name` is the name of the service. Required' - type: string - namespace: - description: '`namespace` is the namespace of the service. Required' - type: string - path: - description: '`path` is an optional URL path which will be sent in any request to this service.' - type: string - port: - description: If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). - format: int32 - type: integer - scheme: - description: Http scheme, default is http. - type: string - required: - - name - - namespace - type: object - url: - description: "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. \n The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some api servers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. \n Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. \n A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. \n Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either." - type: string - webhookConfigSelector: - description: WebhookConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - type: object - status: - description: WebhookReceiverStatus defines the observed state of WebhookReceiver - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_wechatconfigs.yaml b/config/crds/notification.kubesphere.io_wechatconfigs.yaml deleted file mode 100644 index 5983f08b8..000000000 --- a/config/crds/notification.kubesphere.io_wechatconfigs.yaml +++ /dev/null @@ -1,77 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: wechatconfigs.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: WechatConfig - listKind: WechatConfigList - plural: wechatconfigs - shortNames: - - wcc - singular: wechatconfig - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: WechatConfig is the Schema for the wechatconfigs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: WechatConfigSpec defines the desired state of WechatConfig - properties: - wechatApiAgentId: - description: The id of the application which sending message. - type: string - wechatApiCorpId: - description: The corp id for authentication. - type: string - wechatApiSecret: - description: The API key to use when talking to the WeChat API. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - wechatApiUrl: - description: The WeChat API URL. - type: string - required: - - wechatApiAgentId - - wechatApiCorpId - - wechatApiSecret - type: object - status: - description: WechatConfigStatus defines the observed state of WechatConfig - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/notification.kubesphere.io_wechatreceivers.yaml b/config/crds/notification.kubesphere.io_wechatreceivers.yaml deleted file mode 100644 index b36f0aa65..000000000 --- a/config/crds/notification.kubesphere.io_wechatreceivers.yaml +++ /dev/null @@ -1,115 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: wechatreceivers.notification.kubesphere.io -spec: - group: notification.kubesphere.io - names: - kind: WechatReceiver - listKind: WechatReceiverList - plural: wechatreceivers - shortNames: - - wcr - singular: wechatreceiver - scope: Cluster - versions: - - name: v2alpha1 - schema: - openAPIV3Schema: - description: WechatReceiver is the Schema for the wechatreceivers API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: WechatReceiverSpec defines the desired state of WechatReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - toParty: - type: string - toTag: - type: string - toUser: - type: string - wechatConfigSelector: - description: WechatConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - type: object - status: - description: WechatReceiverStatus defines the observed state of WechatReceiver - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federateddingtalkconfigs.yaml b/config/crds/types.kubefed.io_federateddingtalkconfigs.yaml deleted file mode 100644 index e8b50001c..000000000 --- a/config/crds/types.kubefed.io_federateddingtalkconfigs.yaml +++ /dev/null @@ -1,197 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federateddingtalkconfigs.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedDingTalkConfig - listKind: FederatedDingTalkConfigList - plural: federateddingtalkconfigs - singular: federateddingtalkconfig - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: DingTalkConfigSpec defines the desired state of DingTalkConfig - properties: - conversation: - description: Only needed when send alerts to the conversation. - properties: - appkey: - description: The key of the application with which to send messages. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - appsecret: - description: The key in the secret to be used. Must be a valid secret key. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - type: object - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federateddingtalkreceivers.yaml b/config/crds/types.kubefed.io_federateddingtalkreceivers.yaml deleted file mode 100644 index 17dc9dd26..000000000 --- a/config/crds/types.kubefed.io_federateddingtalkreceivers.yaml +++ /dev/null @@ -1,272 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federateddingtalkreceivers.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedDingTalkReceiver - listKind: FederatedDingTalkReceiverList - plural: federateddingtalkreceivers - singular: federateddingtalkreceiver - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: DingTalkReceiverSpec defines the desired state of DingTalkReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - chatbot: - description: Be careful, a ChatBot only can send 20 message per minute. - properties: - keywords: - description: Custom keywords of ChatBot - items: - type: string - type: array - secret: - description: Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - webhook: - description: The webhook of ChatBot which the message will send to. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - required: - - webhook - type: object - conversation: - description: The conversation which message will send to. - properties: - chatid: - type: string - required: - - chatid - type: object - dingtalkConfigSelector: - description: DingTalkConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedemailconfigs.yaml b/config/crds/types.kubefed.io_federatedemailconfigs.yaml deleted file mode 100644 index fc313865c..000000000 --- a/config/crds/types.kubefed.io_federatedemailconfigs.yaml +++ /dev/null @@ -1,281 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federatedemailconfigs.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedEmailConfig - listKind: FederatedEmailConfigList - plural: federatedemailconfigs - singular: federatedemailconfig - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: EmailConfigSpec defines the desired state of EmailConfig - properties: - authIdentify: - description: The identity for PLAIN authentication. - type: string - authPassword: - description: The secret contains the SMTP password for LOGIN and PLAIN authentications. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - authSecret: - description: The secret contains the SMTP secret for CRAM-MD5 authentication. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - authUsername: - description: The username for CRAM-MD5, LOGIN and PLAIN authentications. - type: string - from: - description: The sender address. - type: string - hello: - description: The hostname to use when identifying to the SMTP server. - type: string - requireTLS: - description: The default SMTP TLS requirement. - type: boolean - smartHost: - description: The address of the SMTP server. - properties: - host: - type: string - port: - type: string - required: - - host - - port - type: object - tls: - description: TLSConfig configures the options for TLS connections. - properties: - clientCertificate: - description: The certificate of the client. - properties: - cert: - description: The client cert file for the targets. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - key: - description: The client key file for the targets. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - type: object - insecureSkipVerify: - description: Disable target certificate validation. - type: boolean - rootCA: - description: RootCA defines the root certificate authorities that clients use when verifying server certificates. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - serverName: - description: Used to verify the hostname for the targets. - type: string - type: object - required: - - from - - smartHost - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedemailreceivers.yaml b/config/crds/types.kubefed.io_federatedemailreceivers.yaml deleted file mode 100644 index 5a6ab177f..000000000 --- a/config/crds/types.kubefed.io_federatedemailreceivers.yaml +++ /dev/null @@ -1,230 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federatedemailreceivers.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedEmailReceiver - listKind: FederatedEmailReceiverList - plural: federatedemailreceivers - singular: federatedemailreceiver - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: EmailReceiverSpec defines the desired state of EmailReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - emailConfigSelector: - description: EmailConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - to: - description: Receivers' email addresses - items: - type: string - type: array - required: - - to - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwebhookreceivers.yaml b/config/crds/types.kubefed.io_federatednotificationconfigs.yaml similarity index 63% rename from config/crds/types.kubefed.io_federatedwebhookreceivers.yaml rename to config/crds/types.kubefed.io_federatednotificationconfigs.yaml index d3101cd95..739bcf877 100644 --- a/config/crds/types.kubefed.io_federatedwebhookreceivers.yaml +++ b/config/crds/types.kubefed.io_federatednotificationconfigs.yaml @@ -6,14 +6,14 @@ metadata: annotations: controller-gen.kubebuilder.io/version: (devel) creationTimestamp: null - name: federatedwebhookreceivers.types.kubefed.io + name: federatednotificationconfigs.types.kubefed.io spec: group: types.kubefed.io names: - kind: FederatedWebhookReceiver - listKind: FederatedWebhookReceiverList - plural: federatedwebhookreceivers - singular: federatedwebhookreceiver + kind: FederatedNotificationConfig + listKind: FederatedNotificationConfigList + plural: federatednotificationconfigs + singular: federatednotificationconfig scope: Cluster versions: - name: v1beta1 @@ -100,46 +100,30 @@ spec: type: object x-kubernetes-preserve-unknown-fields: true spec: - description: WebhookReceiverSpec defines the desired state of WebhookReceiver + description: ConfigSpec defines the desired state of Config properties: - alertSelector: - description: Selector to filter alerts. + dingtalk: properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - httpConfig: - description: HTTPClientConfig configures an HTTP client. - properties: - basicAuth: - description: The HTTP basic authentication credentials for the targets. + conversation: + description: Only needed when send alerts to the conversation. properties: - password: - description: SecretKeySelector selects a key of a Secret. + appkey: + description: The key of the application with which to send messages. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + appsecret: + description: The key in the secret to be used. Must be a valid secret key. properties: key: description: The key of the secret to select from. Must be a valid secret key. @@ -153,13 +137,19 @@ spec: required: - key type: object - username: - type: string - required: - - username type: object - bearerToken: - description: The bearer token for the targets. + labels: + additionalProperties: + type: string + type: object + type: object + email: + properties: + authIdentify: + description: The identity for PLAIN authentication. + type: string + authPassword: + description: The secret contains the SMTP password for LOGIN and PLAIN authentications. properties: key: description: The key of the secret to select from. Must be a valid secret key. @@ -173,11 +163,50 @@ spec: required: - key type: object - proxyUrl: - description: HTTP proxy server to use to connect to the targets. + authSecret: + description: The secret contains the SMTP secret for CRAM-MD5 authentication. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + authUsername: + description: The username for CRAM-MD5, LOGIN and PLAIN authentications. type: string - tlsConfig: - description: TLSConfig to use to connect to the targets. + from: + description: The sender address. + type: string + hello: + description: The hostname to use when identifying to the SMTP server. + type: string + labels: + additionalProperties: + type: string + type: object + requireTLS: + description: The default SMTP TLS requirement. + type: boolean + smartHost: + description: The address of the SMTP server. + properties: + host: + type: string + port: + type: integer + required: + - host + - port + type: object + tls: + description: TLSConfig configures the options for TLS connections. properties: clientCertificate: description: The certificate of the client. @@ -235,62 +264,73 @@ spec: description: Used to verify the hostname for the targets. type: string type: object - type: object - service: - description: "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified. \n If the webhook is running within the cluster, then you should use `service`." - properties: - name: - description: '`name` is the name of the service. Required' - type: string - namespace: - description: '`namespace` is the namespace of the service. Required' - type: string - path: - description: '`path` is an optional URL path which will be sent in any request to this service.' - type: string - port: - description: If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). - format: int32 - type: integer - scheme: - description: Http scheme, default is http. - type: string required: - - name - - namespace + - from + - smartHost type: object - url: - description: "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. \n The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some api servers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. \n Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. \n A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. \n Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either." - type: string - webhookConfigSelector: - description: WebhookConfig to be selected for this receiver + slack: properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: + labels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. type: object + slackTokenSecret: + description: The token of user or bot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + webhook: + properties: + labels: + additionalProperties: + type: string + type: object + type: object + wechat: + properties: + labels: + additionalProperties: + type: string + type: object + wechatApiAgentId: + description: The id of the application which sending message. + type: string + wechatApiCorpId: + description: The corp id for authentication. + type: string + wechatApiSecret: + description: The API key to use when talking to the WeChat API. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + wechatApiUrl: + description: The WeChat API URL. + type: string + required: + - wechatApiAgentId + - wechatApiCorpId + - wechatApiSecret type: object type: object type: object diff --git a/config/crds/types.kubefed.io_federatednotificationreceivers.yaml b/config/crds/types.kubefed.io_federatednotificationreceivers.yaml new file mode 100644 index 000000000..ab2258454 --- /dev/null +++ b/config/crds/types.kubefed.io_federatednotificationreceivers.yaml @@ -0,0 +1,700 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: (devel) + creationTimestamp: null + name: federatednotificationreceivers.types.kubefed.io +spec: + group: types.kubefed.io + names: + kind: FederatedNotificationReceiver + listKind: FederatedNotificationReceiverList + plural: federatednotificationreceivers + singular: federatednotificationreceiver + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + overrides: + items: + properties: + clusterName: + type: string + clusterOverrides: + items: + properties: + op: + type: string + path: + type: string + value: + type: object + required: + - path + type: object + type: array + required: + - clusterName + type: object + type: array + placement: + properties: + clusterSelector: + description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + clusters: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + type: object + template: + properties: + metadata: + type: object + x-kubernetes-preserve-unknown-fields: true + spec: + description: ReceiverSpec defines the desired state of Receiver + properties: + dingtalk: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + chatbot: + description: Be careful, a ChatBot only can send 20 message per minute. + properties: + keywords: + description: Custom keywords of ChatBot + items: + type: string + type: array + secret: + description: Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + webhook: + description: The webhook of ChatBot which the message will send to. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + required: + - webhook + type: object + conversation: + description: The conversation which message will send to. + properties: + chatids: + items: + type: string + type: array + required: + - chatids + type: object + dingtalkConfigSelector: + description: DingTalkConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + type: object + email: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + emailConfigSelector: + description: EmailConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + to: + description: Receivers' email addresses + items: + type: string + type: array + required: + - to + type: object + slack: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + channels: + description: The channel or user to send notifications to. + items: + type: string + type: array + enabled: + description: whether the receiver is enabled + type: boolean + slackConfigSelector: + description: SlackConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + required: + - channels + type: object + webhook: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + httpConfig: + description: HTTPClientConfig configures an HTTP client. + properties: + basicAuth: + description: The HTTP basic authentication credentials for the targets. + properties: + password: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + username: + type: string + required: + - username + type: object + bearerToken: + description: The bearer token for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + proxyUrl: + description: HTTP proxy server to use to connect to the targets. + type: string + tlsConfig: + description: TLSConfig to use to connect to the targets. + properties: + clientCertificate: + description: The certificate of the client. + properties: + cert: + description: The client cert file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + key: + description: The client key file for the targets. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + type: object + insecureSkipVerify: + description: Disable target certificate validation. + type: boolean + rootCA: + description: RootCA defines the root certificate authorities that clients use when verifying server certificates. + properties: + key: + description: The key of the secret to select from. Must be a valid secret key. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: The namespace of the secret, default to the pod's namespace. + type: string + required: + - key + type: object + serverName: + description: Used to verify the hostname for the targets. + type: string + type: object + type: object + service: + description: "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified. \n If the webhook is running within the cluster, then you should use `service`." + properties: + name: + description: '`name` is the name of the service. Required' + type: string + namespace: + description: '`namespace` is the namespace of the service. Required' + type: string + path: + description: '`path` is an optional URL path which will be sent in any request to this service.' + type: string + port: + description: If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive). + format: int32 + type: integer + scheme: + description: Http scheme, default is http. + type: string + required: + - name + - namespace + type: object + url: + description: "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified. \n The `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some api servers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address. \n Please note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. \n A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. \n Attempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either." + type: string + webhookConfigSelector: + description: WebhookConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + wechat: + properties: + alertSelector: + description: Selector to filter alerts. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + enabled: + description: whether the receiver is enabled + type: boolean + toParty: + items: + type: string + type: array + toTag: + items: + type: string + type: array + toUser: + items: + type: string + type: array + wechatConfigSelector: + description: WechatConfig to be selected for this receiver + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + type: object + type: object + type: object + required: + - placement + - template + type: object + status: + properties: + clusters: + items: + properties: + name: + type: string + status: + type: string + required: + - name + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status to another. + type: string + lastUpdateTime: + description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of cluster condition + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedslackconfigs.yaml b/config/crds/types.kubefed.io_federatedslackconfigs.yaml deleted file mode 100644 index 8dc8e4670..000000000 --- a/config/crds/types.kubefed.io_federatedslackconfigs.yaml +++ /dev/null @@ -1,178 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federatedslackconfigs.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedSlackConfig - listKind: FederatedSlackConfigList - plural: federatedslackconfigs - singular: federatedslackconfig - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: SlackConfigSpec defines the desired state of SlackConfig - properties: - slackTokenSecret: - description: The token of user or bot. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedslackreceivers.yaml b/config/crds/types.kubefed.io_federatedslackreceivers.yaml deleted file mode 100644 index 8d3b96aa4..000000000 --- a/config/crds/types.kubefed.io_federatedslackreceivers.yaml +++ /dev/null @@ -1,228 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federatedslackreceivers.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedSlackReceiver - listKind: FederatedSlackReceiverList - plural: federatedslackreceivers - singular: federatedslackreceiver - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: SlackReceiverSpec defines the desired state of SlackReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - channel: - description: The channel or user to send notifications to. - type: string - slackConfigSelector: - description: SlackConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - required: - - channel - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwebhookconfigs.yaml b/config/crds/types.kubefed.io_federatedwebhookconfigs.yaml deleted file mode 100644 index 7aa41d602..000000000 --- a/config/crds/types.kubefed.io_federatedwebhookconfigs.yaml +++ /dev/null @@ -1,162 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federatedwebhookconfigs.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedWebhookConfig - listKind: FederatedWebhookConfigList - plural: federatedwebhookconfigs - singular: federatedwebhookconfig - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: WebhookConfigSpec defines the desired state of WebhookConfig - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwechatconfigs.yaml b/config/crds/types.kubefed.io_federatedwechatconfigs.yaml deleted file mode 100644 index 57c4bda00..000000000 --- a/config/crds/types.kubefed.io_federatedwechatconfigs.yaml +++ /dev/null @@ -1,191 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federatedwechatconfigs.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedWechatConfig - listKind: FederatedWechatConfigList - plural: federatedwechatconfigs - singular: federatedwechatconfig - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: WechatConfigSpec defines the desired state of WechatConfig - properties: - wechatApiAgentId: - description: The id of the application which sending message. - type: string - wechatApiCorpId: - description: The corp id for authentication. - type: string - wechatApiSecret: - description: The API key to use when talking to the WeChat API. - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: The namespace of the secret, default to the pod's namespace. - type: string - required: - - key - type: object - wechatApiUrl: - description: The WeChat API URL. - type: string - required: - - wechatApiAgentId - - wechatApiCorpId - - wechatApiSecret - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crds/types.kubefed.io_federatedwechatreceivers.yaml b/config/crds/types.kubefed.io_federatedwechatreceivers.yaml deleted file mode 100644 index ae9d3a3a1..000000000 --- a/config/crds/types.kubefed.io_federatedwechatreceivers.yaml +++ /dev/null @@ -1,229 +0,0 @@ - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: (devel) - creationTimestamp: null - name: federatedwechatreceivers.types.kubefed.io -spec: - group: types.kubefed.io - names: - kind: FederatedWechatReceiver - listKind: FederatedWechatReceiverList - plural: federatedwechatreceivers - singular: federatedwechatreceiver - scope: Cluster - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - overrides: - items: - properties: - clusterName: - type: string - clusterOverrides: - items: - properties: - op: - type: string - path: - type: string - value: - type: object - required: - - path - type: object - type: array - required: - - clusterName - type: object - type: array - placement: - properties: - clusterSelector: - description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - clusters: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - type: object - template: - properties: - metadata: - type: object - x-kubernetes-preserve-unknown-fields: true - spec: - description: WechatReceiverSpec defines the desired state of WechatReceiver - properties: - alertSelector: - description: Selector to filter alerts. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - toParty: - type: string - toTag: - type: string - toUser: - type: string - wechatConfigSelector: - description: WechatConfig to be selected for this receiver - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - type: object - type: object - required: - - placement - - template - type: object - status: - properties: - clusters: - items: - properties: - name: - type: string - status: - type: string - required: - - name - type: object - type: array - conditions: - items: - properties: - lastTransitionTime: - description: Last time the condition transit from one status to another. - type: string - lastUpdateTime: - description: Last time reconciliation resulted in an error or the last time a change was propagated to member clusters. - type: string - reason: - description: (brief) reason for the condition's last transition. - type: string - status: - description: Status of the condition, one of True, False, Unknown. - type: string - type: - description: Type of cluster condition - type: string - required: - - status - - type - type: object - type: array - observedGeneration: - format: int64 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/hack/generate_client.sh b/hack/generate_client.sh index d48b7a8c5..a012df988 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 notification:v2alpha1" +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:v2beta1" 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/apis/addtoscheme_notification_v2alpha1.go b/pkg/apis/addtoscheme_notification_v2beta1.go similarity index 82% rename from pkg/apis/addtoscheme_notification_v2alpha1.go rename to pkg/apis/addtoscheme_notification_v2beta1.go index 00b75715c..139a3a445 100644 --- a/pkg/apis/addtoscheme_notification_v2alpha1.go +++ b/pkg/apis/addtoscheme_notification_v2beta1.go @@ -17,9 +17,9 @@ limitations under the License. package apis import ( - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" ) func init() { - AddToSchemes = append(AddToSchemes, v2alpha1.SchemeBuilder.AddToScheme) + AddToSchemes = append(AddToSchemes, v2beta1.SchemeBuilder.AddToScheme) } diff --git a/pkg/apis/notification/v2alpha1/dingtalkconfig_types.go b/pkg/apis/notification/v2alpha1/dingtalkconfig_types.go deleted file mode 100644 index bff9f986e..000000000 --- a/pkg/apis/notification/v2alpha1/dingtalkconfig_types.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// Configuration of conversation -type DingTalkApplicationConfig struct { - // The key of the application with which to send messages. - AppKey *SecretKeySelector `json:"appkey,omitempty"` - // The key in the secret to be used. Must be a valid secret key. - AppSecret *SecretKeySelector `json:"appsecret,omitempty"` -} - -// DingTalkConfigSpec defines the desired state of DingTalkConfig -type DingTalkConfigSpec struct { - // Only needed when send alerts to the conversation. - Conversation *DingTalkApplicationConfig `json:"conversation,omitempty"` -} - -// DingTalkConfigStatus defines the observed state of DingTalkConfig -type DingTalkConfigStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=dc -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// DingTalkConfig is the Schema for the dingtalkconfigs API -type DingTalkConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec DingTalkConfigSpec `json:"spec,omitempty"` - Status DingTalkConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// DingTalkConfigList contains a list of DingTalkConfig -type DingTalkConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []DingTalkConfig `json:"items"` -} - -func init() { - SchemeBuilder.Register(&DingTalkConfig{}, &DingTalkConfigList{}) -} diff --git a/pkg/apis/notification/v2alpha1/dingtalkreceiver_types.go b/pkg/apis/notification/v2alpha1/dingtalkreceiver_types.go deleted file mode 100644 index c0df00a02..000000000 --- a/pkg/apis/notification/v2alpha1/dingtalkreceiver_types.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// Configuration of ChatBot -type DingTalkChatBot struct { - // The webhook of ChatBot which the message will send to. - Webhook *SecretKeySelector `json:"webhook"` - - // Custom keywords of ChatBot - Keywords []string `json:"keywords,omitempty"` - - // Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. - Secret *SecretKeySelector `json:"secret,omitempty"` -} - -// Configuration of conversation -type DingTalkConversation struct { - ChatID string `json:"chatid"` -} - -// DingTalkReceiverSpec defines the desired state of DingTalkReceiver -type DingTalkReceiverSpec struct { - // DingTalkConfig to be selected for this receiver - DingTalkConfigSelector *metav1.LabelSelector `json:"dingtalkConfigSelector,omitempty"` - // Selector to filter alerts. - AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` - // Be careful, a ChatBot only can send 20 message per minute. - ChatBot *DingTalkChatBot `json:"chatbot,omitempty"` - // The conversation which message will send to. - Conversation *DingTalkConversation `json:"conversation,omitempty"` -} - -// DingTalkReceiverStatus defines the observed state of DingTalkReceiver -type DingTalkReceiverStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=dr -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// DingTalkReceiver is the Schema for the dingtalkreceivers API -type DingTalkReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec DingTalkReceiverSpec `json:"spec,omitempty"` - Status DingTalkReceiverStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// DingTalkReceiverList contains a list of DingTalkReceiver -type DingTalkReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []DingTalkReceiver `json:"items"` -} - -func init() { - SchemeBuilder.Register(&DingTalkReceiver{}, &DingTalkReceiverList{}) -} diff --git a/pkg/apis/notification/v2alpha1/emailconfig_types.go b/pkg/apis/notification/v2alpha1/emailconfig_types.go deleted file mode 100644 index 69f50aeed..000000000 --- a/pkg/apis/notification/v2alpha1/emailconfig_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EmailConfigSpec defines the desired state of EmailConfig -type EmailConfigSpec struct { - // The sender address. - From string `json:"from"` - // The address of the SMTP server. - SmartHost HostPort `json:"smartHost"` - // The hostname to use when identifying to the SMTP server. - Hello *string `json:"hello,omitempty"` - // The username for CRAM-MD5, LOGIN and PLAIN authentications. - AuthUsername *string `json:"authUsername,omitempty"` - // The identity for PLAIN authentication. - AuthIdentify *string `json:"authIdentify,omitempty"` - // The secret contains the SMTP password for LOGIN and PLAIN authentications. - AuthPassword *SecretKeySelector `json:"authPassword,omitempty"` - // The secret contains the SMTP secret for CRAM-MD5 authentication. - AuthSecret *SecretKeySelector `json:"authSecret,omitempty"` - // The default SMTP TLS requirement. - RequireTLS *bool `json:"requireTLS,omitempty"` - TLS *TLSConfig `json:"tls,omitempty"` -} - -type HostPort struct { - Host string `json:"host"` - Port string `json:"port"` -} - -// EmailConfigStatus defines the observed state of EmailConfig -type EmailConfigStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=ec -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// EmailConfig is the Schema for the emailconfigs API -type EmailConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec EmailConfigSpec `json:"spec,omitempty"` - Status EmailConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// EmailConfigList contains a list of EmailConfig -type EmailConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []EmailConfig `json:"items"` -} - -func init() { - SchemeBuilder.Register(&EmailConfig{}, &EmailConfigList{}) -} diff --git a/pkg/apis/notification/v2alpha1/emailreceiver_types.go b/pkg/apis/notification/v2alpha1/emailreceiver_types.go deleted file mode 100644 index d6b23e5a0..000000000 --- a/pkg/apis/notification/v2alpha1/emailreceiver_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EmailReceiverSpec defines the desired state of EmailReceiver -type EmailReceiverSpec struct { - // Receivers' email addresses - To []string `json:"to"` - // EmailConfig to be selected for this receiver - EmailConfigSelector *metav1.LabelSelector `json:"emailConfigSelector,omitempty"` - // Selector to filter alerts. - AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` -} - -// EmailReceiverStatus defines the observed state of EmailReceiver -type EmailReceiverStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=er -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// EmailReceiver is the Schema for the emailreceivers API -type EmailReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec EmailReceiverSpec `json:"spec,omitempty"` - Status EmailReceiverStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// EmailReceiverList contains a list of EmailReceiver -type EmailReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []EmailReceiver `json:"items"` -} - -func init() { - SchemeBuilder.Register(&EmailReceiver{}, &EmailReceiverList{}) -} diff --git a/pkg/apis/notification/v2alpha1/slackconfig_types.go b/pkg/apis/notification/v2alpha1/slackconfig_types.go deleted file mode 100644 index 42d86da7f..000000000 --- a/pkg/apis/notification/v2alpha1/slackconfig_types.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// SlackConfigSpec defines the desired state of SlackConfig -type SlackConfigSpec struct { - // The token of user or bot. - SlackTokenSecret *SecretKeySelector `json:"slackTokenSecret,omitempty"` -} - -// SlackConfigStatus defines the observed state of SlackConfig -type SlackConfigStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=sc -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// SlackConfig is the Schema for the slackconfigs API -type SlackConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec SlackConfigSpec `json:"spec,omitempty"` - Status SlackConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// SlackConfigList contains a list of SlackConfig -type SlackConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []SlackConfig `json:"items"` -} - -func init() { - SchemeBuilder.Register(&SlackConfig{}, &SlackConfigList{}) -} diff --git a/pkg/apis/notification/v2alpha1/slackreceiver_types.go b/pkg/apis/notification/v2alpha1/slackreceiver_types.go deleted file mode 100644 index 1ccc7df20..000000000 --- a/pkg/apis/notification/v2alpha1/slackreceiver_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// SlackReceiverSpec defines the desired state of SlackReceiver -type SlackReceiverSpec struct { - // SlackConfig to be selected for this receiver - SlackConfigSelector *metav1.LabelSelector `json:"slackConfigSelector,omitempty"` - // Selector to filter alerts. - AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` - // The channel or user to send notifications to. - Channel string `json:"channel"` -} - -// SlackReceiverStatus defines the observed state of SlackReceiver -type SlackReceiverStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=sr -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// SlackReceiver is the Schema for the slackreceivers API -type SlackReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec SlackReceiverSpec `json:"spec,omitempty"` - Status SlackReceiverStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// SlackReceiverList contains a list of SlackReceiver -type SlackReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []SlackReceiver `json:"items"` -} - -func init() { - SchemeBuilder.Register(&SlackReceiver{}, &SlackReceiverList{}) -} diff --git a/pkg/apis/notification/v2alpha1/types.go b/pkg/apis/notification/v2alpha1/types.go deleted file mode 100644 index 52b192fd1..000000000 --- a/pkg/apis/notification/v2alpha1/types.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -const ( - ResourcesPluralDingTalkConfig = "dingtalkconfigs" - ResourcesPluralDingTalkReceiver = "dingtalkreceivers" - ResourcesPluralEmailConfig = "emailconfigs" - ResourcesPluralEmailReceiver = "emailreceivers" - ResourcesPluralSlackConfig = "slackconfigs" - ResourcesPluralSlackReceiver = "slackreceivers" - ResourcesPluralWebhookConfig = "webhookconfigs" - ResourcesPluralWebhookReceiver = "webhookreceivers" - ResourcesPluralWechatConfig = "wechatconfigs" - ResourcesPluralWechatReceiver = "wechatreceivers" - - ResourcesSingularDingTalkConfig = "dingtalkconfig" - ResourcesSingularDingTalkReceiver = "dingtalkreceiver" - ResourcesSingularEmailConfig = "emailconfig" - ResourcesSingularEmailReceiver = "emailreceiver" - ResourcesSingularSlackConfig = "slackconfig" - ResourcesSingularSlackReceiver = "slackreceiver" - ResourcesSingularWebhookConfig = "webhookconfig" - ResourcesSingularWebhookReceiver = "webhookreceiver" - ResourcesSingularWechatConfig = "wechatconfig" - ResourcesSingularWechatReceiver = "wechatreceiver" -) diff --git a/pkg/apis/notification/v2alpha1/webhookconfig_types.go b/pkg/apis/notification/v2alpha1/webhookconfig_types.go deleted file mode 100644 index 4a0771a26..000000000 --- a/pkg/apis/notification/v2alpha1/webhookconfig_types.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// WebhookConfigSpec defines the desired state of WebhookConfig -type WebhookConfigSpec struct { -} - -// WebhookConfigStatus defines the observed state of WebhookConfig -type WebhookConfigStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=wc -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// WebhookConfig is the Schema for the webhookconfigs API -type WebhookConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec WebhookConfigSpec `json:"spec,omitempty"` - Status WebhookConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// WebhookConfigList contains a list of WebhookConfig -type WebhookConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []WebhookConfig `json:"items"` -} - -func init() { - SchemeBuilder.Register(&WebhookConfig{}, &WebhookConfigList{}) -} diff --git a/pkg/apis/notification/v2alpha1/wechatconfig_types.go b/pkg/apis/notification/v2alpha1/wechatconfig_types.go deleted file mode 100644 index 9bc974392..000000000 --- a/pkg/apis/notification/v2alpha1/wechatconfig_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// WechatConfigSpec defines the desired state of WechatConfig -type WechatConfigSpec struct { - // The WeChat API URL. - WechatApiUrl string `json:"wechatApiUrl,omitempty"` - // The corp id for authentication. - WechatApiCorpId string `json:"wechatApiCorpId"` - // The id of the application which sending message. - WechatApiAgentId string `json:"wechatApiAgentId"` - // The API key to use when talking to the WeChat API. - WechatApiSecret *SecretKeySelector `json:"wechatApiSecret"` -} - -// WechatConfigStatus defines the observed state of WechatConfig -type WechatConfigStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=wcc -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// WechatConfig is the Schema for the wechatconfigs API -type WechatConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec WechatConfigSpec `json:"spec,omitempty"` - Status WechatConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// WechatConfigList contains a list of WechatConfig -type WechatConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []WechatConfig `json:"items"` -} - -func init() { - SchemeBuilder.Register(&WechatConfig{}, &WechatConfigList{}) -} diff --git a/pkg/apis/notification/v2alpha1/wechatreceiver_types.go b/pkg/apis/notification/v2alpha1/wechatreceiver_types.go deleted file mode 100644 index 7959b1d2e..000000000 --- a/pkg/apis/notification/v2alpha1/wechatreceiver_types.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v2alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// WechatReceiverSpec defines the desired state of WechatReceiver -type WechatReceiverSpec struct { - // WechatConfig to be selected for this receiver - WechatConfigSelector *metav1.LabelSelector `json:"wechatConfigSelector,omitempty"` - // Selector to filter alerts. - AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` - // +optional - ToUser string `json:"toUser,omitempty"` - ToParty string `json:"toParty,omitempty"` - ToTag string `json:"toTag,omitempty"` -} - -// WechatReceiverStatus defines the observed state of WechatReceiver -type WechatReceiverStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=wcr -// +kubebuilder:subresource:status -// +genclient -// +genclient:nonNamespaced -// WechatReceiver is the Schema for the wechatreceivers API -type WechatReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec WechatReceiverSpec `json:"spec,omitempty"` - Status WechatReceiverStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// WechatReceiverList contains a list of WechatReceiver -type WechatReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []WechatReceiver `json:"items"` -} - -func init() { - SchemeBuilder.Register(&WechatReceiver{}, &WechatReceiverList{}) -} diff --git a/pkg/apis/notification/v2beta1/config_types.go b/pkg/apis/notification/v2beta1/config_types.go new file mode 100644 index 000000000..de1d4dea5 --- /dev/null +++ b/pkg/apis/notification/v2beta1/config_types.go @@ -0,0 +1,161 @@ +/* + + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Configuration of conversation +type DingTalkApplicationConfig struct { + // The key of the application with which to send messages. + AppKey *SecretKeySelector `json:"appkey,omitempty"` + // The key in the secret to be used. Must be a valid secret key. + AppSecret *SecretKeySelector `json:"appsecret,omitempty"` +} + +type DingTalkConfig struct { + Labels map[string]string `json:"labels,omitempty"` + // Only needed when send alerts to the conversation. + Conversation *DingTalkApplicationConfig `json:"conversation,omitempty"` +} + +type ClientCertificate struct { + // The client cert file for the targets. + Cert *SecretKeySelector `json:"cert,omitempty"` + // The client key file for the targets. + Key *SecretKeySelector `json:"key,omitempty"` +} + +// TLSConfig configures the options for TLS connections. +type TLSConfig struct { + // RootCA defines the root certificate authorities + // that clients use when verifying server certificates. + RootCA *SecretKeySelector `json:"rootCA,omitempty"` + // The certificate of the client. + *ClientCertificate `json:"clientCertificate,omitempty"` + // Used to verify the hostname for the targets. + ServerName string `json:"serverName,omitempty"` + // Disable target certificate validation. + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` +} + +// BasicAuth contains basic HTTP authentication credentials. +type BasicAuth struct { + Username string `json:"username"` + Password *SecretKeySelector `json:"password,omitempty"` +} + +// HTTPClientConfig configures an HTTP client. +type HTTPClientConfig struct { + // The HTTP basic authentication credentials for the targets. + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // The bearer token for the targets. + BearerToken *SecretKeySelector `json:"bearerToken,omitempty"` + // HTTP proxy server to use to connect to the targets. + ProxyURL string `json:"proxyUrl,omitempty"` + // TLSConfig to use to connect to the targets. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` +} + +type HostPort struct { + Host string `json:"host"` + Port int `json:"port"` +} + +type EmailConfig struct { + Labels map[string]string `json:"labels,omitempty"` + // The sender address. + From string `json:"from"` + // The address of the SMTP server. + SmartHost HostPort `json:"smartHost"` + // The hostname to use when identifying to the SMTP server. + Hello *string `json:"hello,omitempty"` + // The username for CRAM-MD5, LOGIN and PLAIN authentications. + AuthUsername *string `json:"authUsername,omitempty"` + // The identity for PLAIN authentication. + AuthIdentify *string `json:"authIdentify,omitempty"` + // The secret contains the SMTP password for LOGIN and PLAIN authentications. + AuthPassword *SecretKeySelector `json:"authPassword,omitempty"` + // The secret contains the SMTP secret for CRAM-MD5 authentication. + AuthSecret *SecretKeySelector `json:"authSecret,omitempty"` + // The default SMTP TLS requirement. + RequireTLS *bool `json:"requireTLS,omitempty"` + TLS *TLSConfig `json:"tls,omitempty"` +} + +type SlackConfig struct { + Labels map[string]string `json:"labels,omitempty"` + // The token of user or bot. + SlackTokenSecret *SecretKeySelector `json:"slackTokenSecret,omitempty"` +} + +type WebhookConfig struct { + Labels map[string]string `json:"labels,omitempty"` +} + +type WechatConfig struct { + Labels map[string]string `json:"labels,omitempty"` + // The WeChat API URL. + WechatApiUrl string `json:"wechatApiUrl,omitempty"` + // The corp id for authentication. + WechatApiCorpId string `json:"wechatApiCorpId"` + // The id of the application which sending message. + WechatApiAgentId string `json:"wechatApiAgentId"` + // The API key to use when talking to the WeChat API. + WechatApiSecret *SecretKeySelector `json:"wechatApiSecret"` +} + +//ConfigSpec defines the desired state of Config +type ConfigSpec struct { + DingTalk *DingTalkConfig `json:"dingtalk,omitempty"` + Email *EmailConfig `json:"email,omitempty"` + Slack *SlackConfig `json:"slack,omitempty"` + Webhook *WebhookConfig `json:"webhook,omitempty"` + Wechat *WechatConfig `json:"wechat,omitempty"` +} + +// ConfigStatus defines the observed state of Config +type ConfigStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=nc,categories=notification-manager +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced +// DingTalkConfig is the Schema for the dingtalkconfigs API +type Config struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ConfigSpec `json:"spec,omitempty"` + Status ConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ConfigList contains a list of Config +type ConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Config `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Config{}, &ConfigList{}) +} diff --git a/pkg/apis/notification/v2alpha1/doc.go b/pkg/apis/notification/v2beta1/doc.go similarity index 85% rename from pkg/apis/notification/v2alpha1/doc.go rename to pkg/apis/notification/v2beta1/doc.go index 73b0fbc8c..bb3db191e 100644 --- a/pkg/apis/notification/v2alpha1/doc.go +++ b/pkg/apis/notification/v2beta1/doc.go @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha1 contains API Schema definitions for the notification v2alpha1 API group +// Package v2beta1 contains API Schema definitions for the notification v2beta1 API group // +groupName=notification.kubesphere.io // +genclient // +genclient:nonNamespaced -package v2alpha1 +package v2beta1 diff --git a/pkg/apis/notification/v2alpha1/notificationmanager_types.go b/pkg/apis/notification/v2beta1/notificationmanager_types.go similarity index 97% rename from pkg/apis/notification/v2alpha1/notificationmanager_types.go rename to pkg/apis/notification/v2beta1/notificationmanager_types.go index ac8681d82..feb4115b0 100644 --- a/pkg/apis/notification/v2alpha1/notificationmanager_types.go +++ b/pkg/apis/notification/v2beta1/notificationmanager_types.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The KubeSphere Authors. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2alpha1 +package v2beta1 import ( "k8s.io/api/core/v1" @@ -61,6 +61,8 @@ type NotificationManagerSpec struct { DefaultConfigSelector *metav1.LabelSelector `json:"defaultConfigSelector,omitempty"` // Receivers to send notifications to Receivers *ReceiversSpec `json:"receivers"` + // The default namespace to which notification manager secrets belong. + DefaultSecretNamespace string `json:"defaultSecretNamespace,omitempty"` // List of volumes that can be mounted by containers belonging to the pod. Volumes []v1.Volume `json:"volumes,omitempty"` // Pod volumes to mount into the container's filesystem. @@ -185,7 +187,7 @@ type NotificationManagerStatus struct { } // +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=nm +// +kubebuilder:resource:scope=Cluster,shortName=nm,categories=notification-manager // +kubebuilder:subresource:status // NotificationManager is the Schema for the notificationmanagers API diff --git a/pkg/apis/notification/v2alpha1/webhookreceiver_types.go b/pkg/apis/notification/v2beta1/receiver_types.go similarity index 51% rename from pkg/apis/notification/v2alpha1/webhookreceiver_types.go rename to pkg/apis/notification/v2beta1/receiver_types.go index 6b6eeaf04..5d3921946 100644 --- a/pkg/apis/notification/v2alpha1/webhookreceiver_types.go +++ b/pkg/apis/notification/v2beta1/receiver_types.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The KubeSphere Authors. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,48 +14,62 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2alpha1 +package v2beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -type ClientCertificate struct { - // The client cert file for the targets. - Cert *SecretKeySelector `json:"cert,omitempty"` - // The client key file for the targets. - Key *SecretKeySelector `json:"key,omitempty"` +// Configuration of ChatBot +type DingTalkChatBot struct { + // The webhook of ChatBot which the message will send to. + Webhook *SecretKeySelector `json:"webhook"` + + // Custom keywords of ChatBot + Keywords []string `json:"keywords,omitempty"` + + // Secret of ChatBot, you can get it after enabled Additional Signature of ChatBot. + Secret *SecretKeySelector `json:"secret,omitempty"` } -// TLSConfig configures the options for TLS connections. -type TLSConfig struct { - // RootCA defines the root certificate authorities - // that clients use when verifying server certificates. - RootCA *SecretKeySelector `json:"rootCA,omitempty"` - // The certificate of the client. - *ClientCertificate `json:"clientCertificate,omitempty"` - // Used to verify the hostname for the targets. - ServerName string `json:"serverName,omitempty"` - // Disable target certificate validation. - InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` +// Configuration of conversation +type DingTalkConversation struct { + ChatIDs []string `json:"chatids"` } -// BasicAuth contains basic HTTP authentication credentials. -type BasicAuth struct { - Username string `json:"username"` - Password *SecretKeySelector `json:"password,omitempty"` +type DingTalkReceiver struct { + // whether the receiver is enabled + Enabled *bool `json:"enabled,omitempty"` + // DingTalkConfig to be selected for this receiver + DingTalkConfigSelector *metav1.LabelSelector `json:"dingtalkConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // Be careful, a ChatBot only can send 20 message per minute. + ChatBot *DingTalkChatBot `json:"chatbot,omitempty"` + // The conversation which message will send to. + Conversation *DingTalkConversation `json:"conversation,omitempty"` } -// HTTPClientConfig configures an HTTP client. -type HTTPClientConfig struct { - // The HTTP basic authentication credentials for the targets. - BasicAuth *BasicAuth `json:"basicAuth,omitempty"` - // The bearer token for the targets. - BearerToken *SecretKeySelector `json:"bearerToken,omitempty"` - // HTTP proxy server to use to connect to the targets. - ProxyURL string `json:"proxyUrl,omitempty"` - // TLSConfig to use to connect to the targets. - TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` +type EmailReceiver struct { + // whether the receiver is enabled + Enabled *bool `json:"enabled,omitempty"` + // Receivers' email addresses + To []string `json:"to"` + // EmailConfig to be selected for this receiver + EmailConfigSelector *metav1.LabelSelector `json:"emailConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` +} + +type SlackReceiver struct { + // whether the receiver is enabled + Enabled *bool `json:"enabled,omitempty"` + // SlackConfig to be selected for this receiver + SlackConfigSelector *metav1.LabelSelector `json:"slackConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // The channel or user to send notifications to. + Channels []string `json:"channels"` } // ServiceReference holds a reference to Service.legacy.k8s.io @@ -84,8 +98,9 @@ type ServiceReference struct { Scheme *string `json:"scheme,omitempty"` } -// WebhookReceiverSpec defines the desired state of WebhookReceiver -type WebhookReceiverSpec struct { +type WebhookReceiver struct { + // whether the receiver is enabled + Enabled *bool `json:"enabled,omitempty"` // WebhookConfig to be selected for this receiver WebhookConfigSelector *metav1.LabelSelector `json:"webhookConfigSelector,omitempty"` // Selector to filter alerts. @@ -128,33 +143,55 @@ type WebhookReceiverSpec struct { HTTPConfig *HTTPClientConfig `json:"httpConfig,omitempty"` } -// WebhookReceiverStatus defines the observed state of WebhookReceiver -type WebhookReceiverStatus struct { +type WechatReceiver struct { + // whether the receiver is enabled + Enabled *bool `json:"enabled,omitempty"` + // WechatConfig to be selected for this receiver + WechatConfigSelector *metav1.LabelSelector `json:"wechatConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // +optional + ToUser []string `json:"toUser,omitempty"` + ToParty []string `json:"toParty,omitempty"` + ToTag []string `json:"toTag,omitempty"` +} + +//ReceiverSpec defines the desired state of Receiver +type ReceiverSpec struct { + DingTalk *DingTalkReceiver `json:"dingtalk,omitempty"` + Email *EmailReceiver `json:"email,omitempty"` + Slack *SlackReceiver `json:"slack,omitempty"` + Webhook *WebhookReceiver `json:"webhook,omitempty"` + Wechat *WechatReceiver `json:"wechat,omitempty"` +} + +// ReceiverStatus defines the observed state of Receiver +type ReceiverStatus struct { } // +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster,shortName=wr +// +kubebuilder:resource:scope=Cluster,shortName=nr,categories=notification-manager // +kubebuilder:subresource:status // +genclient // +genclient:nonNamespaced -// WebhookReceiver is the Schema for the webhookreceivers API -type WebhookReceiver struct { +// Receiver is the Schema for the receivers API +type Receiver struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec WebhookReceiverSpec `json:"spec,omitempty"` - Status WebhookReceiverStatus `json:"status,omitempty"` + Spec ReceiverSpec `json:"spec,omitempty"` + Status ReceiverStatus `json:"status,omitempty"` } // +kubebuilder:object:root=true -// WebhookReceiverList contains a list of WebhookReceiver -type WebhookReceiverList struct { +// ReceiverList contains a list of Receiver +type ReceiverList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []WebhookReceiver `json:"items"` + Items []Receiver `json:"items"` } func init() { - SchemeBuilder.Register(&WebhookReceiver{}, &WebhookReceiverList{}) + SchemeBuilder.Register(&Receiver{}, &ReceiverList{}) } diff --git a/pkg/apis/notification/v2alpha1/register.go b/pkg/apis/notification/v2beta1/register.go similarity index 89% rename from pkg/apis/notification/v2alpha1/register.go rename to pkg/apis/notification/v2beta1/register.go index b36e0bd20..f0d466ec6 100644 --- a/pkg/apis/notification/v2alpha1/register.go +++ b/pkg/apis/notification/v2beta1/register.go @@ -16,10 +16,10 @@ limitations under the License. // NOTE: Boilerplate only. Ignore this file. -// Package v1alpha1 contains API Schema definitions for the notification v2alpha1 API group +// Package v2beta1 contains API Schema definitions for the notification v2beta1 API group // +k8s:deepcopy-gen=package,register // +groupName=notification.kubesphere.io -package v2alpha1 +package v2beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -28,7 +28,7 @@ import ( var ( // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "notification.kubesphere.io", Version: "v2alpha1"} + SchemeGroupVersion = schema.GroupVersion{Group: "notification.kubesphere.io", Version: "v2beta1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} diff --git a/pkg/apis/notification/v2beta1/types.go b/pkg/apis/notification/v2beta1/types.go new file mode 100644 index 000000000..5db537274 --- /dev/null +++ b/pkg/apis/notification/v2beta1/types.go @@ -0,0 +1,27 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2beta1 + +const ( + ResourceKindConfig = "Configs" + ResourcesSingularConfig = "config" + ResourcesPluralConfig = "configs" + + ResourceKindReceiver = "Receiver" + ResourcesSingularReceiver = "receiver" + ResourcesPluralReceiver = "receivers" +) diff --git a/pkg/apis/notification/v2alpha1/v2alpha1_suite_test.go b/pkg/apis/notification/v2beta1/v2beta1_suite_test.go similarity index 98% rename from pkg/apis/notification/v2alpha1/v2alpha1_suite_test.go rename to pkg/apis/notification/v2beta1/v2beta1_suite_test.go index 5309e2eb5..437b7afd4 100644 --- a/pkg/apis/notification/v2alpha1/v2alpha1_suite_test.go +++ b/pkg/apis/notification/v2beta1/v2beta1_suite_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2alpha1 +package v2beta1 import ( "log" diff --git a/pkg/apis/notification/v2alpha1/zz_generated.deepcopy.go b/pkg/apis/notification/v2beta1/zz_generated.deepcopy.go similarity index 59% rename from pkg/apis/notification/v2alpha1/zz_generated.deepcopy.go rename to pkg/apis/notification/v2beta1/zz_generated.deepcopy.go index 530e0f18e..559800ecb 100644 --- a/pkg/apis/notification/v2alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/notification/v2beta1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* - +Copyright 2020 The KubeSphere Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,11 +18,11 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v2alpha1 +package v2beta1 import ( - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -71,6 +71,120 @@ func (in *ClientCertificate) DeepCopy() *ClientCertificate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Config) DeepCopyInto(out *Config) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config. +func (in *Config) DeepCopy() *Config { + if in == nil { + return nil + } + out := new(Config) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Config) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigList) DeepCopyInto(out *ConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Config, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigList. +func (in *ConfigList) DeepCopy() *ConfigList { + if in == nil { + return nil + } + out := new(ConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec) { + *out = *in + if in.DingTalk != nil { + in, out := &in.DingTalk, &out.DingTalk + *out = new(DingTalkConfig) + (*in).DeepCopyInto(*out) + } + if in.Email != nil { + in, out := &in.Email, &out.Email + *out = new(EmailConfig) + (*in).DeepCopyInto(*out) + } + if in.Slack != nil { + in, out := &in.Slack, &out.Slack + *out = new(SlackConfig) + (*in).DeepCopyInto(*out) + } + if in.Webhook != nil { + in, out := &in.Webhook, &out.Webhook + *out = new(WebhookConfig) + (*in).DeepCopyInto(*out) + } + if in.Wechat != nil { + in, out := &in.Wechat, &out.Wechat + *out = new(WechatConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigSpec. +func (in *ConfigSpec) DeepCopy() *ConfigSpec { + if in == nil { + return nil + } + out := new(ConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigStatus) DeepCopyInto(out *ConfigStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigStatus. +func (in *ConfigStatus) DeepCopy() *ConfigStatus { + if in == nil { + return nil + } + out := new(ConfigStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DingTalkApplicationConfig) DeepCopyInto(out *DingTalkApplicationConfig) { *out = *in @@ -129,10 +243,18 @@ func (in *DingTalkChatBot) DeepCopy() *DingTalkChatBot { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DingTalkConfig) DeepCopyInto(out *DingTalkConfig) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Conversation != nil { + in, out := &in.Conversation, &out.Conversation + *out = new(DingTalkApplicationConfig) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfig. @@ -145,84 +267,14 @@ func (in *DingTalkConfig) DeepCopy() *DingTalkConfig { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DingTalkConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkConfigList) DeepCopyInto(out *DingTalkConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]DingTalkConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigList. -func (in *DingTalkConfigList) DeepCopy() *DingTalkConfigList { - if in == nil { - return nil - } - out := new(DingTalkConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DingTalkConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkConfigSpec) DeepCopyInto(out *DingTalkConfigSpec) { - *out = *in - if in.Conversation != nil { - in, out := &in.Conversation, &out.Conversation - *out = new(DingTalkApplicationConfig) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigSpec. -func (in *DingTalkConfigSpec) DeepCopy() *DingTalkConfigSpec { - if in == nil { - return nil - } - out := new(DingTalkConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkConfigStatus) DeepCopyInto(out *DingTalkConfigStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigStatus. -func (in *DingTalkConfigStatus) DeepCopy() *DingTalkConfigStatus { - if in == nil { - return nil - } - out := new(DingTalkConfigStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DingTalkConversation) DeepCopyInto(out *DingTalkConversation) { *out = *in + if in.ChatIDs != nil { + in, out := &in.ChatIDs, &out.ChatIDs + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConversation. @@ -268,10 +320,31 @@ func (in *DingTalkOptions) DeepCopy() *DingTalkOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DingTalkReceiver) DeepCopyInto(out *DingTalkReceiver) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.DingTalkConfigSelector != nil { + in, out := &in.DingTalkConfigSelector, &out.DingTalkConfigSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.ChatBot != nil { + in, out := &in.ChatBot, &out.ChatBot + *out = new(DingTalkChatBot) + (*in).DeepCopyInto(*out) + } + if in.Conversation != nil { + in, out := &in.Conversation, &out.Conversation + *out = new(DingTalkConversation) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiver. @@ -284,158 +357,16 @@ func (in *DingTalkReceiver) DeepCopy() *DingTalkReceiver { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DingTalkReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkReceiverList) DeepCopyInto(out *DingTalkReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]DingTalkReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverList. -func (in *DingTalkReceiverList) DeepCopy() *DingTalkReceiverList { - if in == nil { - return nil - } - out := new(DingTalkReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DingTalkReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkReceiverSpec) DeepCopyInto(out *DingTalkReceiverSpec) { - *out = *in - if in.DingTalkConfigSelector != nil { - in, out := &in.DingTalkConfigSelector, &out.DingTalkConfigSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.AlertSelector != nil { - in, out := &in.AlertSelector, &out.AlertSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.ChatBot != nil { - in, out := &in.ChatBot, &out.ChatBot - *out = new(DingTalkChatBot) - (*in).DeepCopyInto(*out) - } - if in.Conversation != nil { - in, out := &in.Conversation, &out.Conversation - *out = new(DingTalkConversation) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverSpec. -func (in *DingTalkReceiverSpec) DeepCopy() *DingTalkReceiverSpec { - if in == nil { - return nil - } - out := new(DingTalkReceiverSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkReceiverStatus) DeepCopyInto(out *DingTalkReceiverStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverStatus. -func (in *DingTalkReceiverStatus) DeepCopy() *DingTalkReceiverStatus { - if in == nil { - return nil - } - out := new(DingTalkReceiverStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EmailConfig) DeepCopyInto(out *EmailConfig) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfig. -func (in *EmailConfig) DeepCopy() *EmailConfig { - if in == nil { - return nil - } - out := new(EmailConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EmailConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailConfigList) DeepCopyInto(out *EmailConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EmailConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val } } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigList. -func (in *EmailConfigList) DeepCopy() *EmailConfigList { - if in == nil { - return nil - } - out := new(EmailConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EmailConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailConfigSpec) DeepCopyInto(out *EmailConfigSpec) { - *out = *in out.SmartHost = in.SmartHost if in.Hello != nil { in, out := &in.Hello, &out.Hello @@ -474,27 +405,12 @@ func (in *EmailConfigSpec) DeepCopyInto(out *EmailConfigSpec) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigSpec. -func (in *EmailConfigSpec) DeepCopy() *EmailConfigSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfig. +func (in *EmailConfig) DeepCopy() *EmailConfig { if in == nil { return nil } - out := new(EmailConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailConfigStatus) DeepCopyInto(out *EmailConfigStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigStatus. -func (in *EmailConfigStatus) DeepCopy() *EmailConfigStatus { - if in == nil { - return nil - } - out := new(EmailConfigStatus) + out := new(EmailConfig) in.DeepCopyInto(out) return out } @@ -522,10 +438,26 @@ func (in *EmailOptions) DeepCopy() *EmailOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EmailReceiver) DeepCopyInto(out *EmailReceiver) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.To != nil { + in, out := &in.To, &out.To + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.EmailConfigSelector != nil { + in, out := &in.EmailConfigSelector, &out.EmailConfigSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiver. @@ -538,91 +470,6 @@ func (in *EmailReceiver) DeepCopy() *EmailReceiver { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EmailReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailReceiverList) DeepCopyInto(out *EmailReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EmailReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverList. -func (in *EmailReceiverList) DeepCopy() *EmailReceiverList { - if in == nil { - return nil - } - out := new(EmailReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EmailReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailReceiverSpec) DeepCopyInto(out *EmailReceiverSpec) { - *out = *in - if in.To != nil { - in, out := &in.To, &out.To - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.EmailConfigSelector != nil { - in, out := &in.EmailConfigSelector, &out.EmailConfigSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.AlertSelector != nil { - in, out := &in.AlertSelector, &out.AlertSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverSpec. -func (in *EmailReceiverSpec) DeepCopy() *EmailReceiverSpec { - if in == nil { - return nil - } - out := new(EmailReceiverSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailReceiverStatus) DeepCopyInto(out *EmailReceiverStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverStatus. -func (in *EmailReceiverStatus) DeepCopy() *EmailReceiverStatus { - if in == nil { - return nil - } - out := new(EmailReceiverStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GlobalOptions) DeepCopyInto(out *GlobalOptions) { *out = *in @@ -758,7 +605,7 @@ func (in *NotificationManagerSpec) DeepCopyInto(out *NotificationManagerSpec) { } if in.ImagePullPolicy != nil { in, out := &in.ImagePullPolicy, &out.ImagePullPolicy - *out = new(corev1.PullPolicy) + *out = new(v1.PullPolicy) **out = **in } if in.Replicas != nil { @@ -775,19 +622,19 @@ func (in *NotificationManagerSpec) DeepCopyInto(out *NotificationManagerSpec) { } if in.Affinity != nil { in, out := &in.Affinity, &out.Affinity - *out = new(corev1.Affinity) + *out = new(v1.Affinity) (*in).DeepCopyInto(*out) } if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations - *out = make([]corev1.Toleration, len(*in)) + *out = make([]v1.Toleration, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.DefaultConfigSelector != nil { in, out := &in.DefaultConfigSelector, &out.DefaultConfigSelector - *out = new(v1.LabelSelector) + *out = new(metav1.LabelSelector) (*in).DeepCopyInto(*out) } if in.Receivers != nil { @@ -797,14 +644,14 @@ func (in *NotificationManagerSpec) DeepCopyInto(out *NotificationManagerSpec) { } if in.Volumes != nil { in, out := &in.Volumes, &out.Volumes - *out = make([]corev1.Volume, len(*in)) + *out = make([]v1.Volume, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } if in.VolumeMounts != nil { in, out := &in.VolumeMounts, &out.VolumeMounts - *out = make([]corev1.VolumeMount, len(*in)) + *out = make([]v1.VolumeMount, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -886,17 +733,131 @@ func (in *Options) DeepCopy() *Options { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Receiver) DeepCopyInto(out *Receiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Receiver. +func (in *Receiver) DeepCopy() *Receiver { + if in == nil { + return nil + } + out := new(Receiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Receiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReceiverList) DeepCopyInto(out *ReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Receiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReceiverList. +func (in *ReceiverList) DeepCopy() *ReceiverList { + if in == nil { + return nil + } + out := new(ReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReceiverSpec) DeepCopyInto(out *ReceiverSpec) { + *out = *in + if in.DingTalk != nil { + in, out := &in.DingTalk, &out.DingTalk + *out = new(DingTalkReceiver) + (*in).DeepCopyInto(*out) + } + if in.Email != nil { + in, out := &in.Email, &out.Email + *out = new(EmailReceiver) + (*in).DeepCopyInto(*out) + } + if in.Slack != nil { + in, out := &in.Slack, &out.Slack + *out = new(SlackReceiver) + (*in).DeepCopyInto(*out) + } + if in.Webhook != nil { + in, out := &in.Webhook, &out.Webhook + *out = new(WebhookReceiver) + (*in).DeepCopyInto(*out) + } + if in.Wechat != nil { + in, out := &in.Wechat, &out.Wechat + *out = new(WechatReceiver) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReceiverSpec. +func (in *ReceiverSpec) DeepCopy() *ReceiverSpec { + if in == nil { + return nil + } + out := new(ReceiverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReceiverStatus) DeepCopyInto(out *ReceiverStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReceiverStatus. +func (in *ReceiverStatus) DeepCopy() *ReceiverStatus { + if in == nil { + return nil + } + out := new(ReceiverStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ReceiversSpec) DeepCopyInto(out *ReceiversSpec) { *out = *in if in.GlobalReceiverSelector != nil { in, out := &in.GlobalReceiverSelector, &out.GlobalReceiverSelector - *out = new(v1.LabelSelector) + *out = new(metav1.LabelSelector) (*in).DeepCopyInto(*out) } if in.TenantReceiverSelector != nil { in, out := &in.TenantReceiverSelector, &out.TenantReceiverSelector - *out = new(v1.LabelSelector) + *out = new(metav1.LabelSelector) (*in).DeepCopyInto(*out) } if in.Options != nil { @@ -964,10 +925,18 @@ func (in *ServiceReference) DeepCopy() *ServiceReference { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SlackConfig) DeepCopyInto(out *SlackConfig) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.SlackTokenSecret != nil { + in, out := &in.SlackTokenSecret, &out.SlackTokenSecret + *out = new(SecretKeySelector) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfig. @@ -980,81 +949,6 @@ func (in *SlackConfig) DeepCopy() *SlackConfig { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SlackConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackConfigList) DeepCopyInto(out *SlackConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]SlackConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigList. -func (in *SlackConfigList) DeepCopy() *SlackConfigList { - if in == nil { - return nil - } - out := new(SlackConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SlackConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackConfigSpec) DeepCopyInto(out *SlackConfigSpec) { - *out = *in - if in.SlackTokenSecret != nil { - in, out := &in.SlackTokenSecret, &out.SlackTokenSecret - *out = new(SecretKeySelector) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigSpec. -func (in *SlackConfigSpec) DeepCopy() *SlackConfigSpec { - if in == nil { - return nil - } - out := new(SlackConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackConfigStatus) DeepCopyInto(out *SlackConfigStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigStatus. -func (in *SlackConfigStatus) DeepCopy() *SlackConfigStatus { - if in == nil { - return nil - } - out := new(SlackConfigStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SlackOptions) DeepCopyInto(out *SlackOptions) { *out = *in @@ -1078,10 +972,26 @@ func (in *SlackOptions) DeepCopy() *SlackOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SlackReceiver) DeepCopyInto(out *SlackReceiver) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.SlackConfigSelector != nil { + in, out := &in.SlackConfigSelector, &out.SlackConfigSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.Channels != nil { + in, out := &in.Channels, &out.Channels + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiver. @@ -1094,86 +1004,6 @@ func (in *SlackReceiver) DeepCopy() *SlackReceiver { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SlackReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackReceiverList) DeepCopyInto(out *SlackReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]SlackReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverList. -func (in *SlackReceiverList) DeepCopy() *SlackReceiverList { - if in == nil { - return nil - } - out := new(SlackReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SlackReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackReceiverSpec) DeepCopyInto(out *SlackReceiverSpec) { - *out = *in - if in.SlackConfigSelector != nil { - in, out := &in.SlackConfigSelector, &out.SlackConfigSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.AlertSelector != nil { - in, out := &in.AlertSelector, &out.AlertSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverSpec. -func (in *SlackReceiverSpec) DeepCopy() *SlackReceiverSpec { - if in == nil { - return nil - } - out := new(SlackReceiverSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackReceiverStatus) DeepCopyInto(out *SlackReceiverStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverStatus. -func (in *SlackReceiverStatus) DeepCopy() *SlackReceiverStatus { - if in == nil { - return nil - } - out := new(SlackReceiverStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TLSConfig) DeepCopyInto(out *TLSConfig) { *out = *in @@ -1217,10 +1047,13 @@ func (in *Throttle) DeepCopy() *Throttle { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WebhookConfig) DeepCopyInto(out *WebhookConfig) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfig. @@ -1233,76 +1066,6 @@ func (in *WebhookConfig) DeepCopy() *WebhookConfig { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WebhookConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookConfigList) DeepCopyInto(out *WebhookConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]WebhookConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigList. -func (in *WebhookConfigList) DeepCopy() *WebhookConfigList { - if in == nil { - return nil - } - out := new(WebhookConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WebhookConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookConfigSpec) DeepCopyInto(out *WebhookConfigSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigSpec. -func (in *WebhookConfigSpec) DeepCopy() *WebhookConfigSpec { - if in == nil { - return nil - } - out := new(WebhookConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookConfigStatus) DeepCopyInto(out *WebhookConfigStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigStatus. -func (in *WebhookConfigStatus) DeepCopy() *WebhookConfigStatus { - if in == nil { - return nil - } - out := new(WebhookConfigStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WebhookOptions) DeepCopyInto(out *WebhookOptions) { *out = *in @@ -1326,73 +1089,19 @@ func (in *WebhookOptions) DeepCopy() *WebhookOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WebhookReceiver) DeepCopyInto(out *WebhookReceiver) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiver. -func (in *WebhookReceiver) DeepCopy() *WebhookReceiver { - if in == nil { - return nil + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in } - out := new(WebhookReceiver) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WebhookReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookReceiverList) DeepCopyInto(out *WebhookReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]WebhookReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverList. -func (in *WebhookReceiverList) DeepCopy() *WebhookReceiverList { - if in == nil { - return nil - } - out := new(WebhookReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WebhookReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookReceiverSpec) DeepCopyInto(out *WebhookReceiverSpec) { - *out = *in if in.WebhookConfigSelector != nil { in, out := &in.WebhookConfigSelector, &out.WebhookConfigSelector - *out = new(v1.LabelSelector) + *out = new(metav1.LabelSelector) (*in).DeepCopyInto(*out) } if in.AlertSelector != nil { in, out := &in.AlertSelector, &out.AlertSelector - *out = new(v1.LabelSelector) + *out = new(metav1.LabelSelector) (*in).DeepCopyInto(*out) } if in.URL != nil { @@ -1412,27 +1121,12 @@ func (in *WebhookReceiverSpec) DeepCopyInto(out *WebhookReceiverSpec) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverSpec. -func (in *WebhookReceiverSpec) DeepCopy() *WebhookReceiverSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiver. +func (in *WebhookReceiver) DeepCopy() *WebhookReceiver { if in == nil { return nil } - out := new(WebhookReceiverSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookReceiverStatus) DeepCopyInto(out *WebhookReceiverStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverStatus. -func (in *WebhookReceiverStatus) DeepCopy() *WebhookReceiverStatus { - if in == nil { - return nil - } - out := new(WebhookReceiverStatus) + out := new(WebhookReceiver) in.DeepCopyInto(out) return out } @@ -1440,10 +1134,18 @@ func (in *WebhookReceiverStatus) DeepCopy() *WebhookReceiverStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WechatConfig) DeepCopyInto(out *WechatConfig) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.WechatApiSecret != nil { + in, out := &in.WechatApiSecret, &out.WechatApiSecret + *out = new(SecretKeySelector) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfig. @@ -1456,81 +1158,6 @@ func (in *WechatConfig) DeepCopy() *WechatConfig { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WechatConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatConfigList) DeepCopyInto(out *WechatConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]WechatConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigList. -func (in *WechatConfigList) DeepCopy() *WechatConfigList { - if in == nil { - return nil - } - out := new(WechatConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WechatConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatConfigSpec) DeepCopyInto(out *WechatConfigSpec) { - *out = *in - if in.WechatApiSecret != nil { - in, out := &in.WechatApiSecret, &out.WechatApiSecret - *out = new(SecretKeySelector) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigSpec. -func (in *WechatConfigSpec) DeepCopy() *WechatConfigSpec { - if in == nil { - return nil - } - out := new(WechatConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatConfigStatus) DeepCopyInto(out *WechatConfigStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigStatus. -func (in *WechatConfigStatus) DeepCopy() *WechatConfigStatus { - if in == nil { - return nil - } - out := new(WechatConfigStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WechatOptions) DeepCopyInto(out *WechatOptions) { *out = *in @@ -1554,10 +1181,36 @@ func (in *WechatOptions) DeepCopy() *WechatOptions { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WechatReceiver) DeepCopyInto(out *WechatReceiver) { *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.WechatConfigSelector != nil { + in, out := &in.WechatConfigSelector, &out.WechatConfigSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.AlertSelector != nil { + in, out := &in.AlertSelector, &out.AlertSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.ToUser != nil { + in, out := &in.ToUser, &out.ToUser + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ToParty != nil { + in, out := &in.ToParty, &out.ToParty + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ToTag != nil { + in, out := &in.ToTag, &out.ToTag + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiver. @@ -1569,83 +1222,3 @@ func (in *WechatReceiver) DeepCopy() *WechatReceiver { in.DeepCopyInto(out) return out } - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WechatReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatReceiverList) DeepCopyInto(out *WechatReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]WechatReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverList. -func (in *WechatReceiverList) DeepCopy() *WechatReceiverList { - if in == nil { - return nil - } - out := new(WechatReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WechatReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatReceiverSpec) DeepCopyInto(out *WechatReceiverSpec) { - *out = *in - if in.WechatConfigSelector != nil { - in, out := &in.WechatConfigSelector, &out.WechatConfigSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.AlertSelector != nil { - in, out := &in.AlertSelector, &out.AlertSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverSpec. -func (in *WechatReceiverSpec) DeepCopy() *WechatReceiverSpec { - if in == nil { - return nil - } - out := new(WechatReceiverSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatReceiverStatus) DeepCopyInto(out *WechatReceiverStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverStatus. -func (in *WechatReceiverStatus) DeepCopy() *WechatReceiverStatus { - if in == nil { - return nil - } - out := new(WechatReceiverStatus) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go b/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go deleted file mode 100644 index 0a6fa0172..000000000 --- a/pkg/apis/types/v1beta1/federateddingtalkreceiver_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedDingTalkReceiver = "federateddingtalkreceivers" - ResourceSingularFederatedDingTalkReceiver = "federateddingtalkreceiver" - FederatedDingTalkReceiverKind = "FederatedDingTalkReceiver" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedDingTalkReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedDingTalkReceiverSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedDingTalkReceiverSpec struct { - Template DingTalkReceiverTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type DingTalkReceiverTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.DingTalkReceiverSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedDingTalkConfigList contains a list of federateddingtalkreceiverlists -type FederatedDingTalkReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedDingTalkReceiver `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/federatedemailconfig_types.go b/pkg/apis/types/v1beta1/federatedemailconfig_types.go deleted file mode 100644 index 4fa1e8a26..000000000 --- a/pkg/apis/types/v1beta1/federatedemailconfig_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedEmailConfig = "federatedemailconfigs" - ResourceSingularFederatedEmailConfig = "federatedemailconfig" - FederatedEmailConfigKind = "FederatedEmailConfig" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedEmailConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedEmailConfigSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedEmailConfigSpec struct { - Template EmailConfigTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type EmailConfigTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.EmailConfigSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedEmailConfigList contains a list of federatedemailconfiglists -type FederatedEmailConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedEmailConfig `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/federatedemailreceiver_types.go b/pkg/apis/types/v1beta1/federatedemailreceiver_types.go deleted file mode 100644 index dc1cb06a1..000000000 --- a/pkg/apis/types/v1beta1/federatedemailreceiver_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedEmailReceiver = "federatedemailreceivers" - ResourceSingularFederatedEmailReceiver = "federatedemailreceiver" - FederatedEmailReceiverKind = "FederatedEmailReceiver" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedEmailReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedEmailReceiverSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedEmailReceiverSpec struct { - Template EmailReceiverTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type EmailReceiverTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.EmailReceiverSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedEmailConfigList contains a list of federatedemailconfiglists -type FederatedEmailReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedEmailReceiver `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go b/pkg/apis/types/v1beta1/federatednotificationconfig_types.go similarity index 58% rename from pkg/apis/types/v1beta1/federateddingtalkconfig_types.go rename to pkg/apis/types/v1beta1/federatednotificationconfig_types.go index fd4436a8a..c866303ef 100644 --- a/pkg/apis/types/v1beta1/federateddingtalkconfig_types.go +++ b/pkg/apis/types/v1beta1/federatednotificationconfig_types.go @@ -18,13 +18,13 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" ) const ( - ResourcePluralFederatedDingTalkConfig = "federateddingtalkconfigs" - ResourceSingularFederatedDingTalkConfig = "federateddingtalkconfig" - FederatedDingTalkConfigKind = "FederatedDingTalkConfig" + ResourcePluralFederatedNotificationConfig = "federatednotificationconfigs" + ResourceSingularFederatedNotificationConfig = "federatednotificationconfig" + FederatedNotificationConfigKind = "FederatedNotificationConfig" ) // +genclient:nonNamespaced @@ -33,31 +33,31 @@ const ( // +k8s:openapi-gen=true // +kubebuilder:resource:scope=Cluster // +kubebuilder:subresource:status -type FederatedDingTalkConfig struct { +type FederatedNotificationConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedDingTalkConfigSpec `json:"spec"` + Spec FederatedNotificationConfigSpec `json:"spec"` Status *GenericFederatedStatus `json:"status,omitempty"` } -type FederatedDingTalkConfigSpec struct { - Template DingTalkConfigTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` +type FederatedNotificationConfigSpec struct { + Template NotificationConfigTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` } -type DingTalkConfigTemplate struct { +type NotificationConfigTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.DingTalkConfigSpec `json:"spec,omitempty"` + Spec v2beta1.ConfigSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// FederatedDingTalkConfigList contains a list of federateddingtalkconfiglists -type FederatedDingTalkConfigList struct { +// FederatedNotificationConfigList contains a list of federatednotificationconfiglists +type FederatedNotificationConfigList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedDingTalkConfig `json:"items"` + Items []FederatedNotificationConfig `json:"items"` } diff --git a/pkg/apis/types/v1beta1/federatedwechatconfig_types.go b/pkg/apis/types/v1beta1/federatednotificationreceiver_types.go similarity index 56% rename from pkg/apis/types/v1beta1/federatedwechatconfig_types.go rename to pkg/apis/types/v1beta1/federatednotificationreceiver_types.go index 382c563c9..0640ce2e3 100644 --- a/pkg/apis/types/v1beta1/federatedwechatconfig_types.go +++ b/pkg/apis/types/v1beta1/federatednotificationreceiver_types.go @@ -18,13 +18,13 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" ) const ( - ResourcePluralFederatedWechatConfig = "federatedwechatconfigs" - ResourceSingularFederatedWechatConfig = "federatedwechatconfig" - FederatedWechatConfigKind = "FederatedWechatConfig" + ResourcePluralFederatedNotificationReceiver = "federatednotificationreceivers" + ResourceSingularFederatedNotificationReceiver = "federatednotificationreceiver" + FederatedNotificationReceiverKind = "FederatedNotificationReceiver" ) // +genclient:nonNamespaced @@ -32,31 +32,31 @@ const ( // +k8s:openapi-gen=true // +kubebuilder:resource:scope=Cluster // +kubebuilder:subresource:status -type FederatedWechatConfig struct { +type FederatedNotificationReceiver struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedWechatConfigSpec `json:"spec"` + Spec FederatedNotificationReceiverSpec `json:"spec"` Status *GenericFederatedStatus `json:"status,omitempty"` } -type FederatedWechatConfigSpec struct { - Template WechatConfigTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` +type FederatedNotificationReceiverSpec struct { + Template NotificationReceiverTemplate `json:"template"` + Placement GenericPlacementFields `json:"placement"` + Overrides []GenericOverrideItem `json:"overrides,omitempty"` } -type WechatConfigTemplate struct { +type NotificationReceiverTemplate struct { // +kubebuilder:pruning:PreserveUnknownFields metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.WechatConfigSpec `json:"spec,omitempty"` + Spec v2beta1.ReceiverSpec `json:"spec,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// FederatedWechatConfigList contains a list of federatedwechatconfiglists -type FederatedWechatConfigList struct { +// FederatedNotificationConfigList contains a list of federatednotificationreceiverlists +type FederatedNotificationReceiverList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedWechatConfig `json:"items"` + Items []FederatedNotificationReceiver `json:"items"` } diff --git a/pkg/apis/types/v1beta1/federatedslackconfig_types.go b/pkg/apis/types/v1beta1/federatedslackconfig_types.go deleted file mode 100644 index 4871bcaac..000000000 --- a/pkg/apis/types/v1beta1/federatedslackconfig_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedSlackConfig = "federatedslackconfigs" - ResourceSingularFederatedSlackConfig = "federatedslackconfig" - FederatedSlackConfigKind = "FederatedSlackConfig" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedSlackConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedSlackConfigSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedSlackConfigSpec struct { - Template SlackConfigTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type SlackConfigTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.SlackConfigSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedSlackConfigList contains a list of federatedslackconfiglists -type FederatedSlackConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedSlackConfig `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/federatedslackreceiver_types.go b/pkg/apis/types/v1beta1/federatedslackreceiver_types.go deleted file mode 100644 index 7ef753fb6..000000000 --- a/pkg/apis/types/v1beta1/federatedslackreceiver_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedSlackReceiver = "federatedslackreceivers" - ResourceSingularFederatedSlackReceiver = "federatedslackreceiver" - FederatedSlackReceiverKind = "FederatedSlackReceiver" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedSlackReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedSlackReceiverSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedSlackReceiverSpec struct { - Template SlackReceiverTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type SlackReceiverTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.SlackReceiverSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedSlackConfigList contains a list of federatedslackconfiglists -type FederatedSlackReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedSlackReceiver `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go b/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go deleted file mode 100644 index d2408a195..000000000 --- a/pkg/apis/types/v1beta1/federatedwebhookconfig_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedWebhookConfig = "federatedwebhookconfigs" - ResourceSingularFederatedWebhookConfig = "federatedwebhookconfig" - FederatedWebhookConfigKind = "FederatedWebhookConfig" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedWebhookConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedWebhookConfigSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedWebhookConfigSpec struct { - Template WebhookConfigTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type WebhookConfigTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.WebhookConfigSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedWebhookConfigList contains a list of federatedwebhookconfiglists -type FederatedWebhookConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedWebhookConfig `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go b/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go deleted file mode 100644 index 8e07f76f6..000000000 --- a/pkg/apis/types/v1beta1/federatedwebhookreceiver_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedWebhookReceiver = "federatedwebhookreceivers" - ResourceSingularFederatedWebhookReceiver = "federatedwebhookreceiver" - FederatedWebhookReceiverKind = "FederatedWebhookReceiver" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedWebhookReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedWebhookReceiverSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedWebhookReceiverSpec struct { - Template WebhookReceiverTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type WebhookReceiverTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.WebhookReceiverSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedWebhookConfigList contains a list of federatedwebhookconfiglists -type FederatedWebhookReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedWebhookReceiver `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go b/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go deleted file mode 100644 index 32cfe63a8..000000000 --- a/pkg/apis/types/v1beta1/federatedwechatreceiver_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -const ( - ResourcePluralFederatedWechatReceiver = "federatedwechatreceivers" - ResourceSingularFederatedWechatReceiver = "federatedwechatreceiver" - FederatedWechatReceiverKind = "FederatedWechatReceiver" -) - -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:openapi-gen=true -// +kubebuilder:resource:scope=Cluster -// +kubebuilder:subresource:status -type FederatedWechatReceiver struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec FederatedWechatReceiverSpec `json:"spec"` - - Status *GenericFederatedStatus `json:"status,omitempty"` -} - -type FederatedWechatReceiverSpec struct { - Template WechatReceiverTemplate `json:"template"` - Placement GenericPlacementFields `json:"placement"` - Overrides []GenericOverrideItem `json:"overrides,omitempty"` -} - -type WechatReceiverTemplate struct { - // +kubebuilder:pruning:PreserveUnknownFields - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec v2alpha1.WechatReceiverSpec `json:"spec,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// FederatedWechatConfigList contains a list of federatedwechatconfiglists -type FederatedWechatReceiverList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []FederatedWechatReceiver `json:"items"` -} diff --git a/pkg/apis/types/v1beta1/register.go b/pkg/apis/types/v1beta1/register.go index d4c83082d..2016a5146 100644 --- a/pkg/apis/types/v1beta1/register.go +++ b/pkg/apis/types/v1beta1/register.go @@ -56,20 +56,16 @@ func init() { &FederatedConfigMapList{}, &FederatedDeployment{}, &FederatedDeploymentList{}, - &FederatedDingTalkConfig{}, - &FederatedDingTalkConfigList{}, - &FederatedDingTalkReceiver{}, - &FederatedDingTalkReceiverList{}, - &FederatedEmailConfig{}, - &FederatedEmailConfigList{}, - &FederatedEmailReceiver{}, - &FederatedEmailReceiverList{}, &FederatedIngress{}, &FederatedIngressList{}, &FederatedLimitRange{}, &FederatedLimitRangeList{}, &FederatedNamespace{}, &FederatedNamespaceList{}, + &FederatedNotificationConfig{}, + &FederatedNotificationConfigList{}, + &FederatedNotificationReceiver{}, + &FederatedNotificationReceiverList{}, &FederatedPersistentVolumeClaim{}, &FederatedPersistentVolumeClaimList{}, &FederatedResourceQuota{}, @@ -78,24 +74,12 @@ func init() { &FederatedSecretList{}, &FederatedService{}, &FederatedServiceList{}, - &FederatedSlackConfig{}, - &FederatedSlackConfigList{}, - &FederatedSlackReceiver{}, - &FederatedSlackReceiverList{}, &FederatedStatefulSet{}, &FederatedStatefulSetList{}, &FederatedUser{}, &FederatedUserList{}, &FederatedGroup{}, &FederatedGroupList{}, - &FederatedWebhookConfig{}, - &FederatedWebhookConfigList{}, - &FederatedWebhookReceiver{}, - &FederatedWebhookReceiverList{}, - &FederatedWechatConfig{}, - &FederatedWechatConfigList{}, - &FederatedWechatReceiver{}, - &FederatedWechatReceiverList{}, &FederatedWorkspace{}, &FederatedWorkspaceList{}, &FederatedWorkspaceRole{}, diff --git a/pkg/apis/types/v1beta1/zz_generated.deepcopy.go b/pkg/apis/types/v1beta1/zz_generated.deepcopy.go index 88115f6e1..1309ebf13 100644 --- a/pkg/apis/types/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/types/v1beta1/zz_generated.deepcopy.go @@ -159,78 +159,6 @@ func (in *DeploymentTemplate) DeepCopy() *DeploymentTemplate { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkConfigTemplate) DeepCopyInto(out *DingTalkConfigTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkConfigTemplate. -func (in *DingTalkConfigTemplate) DeepCopy() *DingTalkConfigTemplate { - if in == nil { - return nil - } - out := new(DingTalkConfigTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DingTalkReceiverTemplate) DeepCopyInto(out *DingTalkReceiverTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DingTalkReceiverTemplate. -func (in *DingTalkReceiverTemplate) DeepCopy() *DingTalkReceiverTemplate { - if in == nil { - return nil - } - out := new(DingTalkReceiverTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailConfigTemplate) DeepCopyInto(out *EmailConfigTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailConfigTemplate. -func (in *EmailConfigTemplate) DeepCopy() *EmailConfigTemplate { - if in == nil { - return nil - } - out := new(EmailConfigTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EmailReceiverTemplate) DeepCopyInto(out *EmailReceiverTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmailReceiverTemplate. -func (in *EmailReceiverTemplate) DeepCopy() *EmailReceiverTemplate { - if in == nil { - return nil - } - out := new(EmailReceiverTemplate) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedApplication) DeepCopyInto(out *FederatedApplication) { *out = *in @@ -666,354 +594,6 @@ func (in *FederatedDeploymentSpec) DeepCopy() *FederatedDeploymentSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedDingTalkConfig) DeepCopyInto(out *FederatedDingTalkConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkConfig. -func (in *FederatedDingTalkConfig) DeepCopy() *FederatedDingTalkConfig { - if in == nil { - return nil - } - out := new(FederatedDingTalkConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedDingTalkConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedDingTalkConfigList) DeepCopyInto(out *FederatedDingTalkConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedDingTalkConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkConfigList. -func (in *FederatedDingTalkConfigList) DeepCopy() *FederatedDingTalkConfigList { - if in == nil { - return nil - } - out := new(FederatedDingTalkConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedDingTalkConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedDingTalkConfigSpec) DeepCopyInto(out *FederatedDingTalkConfigSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkConfigSpec. -func (in *FederatedDingTalkConfigSpec) DeepCopy() *FederatedDingTalkConfigSpec { - if in == nil { - return nil - } - out := new(FederatedDingTalkConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedDingTalkReceiver) DeepCopyInto(out *FederatedDingTalkReceiver) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkReceiver. -func (in *FederatedDingTalkReceiver) DeepCopy() *FederatedDingTalkReceiver { - if in == nil { - return nil - } - out := new(FederatedDingTalkReceiver) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedDingTalkReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedDingTalkReceiverList) DeepCopyInto(out *FederatedDingTalkReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedDingTalkReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkReceiverList. -func (in *FederatedDingTalkReceiverList) DeepCopy() *FederatedDingTalkReceiverList { - if in == nil { - return nil - } - out := new(FederatedDingTalkReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedDingTalkReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedDingTalkReceiverSpec) DeepCopyInto(out *FederatedDingTalkReceiverSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedDingTalkReceiverSpec. -func (in *FederatedDingTalkReceiverSpec) DeepCopy() *FederatedDingTalkReceiverSpec { - if in == nil { - return nil - } - out := new(FederatedDingTalkReceiverSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedEmailConfig) DeepCopyInto(out *FederatedEmailConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailConfig. -func (in *FederatedEmailConfig) DeepCopy() *FederatedEmailConfig { - if in == nil { - return nil - } - out := new(FederatedEmailConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedEmailConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedEmailConfigList) DeepCopyInto(out *FederatedEmailConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedEmailConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailConfigList. -func (in *FederatedEmailConfigList) DeepCopy() *FederatedEmailConfigList { - if in == nil { - return nil - } - out := new(FederatedEmailConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedEmailConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedEmailConfigSpec) DeepCopyInto(out *FederatedEmailConfigSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailConfigSpec. -func (in *FederatedEmailConfigSpec) DeepCopy() *FederatedEmailConfigSpec { - if in == nil { - return nil - } - out := new(FederatedEmailConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedEmailReceiver) DeepCopyInto(out *FederatedEmailReceiver) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailReceiver. -func (in *FederatedEmailReceiver) DeepCopy() *FederatedEmailReceiver { - if in == nil { - return nil - } - out := new(FederatedEmailReceiver) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedEmailReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedEmailReceiverList) DeepCopyInto(out *FederatedEmailReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedEmailReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailReceiverList. -func (in *FederatedEmailReceiverList) DeepCopy() *FederatedEmailReceiverList { - if in == nil { - return nil - } - out := new(FederatedEmailReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedEmailReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedEmailReceiverSpec) DeepCopyInto(out *FederatedEmailReceiverSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedEmailReceiverSpec. -func (in *FederatedEmailReceiverSpec) DeepCopy() *FederatedEmailReceiverSpec { - if in == nil { - return nil - } - out := new(FederatedEmailReceiverSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedGroup) DeepCopyInto(out *FederatedGroup) { *out = *in @@ -1550,6 +1130,186 @@ func (in *FederatedNamespaceSpec) DeepCopy() *FederatedNamespaceSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedNotificationConfig) DeepCopyInto(out *FederatedNotificationConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationConfig. +func (in *FederatedNotificationConfig) DeepCopy() *FederatedNotificationConfig { + if in == nil { + return nil + } + out := new(FederatedNotificationConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedNotificationConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedNotificationConfigList) DeepCopyInto(out *FederatedNotificationConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedNotificationConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationConfigList. +func (in *FederatedNotificationConfigList) DeepCopy() *FederatedNotificationConfigList { + if in == nil { + return nil + } + out := new(FederatedNotificationConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedNotificationConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedNotificationConfigSpec) DeepCopyInto(out *FederatedNotificationConfigSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationConfigSpec. +func (in *FederatedNotificationConfigSpec) DeepCopy() *FederatedNotificationConfigSpec { + if in == nil { + return nil + } + out := new(FederatedNotificationConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedNotificationReceiver) DeepCopyInto(out *FederatedNotificationReceiver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(GenericFederatedStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationReceiver. +func (in *FederatedNotificationReceiver) DeepCopy() *FederatedNotificationReceiver { + if in == nil { + return nil + } + out := new(FederatedNotificationReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedNotificationReceiver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedNotificationReceiverList) DeepCopyInto(out *FederatedNotificationReceiverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FederatedNotificationReceiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationReceiverList. +func (in *FederatedNotificationReceiverList) DeepCopy() *FederatedNotificationReceiverList { + if in == nil { + return nil + } + out := new(FederatedNotificationReceiverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FederatedNotificationReceiverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FederatedNotificationReceiverSpec) DeepCopyInto(out *FederatedNotificationReceiverSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + in.Placement.DeepCopyInto(&out.Placement) + if in.Overrides != nil { + in, out := &in.Overrides, &out.Overrides + *out = make([]GenericOverrideItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationReceiverSpec. +func (in *FederatedNotificationReceiverSpec) DeepCopy() *FederatedNotificationReceiverSpec { + if in == nil { + return nil + } + out := new(FederatedNotificationReceiverSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedPersistentVolumeClaim) DeepCopyInto(out *FederatedPersistentVolumeClaim) { *out = *in @@ -1594,7 +1354,6 @@ func (in *FederatedPersistentVolumeClaimList) DeepCopyInto(out *FederatedPersist (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedPersistentVolumeClaimList. @@ -1774,6 +1533,7 @@ func (in *FederatedSecretList) DeepCopyInto(out *FederatedSecretList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSecretList. @@ -1909,185 +1669,6 @@ func (in *FederatedServiceSpec) DeepCopy() *FederatedServiceSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedSlackConfig) DeepCopyInto(out *FederatedSlackConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackConfig. -func (in *FederatedSlackConfig) DeepCopy() *FederatedSlackConfig { - if in == nil { - return nil - } - out := new(FederatedSlackConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedSlackConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedSlackConfigList) DeepCopyInto(out *FederatedSlackConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedSlackConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackConfigList. -func (in *FederatedSlackConfigList) DeepCopy() *FederatedSlackConfigList { - if in == nil { - return nil - } - out := new(FederatedSlackConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedSlackConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedSlackConfigSpec) DeepCopyInto(out *FederatedSlackConfigSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackConfigSpec. -func (in *FederatedSlackConfigSpec) DeepCopy() *FederatedSlackConfigSpec { - if in == nil { - return nil - } - out := new(FederatedSlackConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedSlackReceiver) DeepCopyInto(out *FederatedSlackReceiver) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackReceiver. -func (in *FederatedSlackReceiver) DeepCopy() *FederatedSlackReceiver { - if in == nil { - return nil - } - out := new(FederatedSlackReceiver) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedSlackReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedSlackReceiverList) DeepCopyInto(out *FederatedSlackReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedSlackReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackReceiverList. -func (in *FederatedSlackReceiverList) DeepCopy() *FederatedSlackReceiverList { - if in == nil { - return nil - } - out := new(FederatedSlackReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedSlackReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedSlackReceiverSpec) DeepCopyInto(out *FederatedSlackReceiverSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedSlackReceiverSpec. -func (in *FederatedSlackReceiverSpec) DeepCopy() *FederatedSlackReceiverSpec { - if in == nil { - return nil - } - out := new(FederatedSlackReceiverSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedStatefulSet) DeepCopyInto(out *FederatedStatefulSet) { *out = *in @@ -2099,6 +1680,7 @@ func (in *FederatedStatefulSet) DeepCopyInto(out *FederatedStatefulSet) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedStatefulSet. @@ -2131,6 +1713,7 @@ func (in *FederatedStatefulSetList) DeepCopyInto(out *FederatedStatefulSetList) (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedStatefulSetList. @@ -2163,6 +1746,7 @@ func (in *FederatedStatefulSetSpec) DeepCopyInto(out *FederatedStatefulSetSpec) (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedStatefulSetSpec. @@ -2186,6 +1770,7 @@ func (in *FederatedUser) DeepCopyInto(out *FederatedUser) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedUser. @@ -2218,6 +1803,7 @@ func (in *FederatedUserList) DeepCopyInto(out *FederatedUserList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedUserList. @@ -2250,6 +1836,7 @@ func (in *FederatedUserSpec) DeepCopyInto(out *FederatedUserSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedUserSpec. @@ -2262,354 +1849,6 @@ func (in *FederatedUserSpec) DeepCopy() *FederatedUserSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWebhookConfig) DeepCopyInto(out *FederatedWebhookConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookConfig. -func (in *FederatedWebhookConfig) DeepCopy() *FederatedWebhookConfig { - if in == nil { - return nil - } - out := new(FederatedWebhookConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWebhookConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWebhookConfigList) DeepCopyInto(out *FederatedWebhookConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedWebhookConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookConfigList. -func (in *FederatedWebhookConfigList) DeepCopy() *FederatedWebhookConfigList { - if in == nil { - return nil - } - out := new(FederatedWebhookConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWebhookConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWebhookConfigSpec) DeepCopyInto(out *FederatedWebhookConfigSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookConfigSpec. -func (in *FederatedWebhookConfigSpec) DeepCopy() *FederatedWebhookConfigSpec { - if in == nil { - return nil - } - out := new(FederatedWebhookConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWebhookReceiver) DeepCopyInto(out *FederatedWebhookReceiver) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookReceiver. -func (in *FederatedWebhookReceiver) DeepCopy() *FederatedWebhookReceiver { - if in == nil { - return nil - } - out := new(FederatedWebhookReceiver) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWebhookReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWebhookReceiverList) DeepCopyInto(out *FederatedWebhookReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedWebhookReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookReceiverList. -func (in *FederatedWebhookReceiverList) DeepCopy() *FederatedWebhookReceiverList { - if in == nil { - return nil - } - out := new(FederatedWebhookReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWebhookReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWebhookReceiverSpec) DeepCopyInto(out *FederatedWebhookReceiverSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWebhookReceiverSpec. -func (in *FederatedWebhookReceiverSpec) DeepCopy() *FederatedWebhookReceiverSpec { - if in == nil { - return nil - } - out := new(FederatedWebhookReceiverSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWechatConfig) DeepCopyInto(out *FederatedWechatConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatConfig. -func (in *FederatedWechatConfig) DeepCopy() *FederatedWechatConfig { - if in == nil { - return nil - } - out := new(FederatedWechatConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWechatConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWechatConfigList) DeepCopyInto(out *FederatedWechatConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedWechatConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatConfigList. -func (in *FederatedWechatConfigList) DeepCopy() *FederatedWechatConfigList { - if in == nil { - return nil - } - out := new(FederatedWechatConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWechatConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWechatConfigSpec) DeepCopyInto(out *FederatedWechatConfigSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatConfigSpec. -func (in *FederatedWechatConfigSpec) DeepCopy() *FederatedWechatConfigSpec { - if in == nil { - return nil - } - out := new(FederatedWechatConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWechatReceiver) DeepCopyInto(out *FederatedWechatReceiver) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - *out = new(GenericFederatedStatus) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatReceiver. -func (in *FederatedWechatReceiver) DeepCopy() *FederatedWechatReceiver { - if in == nil { - return nil - } - out := new(FederatedWechatReceiver) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWechatReceiver) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWechatReceiverList) DeepCopyInto(out *FederatedWechatReceiverList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]FederatedWechatReceiver, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatReceiverList. -func (in *FederatedWechatReceiverList) DeepCopy() *FederatedWechatReceiverList { - if in == nil { - return nil - } - out := new(FederatedWechatReceiverList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FederatedWechatReceiverList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FederatedWechatReceiverSpec) DeepCopyInto(out *FederatedWechatReceiverSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - in.Placement.DeepCopyInto(&out.Placement) - if in.Overrides != nil { - in, out := &in.Overrides, &out.Overrides - *out = make([]GenericOverrideItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWechatReceiverSpec. -func (in *FederatedWechatReceiverSpec) DeepCopy() *FederatedWechatReceiverSpec { - if in == nil { - return nil - } - out := new(FederatedWechatReceiverSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FederatedWorkspace) DeepCopyInto(out *FederatedWorkspace) { *out = *in @@ -2621,6 +1860,7 @@ func (in *FederatedWorkspace) DeepCopyInto(out *FederatedWorkspace) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspace. @@ -2653,6 +1893,7 @@ func (in *FederatedWorkspaceList) DeepCopyInto(out *FederatedWorkspaceList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceList. @@ -2684,6 +1925,7 @@ func (in *FederatedWorkspaceRole) DeepCopyInto(out *FederatedWorkspaceRole) { *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceRole. @@ -2715,6 +1957,7 @@ func (in *FederatedWorkspaceRoleBinding) DeepCopyInto(out *FederatedWorkspaceRol *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceRoleBinding. @@ -2747,6 +1990,7 @@ func (in *FederatedWorkspaceRoleBindingList) DeepCopyInto(out *FederatedWorkspac (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceRoleBindingList. @@ -2779,6 +2023,7 @@ func (in *FederatedWorkspaceRoleBindingSpec) DeepCopyInto(out *FederatedWorkspac (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceRoleBindingSpec. @@ -2803,6 +2048,7 @@ func (in *FederatedWorkspaceRoleList) DeepCopyInto(out *FederatedWorkspaceRoleLi (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceRoleList. @@ -2835,6 +2081,7 @@ func (in *FederatedWorkspaceRoleSpec) DeepCopyInto(out *FederatedWorkspaceRoleSp (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceRoleSpec. @@ -2859,6 +2106,7 @@ func (in *FederatedWorkspaceSpec) DeepCopyInto(out *FederatedWorkspaceSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedWorkspaceSpec. @@ -2874,6 +2122,7 @@ func (in *FederatedWorkspaceSpec) DeepCopy() *FederatedWorkspaceSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GenericClusterReference) DeepCopyInto(out *GenericClusterReference) { *out = *in + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericClusterReference. @@ -2889,6 +2138,7 @@ func (in *GenericClusterReference) DeepCopy() *GenericClusterReference { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GenericClusterStatus) DeepCopyInto(out *GenericClusterStatus) { *out = *in + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericClusterStatus. @@ -2904,6 +2154,7 @@ func (in *GenericClusterStatus) DeepCopy() *GenericClusterStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GenericCondition) DeepCopyInto(out *GenericCondition) { *out = *in + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericCondition. @@ -2926,6 +2177,7 @@ func (in *GenericFederatedResource) DeepCopyInto(out *GenericFederatedResource) *out = new(GenericFederatedStatus) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericFederatedResource. @@ -2957,6 +2209,7 @@ func (in *GenericFederatedStatus) DeepCopyInto(out *GenericFederatedStatus) { *out = make([]GenericClusterStatus, len(*in)) copy(*out, *in) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericFederatedStatus. @@ -2979,6 +2232,7 @@ func (in *GenericOverride) DeepCopyInto(out *GenericOverride) { *out = new(GenericOverrideSpec) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericOverride. @@ -3001,6 +2255,7 @@ func (in *GenericOverrideItem) DeepCopyInto(out *GenericOverrideItem) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericOverrideItem. @@ -3023,6 +2278,7 @@ func (in *GenericOverrideSpec) DeepCopyInto(out *GenericOverrideSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericOverrideSpec. @@ -3041,6 +2297,7 @@ func (in *GenericPlacement) DeepCopyInto(out *GenericPlacement) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericPlacement. @@ -3066,6 +2323,7 @@ func (in *GenericPlacementFields) DeepCopyInto(out *GenericPlacementFields) { *out = new(metav1.LabelSelector) (*in).DeepCopyInto(*out) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericPlacementFields. @@ -3082,6 +2340,7 @@ func (in *GenericPlacementFields) DeepCopy() *GenericPlacementFields { func (in *GenericPlacementSpec) DeepCopyInto(out *GenericPlacementSpec) { *out = *in in.Placement.DeepCopyInto(&out.Placement) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericPlacementSpec. @@ -3104,6 +2363,7 @@ func (in *GroupBindingTemplate) DeepCopyInto(out *GroupBindingTemplate) { *out = make([]string, len(*in)) copy(*out, *in) } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupBindingTemplate. @@ -3121,6 +2381,7 @@ func (in *GroupTemplate) DeepCopyInto(out *GroupTemplate) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupTemplate. @@ -3137,6 +2398,7 @@ func (in *GroupTemplate) DeepCopy() *GroupTemplate { func (in *IngressTemplate) DeepCopyInto(out *IngressTemplate) { *out = *in in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressTemplate. @@ -3153,6 +2415,7 @@ func (in *IngressTemplate) DeepCopy() *IngressTemplate { func (in *JobTemplate) DeepCopyInto(out *JobTemplate) { *out = *in in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobTemplate. @@ -3169,6 +2432,7 @@ func (in *JobTemplate) DeepCopy() *JobTemplate { func (in *LimitRangeTemplate) DeepCopyInto(out *LimitRangeTemplate) { *out = *in in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LimitRangeTemplate. @@ -3185,6 +2449,7 @@ func (in *LimitRangeTemplate) DeepCopy() *LimitRangeTemplate { func (in *NamespaceTemplate) DeepCopyInto(out *NamespaceTemplate) { *out = *in in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceTemplate. @@ -3197,12 +2462,49 @@ func (in *NamespaceTemplate) DeepCopy() *NamespaceTemplate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationConfigTemplate) DeepCopyInto(out *NotificationConfigTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationConfigTemplate. +func (in *NotificationConfigTemplate) DeepCopy() *NotificationConfigTemplate { + if in == nil { + return nil + } + out := new(NotificationConfigTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationReceiverTemplate) DeepCopyInto(out *NotificationReceiverTemplate) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationReceiverTemplate. +func (in *NotificationReceiverTemplate) DeepCopy() *NotificationReceiverTemplate { + if in == nil { + return nil + } + out := new(NotificationReceiverTemplate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PersistentVolumeClaimTemplate) DeepCopyInto(out *PersistentVolumeClaimTemplate) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeClaimTemplate. @@ -3219,6 +2521,7 @@ func (in *PersistentVolumeClaimTemplate) DeepCopy() *PersistentVolumeClaimTempla func (in *ResourceQuotaTemplate) DeepCopyInto(out *ResourceQuotaTemplate) { *out = *in in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceQuotaTemplate. @@ -3256,6 +2559,7 @@ func (in *SecretTemplate) DeepCopyInto(out *SecretTemplate) { (*out)[key] = val } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretTemplate. @@ -3274,6 +2578,7 @@ func (in *ServiceTemplate) DeepCopyInto(out *ServiceTemplate) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTemplate. @@ -3286,48 +2591,13 @@ func (in *ServiceTemplate) DeepCopy() *ServiceTemplate { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackConfigTemplate) DeepCopyInto(out *SlackConfigTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfigTemplate. -func (in *SlackConfigTemplate) DeepCopy() *SlackConfigTemplate { - if in == nil { - return nil - } - out := new(SlackConfigTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SlackReceiverTemplate) DeepCopyInto(out *SlackReceiverTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackReceiverTemplate. -func (in *SlackReceiverTemplate) DeepCopy() *SlackReceiverTemplate { - if in == nil { - return nil - } - out := new(SlackReceiverTemplate) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StatefulSetTemplate) DeepCopyInto(out *StatefulSetTemplate) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetTemplate. @@ -3344,6 +2614,7 @@ func (in *StatefulSetTemplate) DeepCopy() *StatefulSetTemplate { func (in *UserTemplate) DeepCopyInto(out *UserTemplate) { *out = *in in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserTemplate. @@ -3356,78 +2627,6 @@ func (in *UserTemplate) DeepCopy() *UserTemplate { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookConfigTemplate) DeepCopyInto(out *WebhookConfigTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookConfigTemplate. -func (in *WebhookConfigTemplate) DeepCopy() *WebhookConfigTemplate { - if in == nil { - return nil - } - out := new(WebhookConfigTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookReceiverTemplate) DeepCopyInto(out *WebhookReceiverTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookReceiverTemplate. -func (in *WebhookReceiverTemplate) DeepCopy() *WebhookReceiverTemplate { - if in == nil { - return nil - } - out := new(WebhookReceiverTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatConfigTemplate) DeepCopyInto(out *WechatConfigTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatConfigTemplate. -func (in *WechatConfigTemplate) DeepCopy() *WechatConfigTemplate { - if in == nil { - return nil - } - out := new(WechatConfigTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WechatReceiverTemplate) DeepCopyInto(out *WechatReceiverTemplate) { - *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WechatReceiverTemplate. -func (in *WechatReceiverTemplate) DeepCopy() *WechatReceiverTemplate { - if in == nil { - return nil - } - out := new(WechatReceiverTemplate) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkspaceRoleBindingTemplate) DeepCopyInto(out *WorkspaceRoleBindingTemplate) { *out = *in @@ -3438,6 +2637,7 @@ func (in *WorkspaceRoleBindingTemplate) DeepCopyInto(out *WorkspaceRoleBindingTe copy(*out, *in) } out.RoleRef = in.RoleRef + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceRoleBindingTemplate. @@ -3461,6 +2661,7 @@ func (in *WorkspaceRoleTemplate) DeepCopyInto(out *WorkspaceRoleTemplate) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceRoleTemplate. @@ -3478,6 +2679,7 @@ func (in *WorkspaceTemplate) DeepCopyInto(out *WorkspaceTemplate) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) + return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceTemplate. diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 1fbbb06dd..625e160f8 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -20,6 +20,7 @@ import ( "bytes" "context" "fmt" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" "net/http" rt "runtime" "time" @@ -37,7 +38,7 @@ import ( "k8s.io/klog" clusterv1alpha1 "kubesphere.io/kubesphere/pkg/apis/cluster/v1alpha1" iamv1alpha2 "kubesphere.io/kubesphere/pkg/apis/iam/v1alpha2" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" 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 +70,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" - notificationkapisv2alpha1 "kubesphere.io/kubesphere/pkg/kapis/notification/v2alpha1" + notificationkapisv2beta1 "kubesphere.io/kubesphere/pkg/kapis/notification/v2beta1" "kubesphere.io/kubesphere/pkg/kapis/oauth" openpitrixv1 "kubesphere.io/kubesphere/pkg/kapis/openpitrix/v1" operationsv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/operations/v1alpha2" @@ -272,7 +273,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(notificationkapisv2alpha1.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), + urlruntime.Must(notificationkapisv2beta1.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), s.KubernetesClient.KubeSphere())) } @@ -314,16 +315,8 @@ func (s *APIServer) buildHandlerChain(stopCh <-chan struct{}) { tenantv1alpha2.Resource(clusterv1alpha1.ResourcesPluralCluster), clusterv1alpha1.Resource(clusterv1alpha1.ResourcesPluralCluster), resourcev1alpha3.Resource(clusterv1alpha1.ResourcesPluralCluster), - 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), + notificationv2beta1.Resource(v2beta1.ResourcesPluralConfig), + notificationv2beta1.Resource(v2beta1.ResourcesPluralReceiver), }, } @@ -457,16 +450,8 @@ 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: 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}, + {Group: "notification.kubesphere.io", Version: "v2beta1", Resource: v2beta1.ResourcesPluralConfig}, + {Group: "notification.kubesphere.io", Version: "v2beta1", Resource: v2beta1.ResourcesPluralReceiver}, } devopsGVRs := []schema.GroupVersionResource{ diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 14401b8d0..f70e1ce8d 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -31,7 +31,7 @@ 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" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2beta1" 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" @@ -49,7 +49,7 @@ type Interface interface { DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface IamV1alpha2() iamv1alpha2.IamV1alpha2Interface NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface - NotificationV2alpha1() notificationv2alpha1.NotificationV2alpha1Interface + NotificationV2beta1() notificationv2beta1.NotificationV2beta1Interface QuotaV1alpha2() quotav1alpha2.QuotaV1alpha2Interface ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface @@ -69,7 +69,7 @@ type Clientset struct { devopsV1alpha3 *devopsv1alpha3.DevopsV1alpha3Client iamV1alpha2 *iamv1alpha2.IamV1alpha2Client networkV1alpha1 *networkv1alpha1.NetworkV1alpha1Client - notificationV2alpha1 *notificationv2alpha1.NotificationV2alpha1Client + notificationV2beta1 *notificationv2beta1.NotificationV2beta1Client quotaV1alpha2 *quotav1alpha2.QuotaV1alpha2Client servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client storageV1alpha1 *storagev1alpha1.StorageV1alpha1Client @@ -113,9 +113,9 @@ func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface { return c.networkV1alpha1 } -// NotificationV2alpha1 retrieves the NotificationV2alpha1Client -func (c *Clientset) NotificationV2alpha1() notificationv2alpha1.NotificationV2alpha1Interface { - return c.notificationV2alpha1 +// NotificationV2beta1 retrieves the NotificationV2beta1Client +func (c *Clientset) NotificationV2beta1() notificationv2beta1.NotificationV2beta1Interface { + return c.notificationV2beta1 } // QuotaV1alpha2 retrieves the QuotaV1alpha2Client @@ -197,7 +197,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.notificationV2alpha1, err = notificationv2alpha1.NewForConfig(&configShallowCopy) + cs.notificationV2beta1, err = notificationv2beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -244,7 +244,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.devopsV1alpha3 = devopsv1alpha3.NewForConfigOrDie(c) cs.iamV1alpha2 = iamv1alpha2.NewForConfigOrDie(c) cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c) - cs.notificationV2alpha1 = notificationv2alpha1.NewForConfigOrDie(c) + cs.notificationV2beta1 = notificationv2beta1.NewForConfigOrDie(c) cs.quotaV1alpha2 = quotav1alpha2.NewForConfigOrDie(c) cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c) cs.storageV1alpha1 = storagev1alpha1.NewForConfigOrDie(c) @@ -266,7 +266,7 @@ func New(c rest.Interface) *Clientset { cs.devopsV1alpha3 = devopsv1alpha3.New(c) cs.iamV1alpha2 = iamv1alpha2.New(c) cs.networkV1alpha1 = networkv1alpha1.New(c) - cs.notificationV2alpha1 = notificationv2alpha1.New(c) + cs.notificationV2beta1 = notificationv2beta1.New(c) cs.quotaV1alpha2 = quotav1alpha2.New(c) cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c) cs.storageV1alpha1 = storagev1alpha1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index fe3db3eea..09f5eb0bc 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -39,8 +39,8 @@ 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" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1" - fakenotificationv2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2beta1" + fakenotificationv2beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2beta1/fake" 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" @@ -137,9 +137,9 @@ func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface { return &fakenetworkv1alpha1.FakeNetworkV1alpha1{Fake: &c.Fake} } -// NotificationV2alpha1 retrieves the NotificationV2alpha1Client -func (c *Clientset) NotificationV2alpha1() notificationv2alpha1.NotificationV2alpha1Interface { - return &fakenotificationv2alpha1.FakeNotificationV2alpha1{Fake: &c.Fake} +// NotificationV2beta1 retrieves the NotificationV2beta1Client +func (c *Clientset) NotificationV2beta1() notificationv2beta1.NotificationV2beta1Interface { + return &fakenotificationv2beta1.FakeNotificationV2beta1{Fake: &c.Fake} } // QuotaV1alpha2 retrieves the QuotaV1alpha2Client diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 02793faa8..a4d2b972c 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -31,7 +31,7 @@ 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" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" @@ -51,7 +51,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, - notificationv2alpha1.AddToScheme, + notificationv2beta1.AddToScheme, quotav1alpha2.AddToScheme, servicemeshv1alpha2.AddToScheme, storagev1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 8c6a3241b..9813366c7 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -31,7 +31,7 @@ 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" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" @@ -51,7 +51,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ devopsv1alpha3.AddToScheme, iamv1alpha2.AddToScheme, networkv1alpha1.AddToScheme, - notificationv2alpha1.AddToScheme, + notificationv2beta1.AddToScheme, quotav1alpha2.AddToScheme, servicemeshv1alpha2.AddToScheme, storagev1alpha1.AddToScheme, diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkconfig.go deleted file mode 100644 index 35e116922..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkconfig.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// DingTalkConfigsGetter has a method to return a DingTalkConfigInterface. -// A group's client should implement this interface. -type DingTalkConfigsGetter interface { - DingTalkConfigs() DingTalkConfigInterface -} - -// DingTalkConfigInterface has methods to work with DingTalkConfig resources. -type DingTalkConfigInterface interface { - Create(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.CreateOptions) (*v2alpha1.DingTalkConfig, error) - Update(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (*v2alpha1.DingTalkConfig, error) - UpdateStatus(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (*v2alpha1.DingTalkConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.DingTalkConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.DingTalkConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkConfig, err error) - DingTalkConfigExpansion -} - -// dingTalkConfigs implements DingTalkConfigInterface -type dingTalkConfigs struct { - client rest.Interface -} - -// newDingTalkConfigs returns a DingTalkConfigs -func newDingTalkConfigs(c *NotificationV2alpha1Client) *dingTalkConfigs { - return &dingTalkConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the dingTalkConfig, and returns the corresponding dingTalkConfig object, and an error if there is any. -func (c *dingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkConfig, err error) { - result = &v2alpha1.DingTalkConfig{} - err = c.client.Get(). - Resource("dingtalkconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DingTalkConfigs that match those selectors. -func (c *dingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.DingTalkConfigList{} - err = c.client.Get(). - Resource("dingtalkconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested dingTalkConfigs. -func (c *dingTalkConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("dingtalkconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a dingTalkConfig and creates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *dingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.CreateOptions) (result *v2alpha1.DingTalkConfig, err error) { - result = &v2alpha1.DingTalkConfig{} - err = c.client.Post(). - Resource("dingtalkconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dingTalkConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a dingTalkConfig and updates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *dingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (result *v2alpha1.DingTalkConfig, err error) { - result = &v2alpha1.DingTalkConfig{} - err = c.client.Put(). - Resource("dingtalkconfigs"). - Name(dingTalkConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dingTalkConfig). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (result *v2alpha1.DingTalkConfig, err error) { - result = &v2alpha1.DingTalkConfig{} - err = c.client.Put(). - Resource("dingtalkconfigs"). - Name(dingTalkConfig.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dingTalkConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the dingTalkConfig and deletes it. Returns an error if one occurs. -func (c *dingTalkConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("dingtalkconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *dingTalkConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("dingtalkconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched dingTalkConfig. -func (c *dingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkConfig, err error) { - result = &v2alpha1.DingTalkConfig{} - err = c.client.Patch(pt). - Resource("dingtalkconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkreceiver.go deleted file mode 100644 index 2eae8ca23..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/dingtalkreceiver.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// DingTalkReceiversGetter has a method to return a DingTalkReceiverInterface. -// A group's client should implement this interface. -type DingTalkReceiversGetter interface { - DingTalkReceivers() DingTalkReceiverInterface -} - -// DingTalkReceiverInterface has methods to work with DingTalkReceiver resources. -type DingTalkReceiverInterface interface { - Create(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.CreateOptions) (*v2alpha1.DingTalkReceiver, error) - Update(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (*v2alpha1.DingTalkReceiver, error) - UpdateStatus(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (*v2alpha1.DingTalkReceiver, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.DingTalkReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.DingTalkReceiverList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkReceiver, err error) - DingTalkReceiverExpansion -} - -// dingTalkReceivers implements DingTalkReceiverInterface -type dingTalkReceivers struct { - client rest.Interface -} - -// newDingTalkReceivers returns a DingTalkReceivers -func newDingTalkReceivers(c *NotificationV2alpha1Client) *dingTalkReceivers { - return &dingTalkReceivers{ - client: c.RESTClient(), - } -} - -// Get takes name of the dingTalkReceiver, and returns the corresponding dingTalkReceiver object, and an error if there is any. -func (c *dingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkReceiver, err error) { - result = &v2alpha1.DingTalkReceiver{} - err = c.client.Get(). - Resource("dingtalkreceivers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DingTalkReceivers that match those selectors. -func (c *dingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkReceiverList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.DingTalkReceiverList{} - err = c.client.Get(). - Resource("dingtalkreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested dingTalkReceivers. -func (c *dingTalkReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("dingtalkreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a dingTalkReceiver and creates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *dingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.CreateOptions) (result *v2alpha1.DingTalkReceiver, err error) { - result = &v2alpha1.DingTalkReceiver{} - err = c.client.Post(). - Resource("dingtalkreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dingTalkReceiver). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a dingTalkReceiver and updates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *dingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (result *v2alpha1.DingTalkReceiver, err error) { - result = &v2alpha1.DingTalkReceiver{} - err = c.client.Put(). - Resource("dingtalkreceivers"). - Name(dingTalkReceiver.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dingTalkReceiver). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (result *v2alpha1.DingTalkReceiver, err error) { - result = &v2alpha1.DingTalkReceiver{} - err = c.client.Put(). - Resource("dingtalkreceivers"). - Name(dingTalkReceiver.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dingTalkReceiver). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the dingTalkReceiver and deletes it. Returns an error if one occurs. -func (c *dingTalkReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("dingtalkreceivers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *dingTalkReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("dingtalkreceivers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched dingTalkReceiver. -func (c *dingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkReceiver, err error) { - result = &v2alpha1.DingTalkReceiver{} - err = c.client.Patch(pt). - Resource("dingtalkreceivers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailconfig.go deleted file mode 100644 index d1fed1056..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailconfig.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// EmailConfigsGetter has a method to return a EmailConfigInterface. -// A group's client should implement this interface. -type EmailConfigsGetter interface { - EmailConfigs() EmailConfigInterface -} - -// EmailConfigInterface has methods to work with EmailConfig resources. -type EmailConfigInterface interface { - Create(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.CreateOptions) (*v2alpha1.EmailConfig, error) - Update(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (*v2alpha1.EmailConfig, error) - UpdateStatus(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (*v2alpha1.EmailConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.EmailConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.EmailConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailConfig, err error) - EmailConfigExpansion -} - -// emailConfigs implements EmailConfigInterface -type emailConfigs struct { - client rest.Interface -} - -// newEmailConfigs returns a EmailConfigs -func newEmailConfigs(c *NotificationV2alpha1Client) *emailConfigs { - return &emailConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the emailConfig, and returns the corresponding emailConfig object, and an error if there is any. -func (c *emailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailConfig, err error) { - result = &v2alpha1.EmailConfig{} - err = c.client.Get(). - Resource("emailconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EmailConfigs that match those selectors. -func (c *emailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.EmailConfigList{} - err = c.client.Get(). - Resource("emailconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested emailConfigs. -func (c *emailConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("emailconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a emailConfig and creates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *emailConfigs) Create(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.CreateOptions) (result *v2alpha1.EmailConfig, err error) { - result = &v2alpha1.EmailConfig{} - err = c.client.Post(). - Resource("emailconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(emailConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a emailConfig and updates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *emailConfigs) Update(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (result *v2alpha1.EmailConfig, err error) { - result = &v2alpha1.EmailConfig{} - err = c.client.Put(). - Resource("emailconfigs"). - Name(emailConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(emailConfig). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *emailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (result *v2alpha1.EmailConfig, err error) { - result = &v2alpha1.EmailConfig{} - err = c.client.Put(). - Resource("emailconfigs"). - Name(emailConfig.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(emailConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the emailConfig and deletes it. Returns an error if one occurs. -func (c *emailConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("emailconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *emailConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("emailconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched emailConfig. -func (c *emailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailConfig, err error) { - result = &v2alpha1.EmailConfig{} - err = c.client.Patch(pt). - Resource("emailconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailreceiver.go deleted file mode 100644 index 2ea00f10c..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/emailreceiver.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// EmailReceiversGetter has a method to return a EmailReceiverInterface. -// A group's client should implement this interface. -type EmailReceiversGetter interface { - EmailReceivers() EmailReceiverInterface -} - -// EmailReceiverInterface has methods to work with EmailReceiver resources. -type EmailReceiverInterface interface { - Create(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.CreateOptions) (*v2alpha1.EmailReceiver, error) - Update(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (*v2alpha1.EmailReceiver, error) - UpdateStatus(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (*v2alpha1.EmailReceiver, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.EmailReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.EmailReceiverList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailReceiver, err error) - EmailReceiverExpansion -} - -// emailReceivers implements EmailReceiverInterface -type emailReceivers struct { - client rest.Interface -} - -// newEmailReceivers returns a EmailReceivers -func newEmailReceivers(c *NotificationV2alpha1Client) *emailReceivers { - return &emailReceivers{ - client: c.RESTClient(), - } -} - -// Get takes name of the emailReceiver, and returns the corresponding emailReceiver object, and an error if there is any. -func (c *emailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailReceiver, err error) { - result = &v2alpha1.EmailReceiver{} - err = c.client.Get(). - Resource("emailreceivers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EmailReceivers that match those selectors. -func (c *emailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailReceiverList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.EmailReceiverList{} - err = c.client.Get(). - Resource("emailreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested emailReceivers. -func (c *emailReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("emailreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a emailReceiver and creates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *emailReceivers) Create(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.CreateOptions) (result *v2alpha1.EmailReceiver, err error) { - result = &v2alpha1.EmailReceiver{} - err = c.client.Post(). - Resource("emailreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(emailReceiver). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a emailReceiver and updates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *emailReceivers) Update(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (result *v2alpha1.EmailReceiver, err error) { - result = &v2alpha1.EmailReceiver{} - err = c.client.Put(). - Resource("emailreceivers"). - Name(emailReceiver.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(emailReceiver). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *emailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (result *v2alpha1.EmailReceiver, err error) { - result = &v2alpha1.EmailReceiver{} - err = c.client.Put(). - Resource("emailreceivers"). - Name(emailReceiver.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(emailReceiver). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the emailReceiver and deletes it. Returns an error if one occurs. -func (c *emailReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("emailreceivers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *emailReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("emailreceivers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched emailReceiver. -func (c *emailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailReceiver, err error) { - result = &v2alpha1.EmailReceiver{} - err = c.client.Patch(pt). - Resource("emailreceivers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkconfig.go deleted file mode 100644 index 389c64f1b..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkconfig.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeDingTalkConfigs implements DingTalkConfigInterface -type FakeDingTalkConfigs struct { - Fake *FakeNotificationV2alpha1 -} - -var dingtalkconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "dingtalkconfigs"} - -var dingtalkconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "DingTalkConfig"} - -// Get takes name of the dingTalkConfig, and returns the corresponding dingTalkConfig object, and an error if there is any. -func (c *FakeDingTalkConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(dingtalkconfigsResource, name), &v2alpha1.DingTalkConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkConfig), err -} - -// List takes label and field selectors, and returns the list of DingTalkConfigs that match those selectors. -func (c *FakeDingTalkConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(dingtalkconfigsResource, dingtalkconfigsKind, opts), &v2alpha1.DingTalkConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.DingTalkConfigList{ListMeta: obj.(*v2alpha1.DingTalkConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.DingTalkConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested dingTalkConfigs. -func (c *FakeDingTalkConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(dingtalkconfigsResource, opts)) -} - -// Create takes the representation of a dingTalkConfig and creates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *FakeDingTalkConfigs) Create(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.CreateOptions) (result *v2alpha1.DingTalkConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(dingtalkconfigsResource, dingTalkConfig), &v2alpha1.DingTalkConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkConfig), err -} - -// Update takes the representation of a dingTalkConfig and updates it. Returns the server's representation of the dingTalkConfig, and an error, if there is any. -func (c *FakeDingTalkConfigs) Update(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (result *v2alpha1.DingTalkConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(dingtalkconfigsResource, dingTalkConfig), &v2alpha1.DingTalkConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkConfig), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDingTalkConfigs) UpdateStatus(ctx context.Context, dingTalkConfig *v2alpha1.DingTalkConfig, opts v1.UpdateOptions) (*v2alpha1.DingTalkConfig, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(dingtalkconfigsResource, "status", dingTalkConfig), &v2alpha1.DingTalkConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkConfig), err -} - -// Delete takes name of the dingTalkConfig and deletes it. Returns an error if one occurs. -func (c *FakeDingTalkConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(dingtalkconfigsResource, name), &v2alpha1.DingTalkConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeDingTalkConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(dingtalkconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.DingTalkConfigList{}) - return err -} - -// Patch applies the patch and returns the patched dingTalkConfig. -func (c *FakeDingTalkConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(dingtalkconfigsResource, name, pt, data, subresources...), &v2alpha1.DingTalkConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkConfig), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkreceiver.go deleted file mode 100644 index f0d7c3a2d..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_dingtalkreceiver.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeDingTalkReceivers implements DingTalkReceiverInterface -type FakeDingTalkReceivers struct { - Fake *FakeNotificationV2alpha1 -} - -var dingtalkreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "dingtalkreceivers"} - -var dingtalkreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "DingTalkReceiver"} - -// Get takes name of the dingTalkReceiver, and returns the corresponding dingTalkReceiver object, and an error if there is any. -func (c *FakeDingTalkReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.DingTalkReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(dingtalkreceiversResource, name), &v2alpha1.DingTalkReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkReceiver), err -} - -// List takes label and field selectors, and returns the list of DingTalkReceivers that match those selectors. -func (c *FakeDingTalkReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.DingTalkReceiverList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(dingtalkreceiversResource, dingtalkreceiversKind, opts), &v2alpha1.DingTalkReceiverList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.DingTalkReceiverList{ListMeta: obj.(*v2alpha1.DingTalkReceiverList).ListMeta} - for _, item := range obj.(*v2alpha1.DingTalkReceiverList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested dingTalkReceivers. -func (c *FakeDingTalkReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(dingtalkreceiversResource, opts)) -} - -// Create takes the representation of a dingTalkReceiver and creates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *FakeDingTalkReceivers) Create(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.CreateOptions) (result *v2alpha1.DingTalkReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(dingtalkreceiversResource, dingTalkReceiver), &v2alpha1.DingTalkReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkReceiver), err -} - -// Update takes the representation of a dingTalkReceiver and updates it. Returns the server's representation of the dingTalkReceiver, and an error, if there is any. -func (c *FakeDingTalkReceivers) Update(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (result *v2alpha1.DingTalkReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(dingtalkreceiversResource, dingTalkReceiver), &v2alpha1.DingTalkReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkReceiver), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDingTalkReceivers) UpdateStatus(ctx context.Context, dingTalkReceiver *v2alpha1.DingTalkReceiver, opts v1.UpdateOptions) (*v2alpha1.DingTalkReceiver, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(dingtalkreceiversResource, "status", dingTalkReceiver), &v2alpha1.DingTalkReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkReceiver), err -} - -// Delete takes name of the dingTalkReceiver and deletes it. Returns an error if one occurs. -func (c *FakeDingTalkReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(dingtalkreceiversResource, name), &v2alpha1.DingTalkReceiver{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeDingTalkReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(dingtalkreceiversResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.DingTalkReceiverList{}) - return err -} - -// Patch applies the patch and returns the patched dingTalkReceiver. -func (c *FakeDingTalkReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.DingTalkReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(dingtalkreceiversResource, name, pt, data, subresources...), &v2alpha1.DingTalkReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.DingTalkReceiver), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailconfig.go deleted file mode 100644 index c0fd91fb3..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailconfig.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeEmailConfigs implements EmailConfigInterface -type FakeEmailConfigs struct { - Fake *FakeNotificationV2alpha1 -} - -var emailconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "emailconfigs"} - -var emailconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "EmailConfig"} - -// Get takes name of the emailConfig, and returns the corresponding emailConfig object, and an error if there is any. -func (c *FakeEmailConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(emailconfigsResource, name), &v2alpha1.EmailConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailConfig), err -} - -// List takes label and field selectors, and returns the list of EmailConfigs that match those selectors. -func (c *FakeEmailConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(emailconfigsResource, emailconfigsKind, opts), &v2alpha1.EmailConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.EmailConfigList{ListMeta: obj.(*v2alpha1.EmailConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.EmailConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested emailConfigs. -func (c *FakeEmailConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(emailconfigsResource, opts)) -} - -// Create takes the representation of a emailConfig and creates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *FakeEmailConfigs) Create(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.CreateOptions) (result *v2alpha1.EmailConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(emailconfigsResource, emailConfig), &v2alpha1.EmailConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailConfig), err -} - -// Update takes the representation of a emailConfig and updates it. Returns the server's representation of the emailConfig, and an error, if there is any. -func (c *FakeEmailConfigs) Update(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (result *v2alpha1.EmailConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(emailconfigsResource, emailConfig), &v2alpha1.EmailConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailConfig), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeEmailConfigs) UpdateStatus(ctx context.Context, emailConfig *v2alpha1.EmailConfig, opts v1.UpdateOptions) (*v2alpha1.EmailConfig, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(emailconfigsResource, "status", emailConfig), &v2alpha1.EmailConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailConfig), err -} - -// Delete takes name of the emailConfig and deletes it. Returns an error if one occurs. -func (c *FakeEmailConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(emailconfigsResource, name), &v2alpha1.EmailConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEmailConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(emailconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.EmailConfigList{}) - return err -} - -// Patch applies the patch and returns the patched emailConfig. -func (c *FakeEmailConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(emailconfigsResource, name, pt, data, subresources...), &v2alpha1.EmailConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailConfig), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailreceiver.go deleted file mode 100644 index e86ff71a1..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_emailreceiver.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeEmailReceivers implements EmailReceiverInterface -type FakeEmailReceivers struct { - Fake *FakeNotificationV2alpha1 -} - -var emailreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "emailreceivers"} - -var emailreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "EmailReceiver"} - -// Get takes name of the emailReceiver, and returns the corresponding emailReceiver object, and an error if there is any. -func (c *FakeEmailReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.EmailReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(emailreceiversResource, name), &v2alpha1.EmailReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailReceiver), err -} - -// List takes label and field selectors, and returns the list of EmailReceivers that match those selectors. -func (c *FakeEmailReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.EmailReceiverList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(emailreceiversResource, emailreceiversKind, opts), &v2alpha1.EmailReceiverList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.EmailReceiverList{ListMeta: obj.(*v2alpha1.EmailReceiverList).ListMeta} - for _, item := range obj.(*v2alpha1.EmailReceiverList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested emailReceivers. -func (c *FakeEmailReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(emailreceiversResource, opts)) -} - -// Create takes the representation of a emailReceiver and creates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *FakeEmailReceivers) Create(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.CreateOptions) (result *v2alpha1.EmailReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(emailreceiversResource, emailReceiver), &v2alpha1.EmailReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailReceiver), err -} - -// Update takes the representation of a emailReceiver and updates it. Returns the server's representation of the emailReceiver, and an error, if there is any. -func (c *FakeEmailReceivers) Update(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (result *v2alpha1.EmailReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(emailreceiversResource, emailReceiver), &v2alpha1.EmailReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailReceiver), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeEmailReceivers) UpdateStatus(ctx context.Context, emailReceiver *v2alpha1.EmailReceiver, opts v1.UpdateOptions) (*v2alpha1.EmailReceiver, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(emailreceiversResource, "status", emailReceiver), &v2alpha1.EmailReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailReceiver), err -} - -// Delete takes name of the emailReceiver and deletes it. Returns an error if one occurs. -func (c *FakeEmailReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(emailreceiversResource, name), &v2alpha1.EmailReceiver{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEmailReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(emailreceiversResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.EmailReceiverList{}) - return err -} - -// Patch applies the patch and returns the patched emailReceiver. -func (c *FakeEmailReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.EmailReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(emailreceiversResource, name, pt, data, subresources...), &v2alpha1.EmailReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.EmailReceiver), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_notification_client.go deleted file mode 100644 index cbab6a87a..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_notification_client.go +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2alpha1" -) - -type FakeNotificationV2alpha1 struct { - *testing.Fake -} - -func (c *FakeNotificationV2alpha1) DingTalkConfigs() v2alpha1.DingTalkConfigInterface { - return &FakeDingTalkConfigs{c} -} - -func (c *FakeNotificationV2alpha1) DingTalkReceivers() v2alpha1.DingTalkReceiverInterface { - return &FakeDingTalkReceivers{c} -} - -func (c *FakeNotificationV2alpha1) EmailConfigs() v2alpha1.EmailConfigInterface { - return &FakeEmailConfigs{c} -} - -func (c *FakeNotificationV2alpha1) EmailReceivers() v2alpha1.EmailReceiverInterface { - return &FakeEmailReceivers{c} -} - -func (c *FakeNotificationV2alpha1) SlackConfigs() v2alpha1.SlackConfigInterface { - return &FakeSlackConfigs{c} -} - -func (c *FakeNotificationV2alpha1) SlackReceivers() v2alpha1.SlackReceiverInterface { - return &FakeSlackReceivers{c} -} - -func (c *FakeNotificationV2alpha1) WebhookConfigs() v2alpha1.WebhookConfigInterface { - return &FakeWebhookConfigs{c} -} - -func (c *FakeNotificationV2alpha1) WebhookReceivers() v2alpha1.WebhookReceiverInterface { - return &FakeWebhookReceivers{c} -} - -func (c *FakeNotificationV2alpha1) WechatConfigs() v2alpha1.WechatConfigInterface { - return &FakeWechatConfigs{c} -} - -func (c *FakeNotificationV2alpha1) WechatReceivers() v2alpha1.WechatReceiverInterface { - return &FakeWechatReceivers{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeNotificationV2alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackconfig.go deleted file mode 100644 index ebcde2272..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackconfig.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeSlackConfigs implements SlackConfigInterface -type FakeSlackConfigs struct { - Fake *FakeNotificationV2alpha1 -} - -var slackconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "slackconfigs"} - -var slackconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "SlackConfig"} - -// Get takes name of the slackConfig, and returns the corresponding slackConfig object, and an error if there is any. -func (c *FakeSlackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(slackconfigsResource, name), &v2alpha1.SlackConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackConfig), err -} - -// List takes label and field selectors, and returns the list of SlackConfigs that match those selectors. -func (c *FakeSlackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(slackconfigsResource, slackconfigsKind, opts), &v2alpha1.SlackConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.SlackConfigList{ListMeta: obj.(*v2alpha1.SlackConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.SlackConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested slackConfigs. -func (c *FakeSlackConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(slackconfigsResource, opts)) -} - -// Create takes the representation of a slackConfig and creates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *FakeSlackConfigs) Create(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.CreateOptions) (result *v2alpha1.SlackConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(slackconfigsResource, slackConfig), &v2alpha1.SlackConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackConfig), err -} - -// Update takes the representation of a slackConfig and updates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *FakeSlackConfigs) Update(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (result *v2alpha1.SlackConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(slackconfigsResource, slackConfig), &v2alpha1.SlackConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackConfig), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSlackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (*v2alpha1.SlackConfig, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(slackconfigsResource, "status", slackConfig), &v2alpha1.SlackConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackConfig), err -} - -// Delete takes name of the slackConfig and deletes it. Returns an error if one occurs. -func (c *FakeSlackConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(slackconfigsResource, name), &v2alpha1.SlackConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSlackConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(slackconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.SlackConfigList{}) - return err -} - -// Patch applies the patch and returns the patched slackConfig. -func (c *FakeSlackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(slackconfigsResource, name, pt, data, subresources...), &v2alpha1.SlackConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackConfig), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackreceiver.go deleted file mode 100644 index dabac3b2e..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_slackreceiver.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeSlackReceivers implements SlackReceiverInterface -type FakeSlackReceivers struct { - Fake *FakeNotificationV2alpha1 -} - -var slackreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "slackreceivers"} - -var slackreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "SlackReceiver"} - -// Get takes name of the slackReceiver, and returns the corresponding slackReceiver object, and an error if there is any. -func (c *FakeSlackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(slackreceiversResource, name), &v2alpha1.SlackReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackReceiver), err -} - -// List takes label and field selectors, and returns the list of SlackReceivers that match those selectors. -func (c *FakeSlackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackReceiverList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(slackreceiversResource, slackreceiversKind, opts), &v2alpha1.SlackReceiverList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.SlackReceiverList{ListMeta: obj.(*v2alpha1.SlackReceiverList).ListMeta} - for _, item := range obj.(*v2alpha1.SlackReceiverList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested slackReceivers. -func (c *FakeSlackReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(slackreceiversResource, opts)) -} - -// Create takes the representation of a slackReceiver and creates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *FakeSlackReceivers) Create(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.CreateOptions) (result *v2alpha1.SlackReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(slackreceiversResource, slackReceiver), &v2alpha1.SlackReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackReceiver), err -} - -// Update takes the representation of a slackReceiver and updates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *FakeSlackReceivers) Update(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (result *v2alpha1.SlackReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(slackreceiversResource, slackReceiver), &v2alpha1.SlackReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackReceiver), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSlackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (*v2alpha1.SlackReceiver, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(slackreceiversResource, "status", slackReceiver), &v2alpha1.SlackReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackReceiver), err -} - -// Delete takes name of the slackReceiver and deletes it. Returns an error if one occurs. -func (c *FakeSlackReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(slackreceiversResource, name), &v2alpha1.SlackReceiver{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSlackReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(slackreceiversResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.SlackReceiverList{}) - return err -} - -// Patch applies the patch and returns the patched slackReceiver. -func (c *FakeSlackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(slackreceiversResource, name, pt, data, subresources...), &v2alpha1.SlackReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.SlackReceiver), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookconfig.go deleted file mode 100644 index 9a2de967d..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookconfig.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeWebhookConfigs implements WebhookConfigInterface -type FakeWebhookConfigs struct { - Fake *FakeNotificationV2alpha1 -} - -var webhookconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "webhookconfigs"} - -var webhookconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WebhookConfig"} - -// Get takes name of the webhookConfig, and returns the corresponding webhookConfig object, and an error if there is any. -func (c *FakeWebhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(webhookconfigsResource, name), &v2alpha1.WebhookConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookConfig), err -} - -// List takes label and field selectors, and returns the list of WebhookConfigs that match those selectors. -func (c *FakeWebhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(webhookconfigsResource, webhookconfigsKind, opts), &v2alpha1.WebhookConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.WebhookConfigList{ListMeta: obj.(*v2alpha1.WebhookConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.WebhookConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested webhookConfigs. -func (c *FakeWebhookConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(webhookconfigsResource, opts)) -} - -// Create takes the representation of a webhookConfig and creates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *FakeWebhookConfigs) Create(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.CreateOptions) (result *v2alpha1.WebhookConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(webhookconfigsResource, webhookConfig), &v2alpha1.WebhookConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookConfig), err -} - -// Update takes the representation of a webhookConfig and updates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *FakeWebhookConfigs) Update(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (result *v2alpha1.WebhookConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(webhookconfigsResource, webhookConfig), &v2alpha1.WebhookConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookConfig), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWebhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (*v2alpha1.WebhookConfig, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(webhookconfigsResource, "status", webhookConfig), &v2alpha1.WebhookConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookConfig), err -} - -// Delete takes name of the webhookConfig and deletes it. Returns an error if one occurs. -func (c *FakeWebhookConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(webhookconfigsResource, name), &v2alpha1.WebhookConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeWebhookConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(webhookconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.WebhookConfigList{}) - return err -} - -// Patch applies the patch and returns the patched webhookConfig. -func (c *FakeWebhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(webhookconfigsResource, name, pt, data, subresources...), &v2alpha1.WebhookConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookConfig), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookreceiver.go deleted file mode 100644 index 09ebc2534..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_webhookreceiver.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeWebhookReceivers implements WebhookReceiverInterface -type FakeWebhookReceivers struct { - Fake *FakeNotificationV2alpha1 -} - -var webhookreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "webhookreceivers"} - -var webhookreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WebhookReceiver"} - -// Get takes name of the webhookReceiver, and returns the corresponding webhookReceiver object, and an error if there is any. -func (c *FakeWebhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(webhookreceiversResource, name), &v2alpha1.WebhookReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookReceiver), err -} - -// List takes label and field selectors, and returns the list of WebhookReceivers that match those selectors. -func (c *FakeWebhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookReceiverList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(webhookreceiversResource, webhookreceiversKind, opts), &v2alpha1.WebhookReceiverList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.WebhookReceiverList{ListMeta: obj.(*v2alpha1.WebhookReceiverList).ListMeta} - for _, item := range obj.(*v2alpha1.WebhookReceiverList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested webhookReceivers. -func (c *FakeWebhookReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(webhookreceiversResource, opts)) -} - -// Create takes the representation of a webhookReceiver and creates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *FakeWebhookReceivers) Create(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.CreateOptions) (result *v2alpha1.WebhookReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(webhookreceiversResource, webhookReceiver), &v2alpha1.WebhookReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookReceiver), err -} - -// Update takes the representation of a webhookReceiver and updates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *FakeWebhookReceivers) Update(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (result *v2alpha1.WebhookReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(webhookreceiversResource, webhookReceiver), &v2alpha1.WebhookReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookReceiver), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWebhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (*v2alpha1.WebhookReceiver, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(webhookreceiversResource, "status", webhookReceiver), &v2alpha1.WebhookReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookReceiver), err -} - -// Delete takes name of the webhookReceiver and deletes it. Returns an error if one occurs. -func (c *FakeWebhookReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(webhookreceiversResource, name), &v2alpha1.WebhookReceiver{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeWebhookReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(webhookreceiversResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.WebhookReceiverList{}) - return err -} - -// Patch applies the patch and returns the patched webhookReceiver. -func (c *FakeWebhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(webhookreceiversResource, name, pt, data, subresources...), &v2alpha1.WebhookReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WebhookReceiver), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatconfig.go deleted file mode 100644 index 63a2d694a..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatconfig.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeWechatConfigs implements WechatConfigInterface -type FakeWechatConfigs struct { - Fake *FakeNotificationV2alpha1 -} - -var wechatconfigsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "wechatconfigs"} - -var wechatconfigsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WechatConfig"} - -// Get takes name of the wechatConfig, and returns the corresponding wechatConfig object, and an error if there is any. -func (c *FakeWechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(wechatconfigsResource, name), &v2alpha1.WechatConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatConfig), err -} - -// List takes label and field selectors, and returns the list of WechatConfigs that match those selectors. -func (c *FakeWechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatConfigList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(wechatconfigsResource, wechatconfigsKind, opts), &v2alpha1.WechatConfigList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.WechatConfigList{ListMeta: obj.(*v2alpha1.WechatConfigList).ListMeta} - for _, item := range obj.(*v2alpha1.WechatConfigList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested wechatConfigs. -func (c *FakeWechatConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(wechatconfigsResource, opts)) -} - -// Create takes the representation of a wechatConfig and creates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *FakeWechatConfigs) Create(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.CreateOptions) (result *v2alpha1.WechatConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(wechatconfigsResource, wechatConfig), &v2alpha1.WechatConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatConfig), err -} - -// Update takes the representation of a wechatConfig and updates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *FakeWechatConfigs) Update(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (result *v2alpha1.WechatConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(wechatconfigsResource, wechatConfig), &v2alpha1.WechatConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatConfig), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (*v2alpha1.WechatConfig, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(wechatconfigsResource, "status", wechatConfig), &v2alpha1.WechatConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatConfig), err -} - -// Delete takes name of the wechatConfig and deletes it. Returns an error if one occurs. -func (c *FakeWechatConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(wechatconfigsResource, name), &v2alpha1.WechatConfig{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeWechatConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(wechatconfigsResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.WechatConfigList{}) - return err -} - -// Patch applies the patch and returns the patched wechatConfig. -func (c *FakeWechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatConfig, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(wechatconfigsResource, name, pt, data, subresources...), &v2alpha1.WechatConfig{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatConfig), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatreceiver.go deleted file mode 100644 index 775d4803c..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/fake_wechatreceiver.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// FakeWechatReceivers implements WechatReceiverInterface -type FakeWechatReceivers struct { - Fake *FakeNotificationV2alpha1 -} - -var wechatreceiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2alpha1", Resource: "wechatreceivers"} - -var wechatreceiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2alpha1", Kind: "WechatReceiver"} - -// Get takes name of the wechatReceiver, and returns the corresponding wechatReceiver object, and an error if there is any. -func (c *FakeWechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(wechatreceiversResource, name), &v2alpha1.WechatReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatReceiver), err -} - -// List takes label and field selectors, and returns the list of WechatReceivers that match those selectors. -func (c *FakeWechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatReceiverList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(wechatreceiversResource, wechatreceiversKind, opts), &v2alpha1.WechatReceiverList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v2alpha1.WechatReceiverList{ListMeta: obj.(*v2alpha1.WechatReceiverList).ListMeta} - for _, item := range obj.(*v2alpha1.WechatReceiverList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested wechatReceivers. -func (c *FakeWechatReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(wechatreceiversResource, opts)) -} - -// Create takes the representation of a wechatReceiver and creates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *FakeWechatReceivers) Create(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.CreateOptions) (result *v2alpha1.WechatReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(wechatreceiversResource, wechatReceiver), &v2alpha1.WechatReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatReceiver), err -} - -// Update takes the representation of a wechatReceiver and updates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *FakeWechatReceivers) Update(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (result *v2alpha1.WechatReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(wechatreceiversResource, wechatReceiver), &v2alpha1.WechatReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatReceiver), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeWechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (*v2alpha1.WechatReceiver, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(wechatreceiversResource, "status", wechatReceiver), &v2alpha1.WechatReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatReceiver), err -} - -// Delete takes name of the wechatReceiver and deletes it. Returns an error if one occurs. -func (c *FakeWechatReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteAction(wechatreceiversResource, name), &v2alpha1.WechatReceiver{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeWechatReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(wechatreceiversResource, listOpts) - - _, err := c.Fake.Invokes(action, &v2alpha1.WechatReceiverList{}) - return err -} - -// Patch applies the patch and returns the patched wechatReceiver. -func (c *FakeWechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatReceiver, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(wechatreceiversResource, name, pt, data, subresources...), &v2alpha1.WechatReceiver{}) - if obj == nil { - return nil, err - } - return obj.(*v2alpha1.WechatReceiver), err -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/notification_client.go deleted file mode 100644 index 418449cb3..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/notification_client.go +++ /dev/null @@ -1,134 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -type NotificationV2alpha1Interface interface { - RESTClient() rest.Interface - DingTalkConfigsGetter - DingTalkReceiversGetter - EmailConfigsGetter - EmailReceiversGetter - SlackConfigsGetter - SlackReceiversGetter - WebhookConfigsGetter - WebhookReceiversGetter - WechatConfigsGetter - WechatReceiversGetter -} - -// NotificationV2alpha1Client is used to interact with features provided by the notification.kubesphere.io group. -type NotificationV2alpha1Client struct { - restClient rest.Interface -} - -func (c *NotificationV2alpha1Client) DingTalkConfigs() DingTalkConfigInterface { - return newDingTalkConfigs(c) -} - -func (c *NotificationV2alpha1Client) DingTalkReceivers() DingTalkReceiverInterface { - return newDingTalkReceivers(c) -} - -func (c *NotificationV2alpha1Client) EmailConfigs() EmailConfigInterface { - return newEmailConfigs(c) -} - -func (c *NotificationV2alpha1Client) EmailReceivers() EmailReceiverInterface { - return newEmailReceivers(c) -} - -func (c *NotificationV2alpha1Client) SlackConfigs() SlackConfigInterface { - return newSlackConfigs(c) -} - -func (c *NotificationV2alpha1Client) SlackReceivers() SlackReceiverInterface { - return newSlackReceivers(c) -} - -func (c *NotificationV2alpha1Client) WebhookConfigs() WebhookConfigInterface { - return newWebhookConfigs(c) -} - -func (c *NotificationV2alpha1Client) WebhookReceivers() WebhookReceiverInterface { - return newWebhookReceivers(c) -} - -func (c *NotificationV2alpha1Client) WechatConfigs() WechatConfigInterface { - return newWechatConfigs(c) -} - -func (c *NotificationV2alpha1Client) WechatReceivers() WechatReceiverInterface { - return newWechatReceivers(c) -} - -// NewForConfig creates a new NotificationV2alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*NotificationV2alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &NotificationV2alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new NotificationV2alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *NotificationV2alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new NotificationV2alpha1Client for the given RESTClient. -func New(c rest.Interface) *NotificationV2alpha1Client { - return &NotificationV2alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v2alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *NotificationV2alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackconfig.go deleted file mode 100644 index e75a1029e..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackconfig.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// SlackConfigsGetter has a method to return a SlackConfigInterface. -// A group's client should implement this interface. -type SlackConfigsGetter interface { - SlackConfigs() SlackConfigInterface -} - -// SlackConfigInterface has methods to work with SlackConfig resources. -type SlackConfigInterface interface { - Create(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.CreateOptions) (*v2alpha1.SlackConfig, error) - Update(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (*v2alpha1.SlackConfig, error) - UpdateStatus(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (*v2alpha1.SlackConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.SlackConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.SlackConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackConfig, err error) - SlackConfigExpansion -} - -// slackConfigs implements SlackConfigInterface -type slackConfigs struct { - client rest.Interface -} - -// newSlackConfigs returns a SlackConfigs -func newSlackConfigs(c *NotificationV2alpha1Client) *slackConfigs { - return &slackConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the slackConfig, and returns the corresponding slackConfig object, and an error if there is any. -func (c *slackConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackConfig, err error) { - result = &v2alpha1.SlackConfig{} - err = c.client.Get(). - Resource("slackconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SlackConfigs that match those selectors. -func (c *slackConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.SlackConfigList{} - err = c.client.Get(). - Resource("slackconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested slackConfigs. -func (c *slackConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("slackconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a slackConfig and creates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *slackConfigs) Create(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.CreateOptions) (result *v2alpha1.SlackConfig, err error) { - result = &v2alpha1.SlackConfig{} - err = c.client.Post(). - Resource("slackconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(slackConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a slackConfig and updates it. Returns the server's representation of the slackConfig, and an error, if there is any. -func (c *slackConfigs) Update(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (result *v2alpha1.SlackConfig, err error) { - result = &v2alpha1.SlackConfig{} - err = c.client.Put(). - Resource("slackconfigs"). - Name(slackConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(slackConfig). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *slackConfigs) UpdateStatus(ctx context.Context, slackConfig *v2alpha1.SlackConfig, opts v1.UpdateOptions) (result *v2alpha1.SlackConfig, err error) { - result = &v2alpha1.SlackConfig{} - err = c.client.Put(). - Resource("slackconfigs"). - Name(slackConfig.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(slackConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the slackConfig and deletes it. Returns an error if one occurs. -func (c *slackConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("slackconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *slackConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("slackconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched slackConfig. -func (c *slackConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackConfig, err error) { - result = &v2alpha1.SlackConfig{} - err = c.client.Patch(pt). - Resource("slackconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackreceiver.go deleted file mode 100644 index 78c6ce257..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/slackreceiver.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// SlackReceiversGetter has a method to return a SlackReceiverInterface. -// A group's client should implement this interface. -type SlackReceiversGetter interface { - SlackReceivers() SlackReceiverInterface -} - -// SlackReceiverInterface has methods to work with SlackReceiver resources. -type SlackReceiverInterface interface { - Create(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.CreateOptions) (*v2alpha1.SlackReceiver, error) - Update(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (*v2alpha1.SlackReceiver, error) - UpdateStatus(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (*v2alpha1.SlackReceiver, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.SlackReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.SlackReceiverList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackReceiver, err error) - SlackReceiverExpansion -} - -// slackReceivers implements SlackReceiverInterface -type slackReceivers struct { - client rest.Interface -} - -// newSlackReceivers returns a SlackReceivers -func newSlackReceivers(c *NotificationV2alpha1Client) *slackReceivers { - return &slackReceivers{ - client: c.RESTClient(), - } -} - -// Get takes name of the slackReceiver, and returns the corresponding slackReceiver object, and an error if there is any. -func (c *slackReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.SlackReceiver, err error) { - result = &v2alpha1.SlackReceiver{} - err = c.client.Get(). - Resource("slackreceivers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SlackReceivers that match those selectors. -func (c *slackReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.SlackReceiverList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.SlackReceiverList{} - err = c.client.Get(). - Resource("slackreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested slackReceivers. -func (c *slackReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("slackreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a slackReceiver and creates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *slackReceivers) Create(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.CreateOptions) (result *v2alpha1.SlackReceiver, err error) { - result = &v2alpha1.SlackReceiver{} - err = c.client.Post(). - Resource("slackreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(slackReceiver). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a slackReceiver and updates it. Returns the server's representation of the slackReceiver, and an error, if there is any. -func (c *slackReceivers) Update(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (result *v2alpha1.SlackReceiver, err error) { - result = &v2alpha1.SlackReceiver{} - err = c.client.Put(). - Resource("slackreceivers"). - Name(slackReceiver.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(slackReceiver). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *slackReceivers) UpdateStatus(ctx context.Context, slackReceiver *v2alpha1.SlackReceiver, opts v1.UpdateOptions) (result *v2alpha1.SlackReceiver, err error) { - result = &v2alpha1.SlackReceiver{} - err = c.client.Put(). - Resource("slackreceivers"). - Name(slackReceiver.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(slackReceiver). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the slackReceiver and deletes it. Returns an error if one occurs. -func (c *slackReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("slackreceivers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *slackReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("slackreceivers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched slackReceiver. -func (c *slackReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.SlackReceiver, err error) { - result = &v2alpha1.SlackReceiver{} - err = c.client.Patch(pt). - Resource("slackreceivers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookconfig.go deleted file mode 100644 index 80d879cd9..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookconfig.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// WebhookConfigsGetter has a method to return a WebhookConfigInterface. -// A group's client should implement this interface. -type WebhookConfigsGetter interface { - WebhookConfigs() WebhookConfigInterface -} - -// WebhookConfigInterface has methods to work with WebhookConfig resources. -type WebhookConfigInterface interface { - Create(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.CreateOptions) (*v2alpha1.WebhookConfig, error) - Update(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (*v2alpha1.WebhookConfig, error) - UpdateStatus(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (*v2alpha1.WebhookConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WebhookConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WebhookConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookConfig, err error) - WebhookConfigExpansion -} - -// webhookConfigs implements WebhookConfigInterface -type webhookConfigs struct { - client rest.Interface -} - -// newWebhookConfigs returns a WebhookConfigs -func newWebhookConfigs(c *NotificationV2alpha1Client) *webhookConfigs { - return &webhookConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the webhookConfig, and returns the corresponding webhookConfig object, and an error if there is any. -func (c *webhookConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookConfig, err error) { - result = &v2alpha1.WebhookConfig{} - err = c.client.Get(). - Resource("webhookconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of WebhookConfigs that match those selectors. -func (c *webhookConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.WebhookConfigList{} - err = c.client.Get(). - Resource("webhookconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested webhookConfigs. -func (c *webhookConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("webhookconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a webhookConfig and creates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *webhookConfigs) Create(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.CreateOptions) (result *v2alpha1.WebhookConfig, err error) { - result = &v2alpha1.WebhookConfig{} - err = c.client.Post(). - Resource("webhookconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a webhookConfig and updates it. Returns the server's representation of the webhookConfig, and an error, if there is any. -func (c *webhookConfigs) Update(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (result *v2alpha1.WebhookConfig, err error) { - result = &v2alpha1.WebhookConfig{} - err = c.client.Put(). - Resource("webhookconfigs"). - Name(webhookConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookConfig). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *webhookConfigs) UpdateStatus(ctx context.Context, webhookConfig *v2alpha1.WebhookConfig, opts v1.UpdateOptions) (result *v2alpha1.WebhookConfig, err error) { - result = &v2alpha1.WebhookConfig{} - err = c.client.Put(). - Resource("webhookconfigs"). - Name(webhookConfig.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the webhookConfig and deletes it. Returns an error if one occurs. -func (c *webhookConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("webhookconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *webhookConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("webhookconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched webhookConfig. -func (c *webhookConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookConfig, err error) { - result = &v2alpha1.WebhookConfig{} - err = c.client.Patch(pt). - Resource("webhookconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookreceiver.go deleted file mode 100644 index a48ffdf7f..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/webhookreceiver.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// WebhookReceiversGetter has a method to return a WebhookReceiverInterface. -// A group's client should implement this interface. -type WebhookReceiversGetter interface { - WebhookReceivers() WebhookReceiverInterface -} - -// WebhookReceiverInterface has methods to work with WebhookReceiver resources. -type WebhookReceiverInterface interface { - Create(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.CreateOptions) (*v2alpha1.WebhookReceiver, error) - Update(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (*v2alpha1.WebhookReceiver, error) - UpdateStatus(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (*v2alpha1.WebhookReceiver, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WebhookReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WebhookReceiverList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookReceiver, err error) - WebhookReceiverExpansion -} - -// webhookReceivers implements WebhookReceiverInterface -type webhookReceivers struct { - client rest.Interface -} - -// newWebhookReceivers returns a WebhookReceivers -func newWebhookReceivers(c *NotificationV2alpha1Client) *webhookReceivers { - return &webhookReceivers{ - client: c.RESTClient(), - } -} - -// Get takes name of the webhookReceiver, and returns the corresponding webhookReceiver object, and an error if there is any. -func (c *webhookReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WebhookReceiver, err error) { - result = &v2alpha1.WebhookReceiver{} - err = c.client.Get(). - Resource("webhookreceivers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of WebhookReceivers that match those selectors. -func (c *webhookReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WebhookReceiverList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.WebhookReceiverList{} - err = c.client.Get(). - Resource("webhookreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested webhookReceivers. -func (c *webhookReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("webhookreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a webhookReceiver and creates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *webhookReceivers) Create(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.CreateOptions) (result *v2alpha1.WebhookReceiver, err error) { - result = &v2alpha1.WebhookReceiver{} - err = c.client.Post(). - Resource("webhookreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookReceiver). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a webhookReceiver and updates it. Returns the server's representation of the webhookReceiver, and an error, if there is any. -func (c *webhookReceivers) Update(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (result *v2alpha1.WebhookReceiver, err error) { - result = &v2alpha1.WebhookReceiver{} - err = c.client.Put(). - Resource("webhookreceivers"). - Name(webhookReceiver.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookReceiver). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *webhookReceivers) UpdateStatus(ctx context.Context, webhookReceiver *v2alpha1.WebhookReceiver, opts v1.UpdateOptions) (result *v2alpha1.WebhookReceiver, err error) { - result = &v2alpha1.WebhookReceiver{} - err = c.client.Put(). - Resource("webhookreceivers"). - Name(webhookReceiver.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(webhookReceiver). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the webhookReceiver and deletes it. Returns an error if one occurs. -func (c *webhookReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("webhookreceivers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *webhookReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("webhookreceivers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched webhookReceiver. -func (c *webhookReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WebhookReceiver, err error) { - result = &v2alpha1.WebhookReceiver{} - err = c.client.Patch(pt). - Resource("webhookreceivers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatconfig.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatconfig.go deleted file mode 100644 index 87d393cb8..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatconfig.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// WechatConfigsGetter has a method to return a WechatConfigInterface. -// A group's client should implement this interface. -type WechatConfigsGetter interface { - WechatConfigs() WechatConfigInterface -} - -// WechatConfigInterface has methods to work with WechatConfig resources. -type WechatConfigInterface interface { - Create(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.CreateOptions) (*v2alpha1.WechatConfig, error) - Update(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (*v2alpha1.WechatConfig, error) - UpdateStatus(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (*v2alpha1.WechatConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WechatConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WechatConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatConfig, err error) - WechatConfigExpansion -} - -// wechatConfigs implements WechatConfigInterface -type wechatConfigs struct { - client rest.Interface -} - -// newWechatConfigs returns a WechatConfigs -func newWechatConfigs(c *NotificationV2alpha1Client) *wechatConfigs { - return &wechatConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the wechatConfig, and returns the corresponding wechatConfig object, and an error if there is any. -func (c *wechatConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatConfig, err error) { - result = &v2alpha1.WechatConfig{} - err = c.client.Get(). - Resource("wechatconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of WechatConfigs that match those selectors. -func (c *wechatConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.WechatConfigList{} - err = c.client.Get(). - Resource("wechatconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested wechatConfigs. -func (c *wechatConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("wechatconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a wechatConfig and creates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *wechatConfigs) Create(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.CreateOptions) (result *v2alpha1.WechatConfig, err error) { - result = &v2alpha1.WechatConfig{} - err = c.client.Post(). - Resource("wechatconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(wechatConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a wechatConfig and updates it. Returns the server's representation of the wechatConfig, and an error, if there is any. -func (c *wechatConfigs) Update(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (result *v2alpha1.WechatConfig, err error) { - result = &v2alpha1.WechatConfig{} - err = c.client.Put(). - Resource("wechatconfigs"). - Name(wechatConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(wechatConfig). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *wechatConfigs) UpdateStatus(ctx context.Context, wechatConfig *v2alpha1.WechatConfig, opts v1.UpdateOptions) (result *v2alpha1.WechatConfig, err error) { - result = &v2alpha1.WechatConfig{} - err = c.client.Put(). - Resource("wechatconfigs"). - Name(wechatConfig.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(wechatConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the wechatConfig and deletes it. Returns an error if one occurs. -func (c *wechatConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("wechatconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *wechatConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("wechatconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched wechatConfig. -func (c *wechatConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatConfig, err error) { - result = &v2alpha1.WechatConfig{} - err = c.client.Patch(pt). - Resource("wechatconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatreceiver.go b/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatreceiver.go deleted file mode 100644 index 483d47d58..000000000 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/wechatreceiver.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" -) - -// WechatReceiversGetter has a method to return a WechatReceiverInterface. -// A group's client should implement this interface. -type WechatReceiversGetter interface { - WechatReceivers() WechatReceiverInterface -} - -// WechatReceiverInterface has methods to work with WechatReceiver resources. -type WechatReceiverInterface interface { - Create(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.CreateOptions) (*v2alpha1.WechatReceiver, error) - Update(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (*v2alpha1.WechatReceiver, error) - UpdateStatus(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (*v2alpha1.WechatReceiver, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.WechatReceiver, error) - List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.WechatReceiverList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatReceiver, err error) - WechatReceiverExpansion -} - -// wechatReceivers implements WechatReceiverInterface -type wechatReceivers struct { - client rest.Interface -} - -// newWechatReceivers returns a WechatReceivers -func newWechatReceivers(c *NotificationV2alpha1Client) *wechatReceivers { - return &wechatReceivers{ - client: c.RESTClient(), - } -} - -// Get takes name of the wechatReceiver, and returns the corresponding wechatReceiver object, and an error if there is any. -func (c *wechatReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.WechatReceiver, err error) { - result = &v2alpha1.WechatReceiver{} - err = c.client.Get(). - Resource("wechatreceivers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of WechatReceivers that match those selectors. -func (c *wechatReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.WechatReceiverList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v2alpha1.WechatReceiverList{} - err = c.client.Get(). - Resource("wechatreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested wechatReceivers. -func (c *wechatReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("wechatreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a wechatReceiver and creates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *wechatReceivers) Create(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.CreateOptions) (result *v2alpha1.WechatReceiver, err error) { - result = &v2alpha1.WechatReceiver{} - err = c.client.Post(). - Resource("wechatreceivers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(wechatReceiver). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a wechatReceiver and updates it. Returns the server's representation of the wechatReceiver, and an error, if there is any. -func (c *wechatReceivers) Update(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (result *v2alpha1.WechatReceiver, err error) { - result = &v2alpha1.WechatReceiver{} - err = c.client.Put(). - Resource("wechatreceivers"). - Name(wechatReceiver.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(wechatReceiver). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *wechatReceivers) UpdateStatus(ctx context.Context, wechatReceiver *v2alpha1.WechatReceiver, opts v1.UpdateOptions) (result *v2alpha1.WechatReceiver, err error) { - result = &v2alpha1.WechatReceiver{} - err = c.client.Put(). - Resource("wechatreceivers"). - Name(wechatReceiver.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(wechatReceiver). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the wechatReceiver and deletes it. Returns an error if one occurs. -func (c *wechatReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("wechatreceivers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *wechatReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("wechatreceivers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched wechatReceiver. -func (c *wechatReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.WechatReceiver, err error) { - result = &v2alpha1.WechatReceiver{} - err = c.client.Patch(pt). - Resource("wechatreceivers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/notification/v2beta1/config.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/config.go new file mode 100644 index 000000000..b85bcaa20 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/config.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// ConfigsGetter has a method to return a ConfigInterface. +// A group's client should implement this interface. +type ConfigsGetter interface { + Configs() ConfigInterface +} + +// ConfigInterface has methods to work with Config resources. +type ConfigInterface interface { + Create(ctx context.Context, config *v2beta1.Config, opts v1.CreateOptions) (*v2beta1.Config, error) + Update(ctx context.Context, config *v2beta1.Config, opts v1.UpdateOptions) (*v2beta1.Config, error) + UpdateStatus(ctx context.Context, config *v2beta1.Config, opts v1.UpdateOptions) (*v2beta1.Config, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.Config, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta1.ConfigList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Config, err error) + ConfigExpansion +} + +// configs implements ConfigInterface +type configs struct { + client rest.Interface +} + +// newConfigs returns a Configs +func newConfigs(c *NotificationV2beta1Client) *configs { + return &configs{ + client: c.RESTClient(), + } +} + +// Get takes name of the config, and returns the corresponding config object, and an error if there is any. +func (c *configs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Config, err error) { + result = &v2beta1.Config{} + err = c.client.Get(). + Resource("configs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Configs that match those selectors. +func (c *configs) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta1.ConfigList{} + err = c.client.Get(). + Resource("configs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested configs. +func (c *configs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("configs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a config and creates it. Returns the server's representation of the config, and an error, if there is any. +func (c *configs) Create(ctx context.Context, config *v2beta1.Config, opts v1.CreateOptions) (result *v2beta1.Config, err error) { + result = &v2beta1.Config{} + err = c.client.Post(). + Resource("configs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(config). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a config and updates it. Returns the server's representation of the config, and an error, if there is any. +func (c *configs) Update(ctx context.Context, config *v2beta1.Config, opts v1.UpdateOptions) (result *v2beta1.Config, err error) { + result = &v2beta1.Config{} + err = c.client.Put(). + Resource("configs"). + Name(config.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(config). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *configs) UpdateStatus(ctx context.Context, config *v2beta1.Config, opts v1.UpdateOptions) (result *v2beta1.Config, err error) { + result = &v2beta1.Config{} + err = c.client.Put(). + Resource("configs"). + Name(config.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(config). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the config and deletes it. Returns an error if one occurs. +func (c *configs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("configs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *configs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("configs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched config. +func (c *configs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Config, err error) { + result = &v2beta1.Config{} + err = c.client.Patch(pt). + Resource("configs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/doc.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/doc.go similarity index 97% rename from pkg/client/clientset/versioned/typed/notification/v2alpha1/doc.go rename to pkg/client/clientset/versioned/typed/notification/v2beta1/doc.go index c24ff03b2..e72982142 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/doc.go +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v2alpha1 +package v2beta1 diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/doc.go similarity index 100% rename from pkg/client/clientset/versioned/typed/notification/v2alpha1/fake/doc.go rename to pkg/client/clientset/versioned/typed/notification/v2beta1/fake/doc.go diff --git a/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_config.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_config.go new file mode 100644 index 000000000..57b747846 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_config.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" +) + +// FakeConfigs implements ConfigInterface +type FakeConfigs struct { + Fake *FakeNotificationV2beta1 +} + +var configsResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2beta1", Resource: "configs"} + +var configsKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2beta1", Kind: "Config"} + +// Get takes name of the config, and returns the corresponding config object, and an error if there is any. +func (c *FakeConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Config, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(configsResource, name), &v2beta1.Config{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Config), err +} + +// List takes label and field selectors, and returns the list of Configs that match those selectors. +func (c *FakeConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(configsResource, configsKind, opts), &v2beta1.ConfigList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta1.ConfigList{ListMeta: obj.(*v2beta1.ConfigList).ListMeta} + for _, item := range obj.(*v2beta1.ConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested configs. +func (c *FakeConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(configsResource, opts)) +} + +// Create takes the representation of a config and creates it. Returns the server's representation of the config, and an error, if there is any. +func (c *FakeConfigs) Create(ctx context.Context, config *v2beta1.Config, opts v1.CreateOptions) (result *v2beta1.Config, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(configsResource, config), &v2beta1.Config{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Config), err +} + +// Update takes the representation of a config and updates it. Returns the server's representation of the config, and an error, if there is any. +func (c *FakeConfigs) Update(ctx context.Context, config *v2beta1.Config, opts v1.UpdateOptions) (result *v2beta1.Config, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(configsResource, config), &v2beta1.Config{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Config), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeConfigs) UpdateStatus(ctx context.Context, config *v2beta1.Config, opts v1.UpdateOptions) (*v2beta1.Config, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(configsResource, "status", config), &v2beta1.Config{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Config), err +} + +// Delete takes name of the config and deletes it. Returns an error if one occurs. +func (c *FakeConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(configsResource, name), &v2beta1.Config{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(configsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta1.ConfigList{}) + return err +} + +// Patch applies the patch and returns the patched config. +func (c *FakeConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Config, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(configsResource, name, pt, data, subresources...), &v2beta1.Config{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Config), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_notification_client.go new file mode 100644 index 000000000..943c88630 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_notification_client.go @@ -0,0 +1,44 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v2beta1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/notification/v2beta1" +) + +type FakeNotificationV2beta1 struct { + *testing.Fake +} + +func (c *FakeNotificationV2beta1) Configs() v2beta1.ConfigInterface { + return &FakeConfigs{c} +} + +func (c *FakeNotificationV2beta1) Receivers() v2beta1.ReceiverInterface { + return &FakeReceivers{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeNotificationV2beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_receiver.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_receiver.go new file mode 100644 index 000000000..4f887de8d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/fake/fake_receiver.go @@ -0,0 +1,133 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" +) + +// FakeReceivers implements ReceiverInterface +type FakeReceivers struct { + Fake *FakeNotificationV2beta1 +} + +var receiversResource = schema.GroupVersionResource{Group: "notification.kubesphere.io", Version: "v2beta1", Resource: "receivers"} + +var receiversKind = schema.GroupVersionKind{Group: "notification.kubesphere.io", Version: "v2beta1", Kind: "Receiver"} + +// Get takes name of the receiver, and returns the corresponding receiver object, and an error if there is any. +func (c *FakeReceivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Receiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(receiversResource, name), &v2beta1.Receiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Receiver), err +} + +// List takes label and field selectors, and returns the list of Receivers that match those selectors. +func (c *FakeReceivers) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ReceiverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(receiversResource, receiversKind, opts), &v2beta1.ReceiverList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta1.ReceiverList{ListMeta: obj.(*v2beta1.ReceiverList).ListMeta} + for _, item := range obj.(*v2beta1.ReceiverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested receivers. +func (c *FakeReceivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(receiversResource, opts)) +} + +// Create takes the representation of a receiver and creates it. Returns the server's representation of the receiver, and an error, if there is any. +func (c *FakeReceivers) Create(ctx context.Context, receiver *v2beta1.Receiver, opts v1.CreateOptions) (result *v2beta1.Receiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(receiversResource, receiver), &v2beta1.Receiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Receiver), err +} + +// Update takes the representation of a receiver and updates it. Returns the server's representation of the receiver, and an error, if there is any. +func (c *FakeReceivers) Update(ctx context.Context, receiver *v2beta1.Receiver, opts v1.UpdateOptions) (result *v2beta1.Receiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(receiversResource, receiver), &v2beta1.Receiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Receiver), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeReceivers) UpdateStatus(ctx context.Context, receiver *v2beta1.Receiver, opts v1.UpdateOptions) (*v2beta1.Receiver, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(receiversResource, "status", receiver), &v2beta1.Receiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Receiver), err +} + +// Delete takes name of the receiver and deletes it. Returns an error if one occurs. +func (c *FakeReceivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(receiversResource, name), &v2beta1.Receiver{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeReceivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(receiversResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta1.ReceiverList{}) + return err +} + +// Patch applies the patch and returns the patched receiver. +func (c *FakeReceivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Receiver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(receiversResource, name, pt, data, subresources...), &v2beta1.Receiver{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta1.Receiver), err +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/generated_expansion.go similarity index 59% rename from pkg/client/clientset/versioned/typed/notification/v2alpha1/generated_expansion.go rename to pkg/client/clientset/versioned/typed/notification/v2beta1/generated_expansion.go index c13e64d2d..ecc049523 100644 --- a/pkg/client/clientset/versioned/typed/notification/v2alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/generated_expansion.go @@ -16,24 +16,8 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2alpha1 +package v2beta1 -type DingTalkConfigExpansion interface{} +type ConfigExpansion interface{} -type DingTalkReceiverExpansion interface{} - -type EmailConfigExpansion interface{} - -type EmailReceiverExpansion interface{} - -type SlackConfigExpansion interface{} - -type SlackReceiverExpansion interface{} - -type WebhookConfigExpansion interface{} - -type WebhookReceiverExpansion interface{} - -type WechatConfigExpansion interface{} - -type WechatReceiverExpansion interface{} +type ReceiverExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/notification/v2beta1/notification_client.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/notification_client.go new file mode 100644 index 000000000..a494ff758 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/notification_client.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta1 + +import ( + rest "k8s.io/client-go/rest" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" + "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +type NotificationV2beta1Interface interface { + RESTClient() rest.Interface + ConfigsGetter + ReceiversGetter +} + +// NotificationV2beta1Client is used to interact with features provided by the notification.kubesphere.io group. +type NotificationV2beta1Client struct { + restClient rest.Interface +} + +func (c *NotificationV2beta1Client) Configs() ConfigInterface { + return newConfigs(c) +} + +func (c *NotificationV2beta1Client) Receivers() ReceiverInterface { + return newReceivers(c) +} + +// NewForConfig creates a new NotificationV2beta1Client for the given config. +func NewForConfig(c *rest.Config) (*NotificationV2beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &NotificationV2beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new NotificationV2beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *NotificationV2beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new NotificationV2beta1Client for the given RESTClient. +func New(c rest.Interface) *NotificationV2beta1Client { + return &NotificationV2beta1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v2beta1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *NotificationV2beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/notification/v2beta1/receiver.go b/pkg/client/clientset/versioned/typed/notification/v2beta1/receiver.go new file mode 100644 index 000000000..24adee000 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/notification/v2beta1/receiver.go @@ -0,0 +1,184 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" + scheme "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" +) + +// ReceiversGetter has a method to return a ReceiverInterface. +// A group's client should implement this interface. +type ReceiversGetter interface { + Receivers() ReceiverInterface +} + +// ReceiverInterface has methods to work with Receiver resources. +type ReceiverInterface interface { + Create(ctx context.Context, receiver *v2beta1.Receiver, opts v1.CreateOptions) (*v2beta1.Receiver, error) + Update(ctx context.Context, receiver *v2beta1.Receiver, opts v1.UpdateOptions) (*v2beta1.Receiver, error) + UpdateStatus(ctx context.Context, receiver *v2beta1.Receiver, opts v1.UpdateOptions) (*v2beta1.Receiver, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta1.Receiver, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta1.ReceiverList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Receiver, err error) + ReceiverExpansion +} + +// receivers implements ReceiverInterface +type receivers struct { + client rest.Interface +} + +// newReceivers returns a Receivers +func newReceivers(c *NotificationV2beta1Client) *receivers { + return &receivers{ + client: c.RESTClient(), + } +} + +// Get takes name of the receiver, and returns the corresponding receiver object, and an error if there is any. +func (c *receivers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta1.Receiver, err error) { + result = &v2beta1.Receiver{} + err = c.client.Get(). + Resource("receivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Receivers that match those selectors. +func (c *receivers) List(ctx context.Context, opts v1.ListOptions) (result *v2beta1.ReceiverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta1.ReceiverList{} + err = c.client.Get(). + Resource("receivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested receivers. +func (c *receivers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("receivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a receiver and creates it. Returns the server's representation of the receiver, and an error, if there is any. +func (c *receivers) Create(ctx context.Context, receiver *v2beta1.Receiver, opts v1.CreateOptions) (result *v2beta1.Receiver, err error) { + result = &v2beta1.Receiver{} + err = c.client.Post(). + Resource("receivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(receiver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a receiver and updates it. Returns the server's representation of the receiver, and an error, if there is any. +func (c *receivers) Update(ctx context.Context, receiver *v2beta1.Receiver, opts v1.UpdateOptions) (result *v2beta1.Receiver, err error) { + result = &v2beta1.Receiver{} + err = c.client.Put(). + Resource("receivers"). + Name(receiver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(receiver). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *receivers) UpdateStatus(ctx context.Context, receiver *v2beta1.Receiver, opts v1.UpdateOptions) (result *v2beta1.Receiver, err error) { + result = &v2beta1.Receiver{} + err = c.client.Put(). + Resource("receivers"). + Name(receiver.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(receiver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the receiver and deletes it. Returns an error if one occurs. +func (c *receivers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("receivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *receivers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("receivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched receiver. +func (c *receivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta1.Receiver, err error) { + result = &v2beta1.Receiver{} + err = c.client.Patch(pt). + Resource("receivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 79ef62068..8ab0de638 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -30,7 +30,7 @@ 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" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2" servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2" storagev1alpha1 "kubesphere.io/kubesphere/pkg/apis/storage/v1alpha1" @@ -133,27 +133,11 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case networkv1alpha1.SchemeGroupVersion.WithResource("namespacenetworkpolicies"): return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1alpha1().NamespaceNetworkPolicies().Informer()}, nil - // Group=notification.kubesphere.io, Version=v2alpha1 - case v2alpha1.SchemeGroupVersion.WithResource("dingtalkconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().DingTalkConfigs().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("dingtalkreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().DingTalkReceivers().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("emailconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().EmailConfigs().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("emailreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().EmailReceivers().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("slackconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().SlackConfigs().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("slackreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().SlackReceivers().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("webhookconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WebhookConfigs().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("webhookreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WebhookReceivers().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("wechatconfigs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WechatConfigs().Informer()}, nil - case v2alpha1.SchemeGroupVersion.WithResource("wechatreceivers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2alpha1().WechatReceivers().Informer()}, nil + // Group=notification.kubesphere.io, Version=v2beta1 + case v2beta1.SchemeGroupVersion.WithResource("configs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2beta1().Configs().Informer()}, nil + case v2beta1.SchemeGroupVersion.WithResource("receivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Notification().V2beta1().Receivers().Informer()}, nil // Group=quota.kubesphere.io, Version=v1alpha2 case quotav1alpha2.SchemeGroupVersion.WithResource("resourcequotas"): diff --git a/pkg/client/informers/externalversions/notification/interface.go b/pkg/client/informers/externalversions/notification/interface.go index 15992cecc..58de480dc 100644 --- a/pkg/client/informers/externalversions/notification/interface.go +++ b/pkg/client/informers/externalversions/notification/interface.go @@ -20,13 +20,13 @@ package notification import ( internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/notification/v2alpha1" + v2beta1 "kubesphere.io/kubesphere/pkg/client/informers/externalversions/notification/v2beta1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V2alpha1 provides access to shared informers for resources in V2alpha1. - V2alpha1() v2alpha1.Interface + // V2beta1 provides access to shared informers for resources in V2beta1. + V2beta1() v2beta1.Interface } type group struct { @@ -40,7 +40,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V2alpha1 returns a new v2alpha1.Interface. -func (g *group) V2alpha1() v2alpha1.Interface { - return v2alpha1.New(g.factory, g.namespace, g.tweakListOptions) +// V2beta1 returns a new v2beta1.Interface. +func (g *group) V2beta1() v2beta1.Interface { + return v2beta1.New(g.factory, g.namespace, g.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkconfig.go deleted file mode 100644 index 7cb150816..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkconfig.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// DingTalkConfigInformer provides access to a shared informer and lister for -// DingTalkConfigs. -type DingTalkConfigInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.DingTalkConfigLister -} - -type dingTalkConfigInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewDingTalkConfigInformer constructs a new informer for DingTalkConfig type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewDingTalkConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDingTalkConfigInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredDingTalkConfigInformer constructs a new informer for DingTalkConfig type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredDingTalkConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().DingTalkConfigs().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().DingTalkConfigs().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.DingTalkConfig{}, - resyncPeriod, - indexers, - ) -} - -func (f *dingTalkConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDingTalkConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *dingTalkConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.DingTalkConfig{}, f.defaultInformer) -} - -func (f *dingTalkConfigInformer) Lister() v2alpha1.DingTalkConfigLister { - return v2alpha1.NewDingTalkConfigLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkreceiver.go deleted file mode 100644 index 1607f3f77..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/dingtalkreceiver.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// DingTalkReceiverInformer provides access to a shared informer and lister for -// DingTalkReceivers. -type DingTalkReceiverInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.DingTalkReceiverLister -} - -type dingTalkReceiverInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewDingTalkReceiverInformer constructs a new informer for DingTalkReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewDingTalkReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDingTalkReceiverInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredDingTalkReceiverInformer constructs a new informer for DingTalkReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredDingTalkReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().DingTalkReceivers().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().DingTalkReceivers().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.DingTalkReceiver{}, - resyncPeriod, - indexers, - ) -} - -func (f *dingTalkReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDingTalkReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *dingTalkReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.DingTalkReceiver{}, f.defaultInformer) -} - -func (f *dingTalkReceiverInformer) Lister() v2alpha1.DingTalkReceiverLister { - return v2alpha1.NewDingTalkReceiverLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/emailreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/emailreceiver.go deleted file mode 100644 index bf109333e..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/emailreceiver.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// EmailReceiverInformer provides access to a shared informer and lister for -// EmailReceivers. -type EmailReceiverInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.EmailReceiverLister -} - -type emailReceiverInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewEmailReceiverInformer constructs a new informer for EmailReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewEmailReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEmailReceiverInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredEmailReceiverInformer constructs a new informer for EmailReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredEmailReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().EmailReceivers().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().EmailReceivers().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.EmailReceiver{}, - resyncPeriod, - indexers, - ) -} - -func (f *emailReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEmailReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *emailReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.EmailReceiver{}, f.defaultInformer) -} - -func (f *emailReceiverInformer) Lister() v2alpha1.EmailReceiverLister { - return v2alpha1.NewEmailReceiverLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/interface.go b/pkg/client/informers/externalversions/notification/v2alpha1/interface.go deleted file mode 100644 index b52c7460a..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/interface.go +++ /dev/null @@ -1,108 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // DingTalkConfigs returns a DingTalkConfigInformer. - DingTalkConfigs() DingTalkConfigInformer - // DingTalkReceivers returns a DingTalkReceiverInformer. - DingTalkReceivers() DingTalkReceiverInformer - // EmailConfigs returns a EmailConfigInformer. - EmailConfigs() EmailConfigInformer - // EmailReceivers returns a EmailReceiverInformer. - EmailReceivers() EmailReceiverInformer - // SlackConfigs returns a SlackConfigInformer. - SlackConfigs() SlackConfigInformer - // SlackReceivers returns a SlackReceiverInformer. - SlackReceivers() SlackReceiverInformer - // WebhookConfigs returns a WebhookConfigInformer. - WebhookConfigs() WebhookConfigInformer - // WebhookReceivers returns a WebhookReceiverInformer. - WebhookReceivers() WebhookReceiverInformer - // WechatConfigs returns a WechatConfigInformer. - WechatConfigs() WechatConfigInformer - // WechatReceivers returns a WechatReceiverInformer. - WechatReceivers() WechatReceiverInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// DingTalkConfigs returns a DingTalkConfigInformer. -func (v *version) DingTalkConfigs() DingTalkConfigInformer { - return &dingTalkConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// DingTalkReceivers returns a DingTalkReceiverInformer. -func (v *version) DingTalkReceivers() DingTalkReceiverInformer { - return &dingTalkReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// EmailConfigs returns a EmailConfigInformer. -func (v *version) EmailConfigs() EmailConfigInformer { - return &emailConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// EmailReceivers returns a EmailReceiverInformer. -func (v *version) EmailReceivers() EmailReceiverInformer { - return &emailReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// SlackConfigs returns a SlackConfigInformer. -func (v *version) SlackConfigs() SlackConfigInformer { - return &slackConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// SlackReceivers returns a SlackReceiverInformer. -func (v *version) SlackReceivers() SlackReceiverInformer { - return &slackReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// WebhookConfigs returns a WebhookConfigInformer. -func (v *version) WebhookConfigs() WebhookConfigInformer { - return &webhookConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// WebhookReceivers returns a WebhookReceiverInformer. -func (v *version) WebhookReceivers() WebhookReceiverInformer { - return &webhookReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// WechatConfigs returns a WechatConfigInformer. -func (v *version) WechatConfigs() WechatConfigInformer { - return &wechatConfigInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// WechatReceivers returns a WechatReceiverInformer. -func (v *version) WechatReceivers() WechatReceiverInformer { - return &wechatReceiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/slackreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/slackreceiver.go deleted file mode 100644 index 928e6ee44..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/slackreceiver.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// SlackReceiverInformer provides access to a shared informer and lister for -// SlackReceivers. -type SlackReceiverInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.SlackReceiverLister -} - -type slackReceiverInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewSlackReceiverInformer constructs a new informer for SlackReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewSlackReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSlackReceiverInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredSlackReceiverInformer constructs a new informer for SlackReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredSlackReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().SlackReceivers().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().SlackReceivers().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.SlackReceiver{}, - resyncPeriod, - indexers, - ) -} - -func (f *slackReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSlackReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *slackReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.SlackReceiver{}, f.defaultInformer) -} - -func (f *slackReceiverInformer) Lister() v2alpha1.SlackReceiverLister { - return v2alpha1.NewSlackReceiverLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/webhookconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/webhookconfig.go deleted file mode 100644 index 70ea50e47..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/webhookconfig.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// WebhookConfigInformer provides access to a shared informer and lister for -// WebhookConfigs. -type WebhookConfigInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.WebhookConfigLister -} - -type webhookConfigInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewWebhookConfigInformer constructs a new informer for WebhookConfig type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewWebhookConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredWebhookConfigInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredWebhookConfigInformer constructs a new informer for WebhookConfig type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredWebhookConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WebhookConfigs().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WebhookConfigs().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.WebhookConfig{}, - resyncPeriod, - indexers, - ) -} - -func (f *webhookConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredWebhookConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *webhookConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.WebhookConfig{}, f.defaultInformer) -} - -func (f *webhookConfigInformer) Lister() v2alpha1.WebhookConfigLister { - return v2alpha1.NewWebhookConfigLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/webhookreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/webhookreceiver.go deleted file mode 100644 index 5d9229d6a..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/webhookreceiver.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// WebhookReceiverInformer provides access to a shared informer and lister for -// WebhookReceivers. -type WebhookReceiverInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.WebhookReceiverLister -} - -type webhookReceiverInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewWebhookReceiverInformer constructs a new informer for WebhookReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewWebhookReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredWebhookReceiverInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredWebhookReceiverInformer constructs a new informer for WebhookReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredWebhookReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WebhookReceivers().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WebhookReceivers().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.WebhookReceiver{}, - resyncPeriod, - indexers, - ) -} - -func (f *webhookReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredWebhookReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *webhookReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.WebhookReceiver{}, f.defaultInformer) -} - -func (f *webhookReceiverInformer) Lister() v2alpha1.WebhookReceiverLister { - return v2alpha1.NewWebhookReceiverLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/wechatconfig.go b/pkg/client/informers/externalversions/notification/v2alpha1/wechatconfig.go deleted file mode 100644 index b17aac222..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/wechatconfig.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// WechatConfigInformer provides access to a shared informer and lister for -// WechatConfigs. -type WechatConfigInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.WechatConfigLister -} - -type wechatConfigInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewWechatConfigInformer constructs a new informer for WechatConfig type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewWechatConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredWechatConfigInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredWechatConfigInformer constructs a new informer for WechatConfig type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredWechatConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WechatConfigs().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WechatConfigs().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.WechatConfig{}, - resyncPeriod, - indexers, - ) -} - -func (f *wechatConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredWechatConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *wechatConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.WechatConfig{}, f.defaultInformer) -} - -func (f *wechatConfigInformer) Lister() v2alpha1.WechatConfigLister { - return v2alpha1.NewWechatConfigLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/wechatreceiver.go b/pkg/client/informers/externalversions/notification/v2alpha1/wechatreceiver.go deleted file mode 100644 index 9a6569297..000000000 --- a/pkg/client/informers/externalversions/notification/v2alpha1/wechatreceiver.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" - versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" -) - -// WechatReceiverInformer provides access to a shared informer and lister for -// WechatReceivers. -type WechatReceiverInformer interface { - Informer() cache.SharedIndexInformer - Lister() v2alpha1.WechatReceiverLister -} - -type wechatReceiverInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewWechatReceiverInformer constructs a new informer for WechatReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewWechatReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredWechatReceiverInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredWechatReceiverInformer constructs a new informer for WechatReceiver type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredWechatReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WechatReceivers().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.NotificationV2alpha1().WechatReceivers().Watch(context.TODO(), options) - }, - }, - ¬ificationv2alpha1.WechatReceiver{}, - resyncPeriod, - indexers, - ) -} - -func (f *wechatReceiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredWechatReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *wechatReceiverInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.WechatReceiver{}, f.defaultInformer) -} - -func (f *wechatReceiverInformer) Lister() v2alpha1.WechatReceiverLister { - return v2alpha1.NewWechatReceiverLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/emailconfig.go b/pkg/client/informers/externalversions/notification/v2beta1/config.go similarity index 52% rename from pkg/client/informers/externalversions/notification/v2alpha1/emailconfig.go rename to pkg/client/informers/externalversions/notification/v2beta1/config.go index 0762ea5d6..17f576409 100644 --- a/pkg/client/informers/externalversions/notification/v2alpha1/emailconfig.go +++ b/pkg/client/informers/externalversions/notification/v2beta1/config.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2alpha1 +package v2beta1 import ( "context" @@ -26,64 +26,64 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" + v2beta1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2beta1" ) -// EmailConfigInformer provides access to a shared informer and lister for -// EmailConfigs. -type EmailConfigInformer interface { +// ConfigInformer provides access to a shared informer and lister for +// Configs. +type ConfigInformer interface { Informer() cache.SharedIndexInformer - Lister() v2alpha1.EmailConfigLister + Lister() v2beta1.ConfigLister } -type emailConfigInformer struct { +type configInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } -// NewEmailConfigInformer constructs a new informer for EmailConfig type. +// NewConfigInformer constructs a new informer for Config type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewEmailConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEmailConfigInformer(client, resyncPeriod, indexers, nil) +func NewConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConfigInformer(client, resyncPeriod, indexers, nil) } -// NewFilteredEmailConfigInformer constructs a new informer for EmailConfig type. +// NewFilteredConfigInformer constructs a new informer for Config type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredEmailConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2alpha1().EmailConfigs().List(context.TODO(), options) + return client.NotificationV2beta1().Configs().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2alpha1().EmailConfigs().Watch(context.TODO(), options) + return client.NotificationV2beta1().Configs().Watch(context.TODO(), options) }, }, - ¬ificationv2alpha1.EmailConfig{}, + ¬ificationv2beta1.Config{}, resyncPeriod, indexers, ) } -func (f *emailConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEmailConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +func (f *configInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } -func (f *emailConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.EmailConfig{}, f.defaultInformer) +func (f *configInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2beta1.Config{}, f.defaultInformer) } -func (f *emailConfigInformer) Lister() v2alpha1.EmailConfigLister { - return v2alpha1.NewEmailConfigLister(f.Informer().GetIndexer()) +func (f *configInformer) Lister() v2beta1.ConfigLister { + return v2beta1.NewConfigLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/notification/v2beta1/interface.go b/pkg/client/informers/externalversions/notification/v2beta1/interface.go new file mode 100644 index 000000000..a429dca42 --- /dev/null +++ b/pkg/client/informers/externalversions/notification/v2beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta1 + +import ( + internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Configs returns a ConfigInformer. + Configs() ConfigInformer + // Receivers returns a ReceiverInformer. + Receivers() ReceiverInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Configs returns a ConfigInformer. +func (v *version) Configs() ConfigInformer { + return &configInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Receivers returns a ReceiverInformer. +func (v *version) Receivers() ReceiverInformer { + return &receiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/notification/v2alpha1/slackconfig.go b/pkg/client/informers/externalversions/notification/v2beta1/receiver.go similarity index 52% rename from pkg/client/informers/externalversions/notification/v2alpha1/slackconfig.go rename to pkg/client/informers/externalversions/notification/v2beta1/receiver.go index 317ead759..c984b7ec1 100644 --- a/pkg/client/informers/externalversions/notification/v2alpha1/slackconfig.go +++ b/pkg/client/informers/externalversions/notification/v2beta1/receiver.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v2alpha1 +package v2beta1 import ( "context" @@ -26,64 +26,64 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" cache "k8s.io/client-go/tools/cache" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned" internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces" - v2alpha1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2alpha1" + v2beta1 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2beta1" ) -// SlackConfigInformer provides access to a shared informer and lister for -// SlackConfigs. -type SlackConfigInformer interface { +// ReceiverInformer provides access to a shared informer and lister for +// Receivers. +type ReceiverInformer interface { Informer() cache.SharedIndexInformer - Lister() v2alpha1.SlackConfigLister + Lister() v2beta1.ReceiverLister } -type slackConfigInformer struct { +type receiverInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc } -// NewSlackConfigInformer constructs a new informer for SlackConfig type. +// NewReceiverInformer constructs a new informer for Receiver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewSlackConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSlackConfigInformer(client, resyncPeriod, indexers, nil) +func NewReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReceiverInformer(client, resyncPeriod, indexers, nil) } -// NewFilteredSlackConfigInformer constructs a new informer for SlackConfig type. +// NewFilteredReceiverInformer constructs a new informer for Receiver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredSlackConfigInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredReceiverInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2alpha1().SlackConfigs().List(context.TODO(), options) + return client.NotificationV2beta1().Receivers().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.NotificationV2alpha1().SlackConfigs().Watch(context.TODO(), options) + return client.NotificationV2beta1().Receivers().Watch(context.TODO(), options) }, }, - ¬ificationv2alpha1.SlackConfig{}, + ¬ificationv2beta1.Receiver{}, resyncPeriod, indexers, ) } -func (f *slackConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSlackConfigInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +func (f *receiverInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReceiverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } -func (f *slackConfigInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(¬ificationv2alpha1.SlackConfig{}, f.defaultInformer) +func (f *receiverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(¬ificationv2beta1.Receiver{}, f.defaultInformer) } -func (f *slackConfigInformer) Lister() v2alpha1.SlackConfigLister { - return v2alpha1.NewSlackConfigLister(f.Informer().GetIndexer()) +func (f *receiverInformer) Lister() v2beta1.ReceiverLister { + return v2beta1.NewReceiverLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/listers/notification/v2alpha1/dingtalkconfig.go b/pkg/client/listers/notification/v2alpha1/dingtalkconfig.go deleted file mode 100644 index 2e20720d0..000000000 --- a/pkg/client/listers/notification/v2alpha1/dingtalkconfig.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// DingTalkConfigLister helps list DingTalkConfigs. -type DingTalkConfigLister interface { - // List lists all DingTalkConfigs in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.DingTalkConfig, err error) - // Get retrieves the DingTalkConfig from the index for a given name. - Get(name string) (*v2alpha1.DingTalkConfig, error) - DingTalkConfigListerExpansion -} - -// dingTalkConfigLister implements the DingTalkConfigLister interface. -type dingTalkConfigLister struct { - indexer cache.Indexer -} - -// NewDingTalkConfigLister returns a new DingTalkConfigLister. -func NewDingTalkConfigLister(indexer cache.Indexer) DingTalkConfigLister { - return &dingTalkConfigLister{indexer: indexer} -} - -// List lists all DingTalkConfigs in the indexer. -func (s *dingTalkConfigLister) List(selector labels.Selector) (ret []*v2alpha1.DingTalkConfig, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.DingTalkConfig)) - }) - return ret, err -} - -// Get retrieves the DingTalkConfig from the index for a given name. -func (s *dingTalkConfigLister) Get(name string) (*v2alpha1.DingTalkConfig, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("dingtalkconfig"), name) - } - return obj.(*v2alpha1.DingTalkConfig), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/dingtalkreceiver.go b/pkg/client/listers/notification/v2alpha1/dingtalkreceiver.go deleted file mode 100644 index 7019aeb46..000000000 --- a/pkg/client/listers/notification/v2alpha1/dingtalkreceiver.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// DingTalkReceiverLister helps list DingTalkReceivers. -type DingTalkReceiverLister interface { - // List lists all DingTalkReceivers in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.DingTalkReceiver, err error) - // Get retrieves the DingTalkReceiver from the index for a given name. - Get(name string) (*v2alpha1.DingTalkReceiver, error) - DingTalkReceiverListerExpansion -} - -// dingTalkReceiverLister implements the DingTalkReceiverLister interface. -type dingTalkReceiverLister struct { - indexer cache.Indexer -} - -// NewDingTalkReceiverLister returns a new DingTalkReceiverLister. -func NewDingTalkReceiverLister(indexer cache.Indexer) DingTalkReceiverLister { - return &dingTalkReceiverLister{indexer: indexer} -} - -// List lists all DingTalkReceivers in the indexer. -func (s *dingTalkReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.DingTalkReceiver, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.DingTalkReceiver)) - }) - return ret, err -} - -// Get retrieves the DingTalkReceiver from the index for a given name. -func (s *dingTalkReceiverLister) Get(name string) (*v2alpha1.DingTalkReceiver, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("dingtalkreceiver"), name) - } - return obj.(*v2alpha1.DingTalkReceiver), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/emailconfig.go b/pkg/client/listers/notification/v2alpha1/emailconfig.go deleted file mode 100644 index 7894a2431..000000000 --- a/pkg/client/listers/notification/v2alpha1/emailconfig.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// EmailConfigLister helps list EmailConfigs. -type EmailConfigLister interface { - // List lists all EmailConfigs in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.EmailConfig, err error) - // Get retrieves the EmailConfig from the index for a given name. - Get(name string) (*v2alpha1.EmailConfig, error) - EmailConfigListerExpansion -} - -// emailConfigLister implements the EmailConfigLister interface. -type emailConfigLister struct { - indexer cache.Indexer -} - -// NewEmailConfigLister returns a new EmailConfigLister. -func NewEmailConfigLister(indexer cache.Indexer) EmailConfigLister { - return &emailConfigLister{indexer: indexer} -} - -// List lists all EmailConfigs in the indexer. -func (s *emailConfigLister) List(selector labels.Selector) (ret []*v2alpha1.EmailConfig, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.EmailConfig)) - }) - return ret, err -} - -// Get retrieves the EmailConfig from the index for a given name. -func (s *emailConfigLister) Get(name string) (*v2alpha1.EmailConfig, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("emailconfig"), name) - } - return obj.(*v2alpha1.EmailConfig), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/emailreceiver.go b/pkg/client/listers/notification/v2alpha1/emailreceiver.go deleted file mode 100644 index d5d01e124..000000000 --- a/pkg/client/listers/notification/v2alpha1/emailreceiver.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// EmailReceiverLister helps list EmailReceivers. -type EmailReceiverLister interface { - // List lists all EmailReceivers in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.EmailReceiver, err error) - // Get retrieves the EmailReceiver from the index for a given name. - Get(name string) (*v2alpha1.EmailReceiver, error) - EmailReceiverListerExpansion -} - -// emailReceiverLister implements the EmailReceiverLister interface. -type emailReceiverLister struct { - indexer cache.Indexer -} - -// NewEmailReceiverLister returns a new EmailReceiverLister. -func NewEmailReceiverLister(indexer cache.Indexer) EmailReceiverLister { - return &emailReceiverLister{indexer: indexer} -} - -// List lists all EmailReceivers in the indexer. -func (s *emailReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.EmailReceiver, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.EmailReceiver)) - }) - return ret, err -} - -// Get retrieves the EmailReceiver from the index for a given name. -func (s *emailReceiverLister) Get(name string) (*v2alpha1.EmailReceiver, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("emailreceiver"), name) - } - return obj.(*v2alpha1.EmailReceiver), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/expansion_generated.go b/pkg/client/listers/notification/v2alpha1/expansion_generated.go deleted file mode 100644 index 5d736045e..000000000 --- a/pkg/client/listers/notification/v2alpha1/expansion_generated.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -// DingTalkConfigListerExpansion allows custom methods to be added to -// DingTalkConfigLister. -type DingTalkConfigListerExpansion interface{} - -// DingTalkReceiverListerExpansion allows custom methods to be added to -// DingTalkReceiverLister. -type DingTalkReceiverListerExpansion interface{} - -// EmailConfigListerExpansion allows custom methods to be added to -// EmailConfigLister. -type EmailConfigListerExpansion interface{} - -// EmailReceiverListerExpansion allows custom methods to be added to -// EmailReceiverLister. -type EmailReceiverListerExpansion interface{} - -// SlackConfigListerExpansion allows custom methods to be added to -// SlackConfigLister. -type SlackConfigListerExpansion interface{} - -// SlackReceiverListerExpansion allows custom methods to be added to -// SlackReceiverLister. -type SlackReceiverListerExpansion interface{} - -// WebhookConfigListerExpansion allows custom methods to be added to -// WebhookConfigLister. -type WebhookConfigListerExpansion interface{} - -// WebhookReceiverListerExpansion allows custom methods to be added to -// WebhookReceiverLister. -type WebhookReceiverListerExpansion interface{} - -// WechatConfigListerExpansion allows custom methods to be added to -// WechatConfigLister. -type WechatConfigListerExpansion interface{} - -// WechatReceiverListerExpansion allows custom methods to be added to -// WechatReceiverLister. -type WechatReceiverListerExpansion interface{} diff --git a/pkg/client/listers/notification/v2alpha1/slackconfig.go b/pkg/client/listers/notification/v2alpha1/slackconfig.go deleted file mode 100644 index 3509986ab..000000000 --- a/pkg/client/listers/notification/v2alpha1/slackconfig.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// SlackConfigLister helps list SlackConfigs. -type SlackConfigLister interface { - // List lists all SlackConfigs in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.SlackConfig, err error) - // Get retrieves the SlackConfig from the index for a given name. - Get(name string) (*v2alpha1.SlackConfig, error) - SlackConfigListerExpansion -} - -// slackConfigLister implements the SlackConfigLister interface. -type slackConfigLister struct { - indexer cache.Indexer -} - -// NewSlackConfigLister returns a new SlackConfigLister. -func NewSlackConfigLister(indexer cache.Indexer) SlackConfigLister { - return &slackConfigLister{indexer: indexer} -} - -// List lists all SlackConfigs in the indexer. -func (s *slackConfigLister) List(selector labels.Selector) (ret []*v2alpha1.SlackConfig, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.SlackConfig)) - }) - return ret, err -} - -// Get retrieves the SlackConfig from the index for a given name. -func (s *slackConfigLister) Get(name string) (*v2alpha1.SlackConfig, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("slackconfig"), name) - } - return obj.(*v2alpha1.SlackConfig), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/slackreceiver.go b/pkg/client/listers/notification/v2alpha1/slackreceiver.go deleted file mode 100644 index ff46ab040..000000000 --- a/pkg/client/listers/notification/v2alpha1/slackreceiver.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// SlackReceiverLister helps list SlackReceivers. -type SlackReceiverLister interface { - // List lists all SlackReceivers in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.SlackReceiver, err error) - // Get retrieves the SlackReceiver from the index for a given name. - Get(name string) (*v2alpha1.SlackReceiver, error) - SlackReceiverListerExpansion -} - -// slackReceiverLister implements the SlackReceiverLister interface. -type slackReceiverLister struct { - indexer cache.Indexer -} - -// NewSlackReceiverLister returns a new SlackReceiverLister. -func NewSlackReceiverLister(indexer cache.Indexer) SlackReceiverLister { - return &slackReceiverLister{indexer: indexer} -} - -// List lists all SlackReceivers in the indexer. -func (s *slackReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.SlackReceiver, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.SlackReceiver)) - }) - return ret, err -} - -// Get retrieves the SlackReceiver from the index for a given name. -func (s *slackReceiverLister) Get(name string) (*v2alpha1.SlackReceiver, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("slackreceiver"), name) - } - return obj.(*v2alpha1.SlackReceiver), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/webhookconfig.go b/pkg/client/listers/notification/v2alpha1/webhookconfig.go deleted file mode 100644 index 8e87599da..000000000 --- a/pkg/client/listers/notification/v2alpha1/webhookconfig.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// WebhookConfigLister helps list WebhookConfigs. -type WebhookConfigLister interface { - // List lists all WebhookConfigs in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.WebhookConfig, err error) - // Get retrieves the WebhookConfig from the index for a given name. - Get(name string) (*v2alpha1.WebhookConfig, error) - WebhookConfigListerExpansion -} - -// webhookConfigLister implements the WebhookConfigLister interface. -type webhookConfigLister struct { - indexer cache.Indexer -} - -// NewWebhookConfigLister returns a new WebhookConfigLister. -func NewWebhookConfigLister(indexer cache.Indexer) WebhookConfigLister { - return &webhookConfigLister{indexer: indexer} -} - -// List lists all WebhookConfigs in the indexer. -func (s *webhookConfigLister) List(selector labels.Selector) (ret []*v2alpha1.WebhookConfig, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.WebhookConfig)) - }) - return ret, err -} - -// Get retrieves the WebhookConfig from the index for a given name. -func (s *webhookConfigLister) Get(name string) (*v2alpha1.WebhookConfig, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("webhookconfig"), name) - } - return obj.(*v2alpha1.WebhookConfig), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/webhookreceiver.go b/pkg/client/listers/notification/v2alpha1/webhookreceiver.go deleted file mode 100644 index 2a207cfb3..000000000 --- a/pkg/client/listers/notification/v2alpha1/webhookreceiver.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// WebhookReceiverLister helps list WebhookReceivers. -type WebhookReceiverLister interface { - // List lists all WebhookReceivers in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.WebhookReceiver, err error) - // Get retrieves the WebhookReceiver from the index for a given name. - Get(name string) (*v2alpha1.WebhookReceiver, error) - WebhookReceiverListerExpansion -} - -// webhookReceiverLister implements the WebhookReceiverLister interface. -type webhookReceiverLister struct { - indexer cache.Indexer -} - -// NewWebhookReceiverLister returns a new WebhookReceiverLister. -func NewWebhookReceiverLister(indexer cache.Indexer) WebhookReceiverLister { - return &webhookReceiverLister{indexer: indexer} -} - -// List lists all WebhookReceivers in the indexer. -func (s *webhookReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.WebhookReceiver, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.WebhookReceiver)) - }) - return ret, err -} - -// Get retrieves the WebhookReceiver from the index for a given name. -func (s *webhookReceiverLister) Get(name string) (*v2alpha1.WebhookReceiver, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("webhookreceiver"), name) - } - return obj.(*v2alpha1.WebhookReceiver), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/wechatconfig.go b/pkg/client/listers/notification/v2alpha1/wechatconfig.go deleted file mode 100644 index 431a36631..000000000 --- a/pkg/client/listers/notification/v2alpha1/wechatconfig.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// WechatConfigLister helps list WechatConfigs. -type WechatConfigLister interface { - // List lists all WechatConfigs in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.WechatConfig, err error) - // Get retrieves the WechatConfig from the index for a given name. - Get(name string) (*v2alpha1.WechatConfig, error) - WechatConfigListerExpansion -} - -// wechatConfigLister implements the WechatConfigLister interface. -type wechatConfigLister struct { - indexer cache.Indexer -} - -// NewWechatConfigLister returns a new WechatConfigLister. -func NewWechatConfigLister(indexer cache.Indexer) WechatConfigLister { - return &wechatConfigLister{indexer: indexer} -} - -// List lists all WechatConfigs in the indexer. -func (s *wechatConfigLister) List(selector labels.Selector) (ret []*v2alpha1.WechatConfig, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.WechatConfig)) - }) - return ret, err -} - -// Get retrieves the WechatConfig from the index for a given name. -func (s *wechatConfigLister) Get(name string) (*v2alpha1.WechatConfig, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("wechatconfig"), name) - } - return obj.(*v2alpha1.WechatConfig), nil -} diff --git a/pkg/client/listers/notification/v2alpha1/wechatreceiver.go b/pkg/client/listers/notification/v2alpha1/wechatreceiver.go deleted file mode 100644 index 9365e2f21..000000000 --- a/pkg/client/listers/notification/v2alpha1/wechatreceiver.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" -) - -// WechatReceiverLister helps list WechatReceivers. -type WechatReceiverLister interface { - // List lists all WechatReceivers in the indexer. - List(selector labels.Selector) (ret []*v2alpha1.WechatReceiver, err error) - // Get retrieves the WechatReceiver from the index for a given name. - Get(name string) (*v2alpha1.WechatReceiver, error) - WechatReceiverListerExpansion -} - -// wechatReceiverLister implements the WechatReceiverLister interface. -type wechatReceiverLister struct { - indexer cache.Indexer -} - -// NewWechatReceiverLister returns a new WechatReceiverLister. -func NewWechatReceiverLister(indexer cache.Indexer) WechatReceiverLister { - return &wechatReceiverLister{indexer: indexer} -} - -// List lists all WechatReceivers in the indexer. -func (s *wechatReceiverLister) List(selector labels.Selector) (ret []*v2alpha1.WechatReceiver, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v2alpha1.WechatReceiver)) - }) - return ret, err -} - -// Get retrieves the WechatReceiver from the index for a given name. -func (s *wechatReceiverLister) Get(name string) (*v2alpha1.WechatReceiver, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v2alpha1.Resource("wechatreceiver"), name) - } - return obj.(*v2alpha1.WechatReceiver), nil -} diff --git a/pkg/client/listers/notification/v2beta1/config.go b/pkg/client/listers/notification/v2beta1/config.go new file mode 100644 index 000000000..00755435f --- /dev/null +++ b/pkg/client/listers/notification/v2beta1/config.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" +) + +// ConfigLister helps list Configs. +type ConfigLister interface { + // List lists all Configs in the indexer. + List(selector labels.Selector) (ret []*v2beta1.Config, err error) + // Get retrieves the Config from the index for a given name. + Get(name string) (*v2beta1.Config, error) + ConfigListerExpansion +} + +// configLister implements the ConfigLister interface. +type configLister struct { + indexer cache.Indexer +} + +// NewConfigLister returns a new ConfigLister. +func NewConfigLister(indexer cache.Indexer) ConfigLister { + return &configLister{indexer: indexer} +} + +// List lists all Configs in the indexer. +func (s *configLister) List(selector labels.Selector) (ret []*v2beta1.Config, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta1.Config)) + }) + return ret, err +} + +// Get retrieves the Config from the index for a given name. +func (s *configLister) Get(name string) (*v2beta1.Config, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta1.Resource("config"), name) + } + return obj.(*v2beta1.Config), nil +} diff --git a/pkg/client/listers/notification/v2beta1/expansion_generated.go b/pkg/client/listers/notification/v2beta1/expansion_generated.go new file mode 100644 index 000000000..76a2eee04 --- /dev/null +++ b/pkg/client/listers/notification/v2beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta1 + +// ConfigListerExpansion allows custom methods to be added to +// ConfigLister. +type ConfigListerExpansion interface{} + +// ReceiverListerExpansion allows custom methods to be added to +// ReceiverLister. +type ReceiverListerExpansion interface{} diff --git a/pkg/client/listers/notification/v2beta1/receiver.go b/pkg/client/listers/notification/v2beta1/receiver.go new file mode 100644 index 000000000..14d2498ea --- /dev/null +++ b/pkg/client/listers/notification/v2beta1/receiver.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The KubeSphere Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" +) + +// ReceiverLister helps list Receivers. +type ReceiverLister interface { + // List lists all Receivers in the indexer. + List(selector labels.Selector) (ret []*v2beta1.Receiver, err error) + // Get retrieves the Receiver from the index for a given name. + Get(name string) (*v2beta1.Receiver, error) + ReceiverListerExpansion +} + +// receiverLister implements the ReceiverLister interface. +type receiverLister struct { + indexer cache.Indexer +} + +// NewReceiverLister returns a new ReceiverLister. +func NewReceiverLister(indexer cache.Indexer) ReceiverLister { + return &receiverLister{indexer: indexer} +} + +// List lists all Receivers in the indexer. +func (s *receiverLister) List(selector labels.Selector) (ret []*v2beta1.Receiver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta1.Receiver)) + }) + return ret, err +} + +// Get retrieves the Receiver from the index for a given name. +func (s *receiverLister) Get(name string) (*v2beta1.Receiver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta1.Resource("receiver"), name) + } + return obj.(*v2beta1.Receiver), nil +} diff --git a/pkg/controller/notification/notification_controller.go b/pkg/controller/notification/notification_controller.go index afef76589..3877fa999 100644 --- a/pkg/controller/notification/notification_controller.go +++ b/pkg/controller/notification/notification_controller.go @@ -33,7 +33,7 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" "k8s.io/klog" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" "kubesphere.io/kubesphere/pkg/constants" "reflect" @@ -95,16 +95,8 @@ func (c *Controller) setEventHandlers() error { if c.reconciledObjs != nil && len(c.reconciledObjs) > 0 { c.reconciledObjs = c.reconciledObjs[:0] } - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.DingTalkConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.DingTalkReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.EmailConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.EmailReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.SlackConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.SlackReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WebhookConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WebhookReceiver{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WechatConfig{}) - c.reconciledObjs = append(c.reconciledObjs, &v2alpha1.WechatReceiver{}) + c.reconciledObjs = append(c.reconciledObjs, &v2beta1.Config{}) + c.reconciledObjs = append(c.reconciledObjs, &v2beta1.Receiver{}) c.reconciledObjs = append(c.reconciledObjs, &corev1.Secret{}) if c.informerSynced != nil && len(c.informerSynced) > 0 { @@ -269,26 +261,10 @@ func (c *Controller) multiClusterSync(ctx context.Context, obj runtime.Object) e } switch obj.(type) { - case *v2alpha1.DingTalkConfig: - return c.syncFederatedDingTalkConfig(obj.(*v2alpha1.DingTalkConfig)) - case *v2alpha1.DingTalkReceiver: - return c.syncFederatedDingTalkReceiver(obj.(*v2alpha1.DingTalkReceiver)) - case *v2alpha1.EmailConfig: - return c.syncFederatedEmailConfig(obj.(*v2alpha1.EmailConfig)) - case *v2alpha1.EmailReceiver: - return c.syncFederatedEmailReceiver(obj.(*v2alpha1.EmailReceiver)) - case *v2alpha1.SlackConfig: - return c.syncFederatedSlackConfig(obj.(*v2alpha1.SlackConfig)) - case *v2alpha1.SlackReceiver: - return c.syncFederatedSlackReceiver(obj.(*v2alpha1.SlackReceiver)) - case *v2alpha1.WebhookConfig: - return c.syncFederatedWebhookConfig(obj.(*v2alpha1.WebhookConfig)) - case *v2alpha1.WebhookReceiver: - return c.syncFederatedWebhookReceiver(obj.(*v2alpha1.WebhookReceiver)) - case *v2alpha1.WechatConfig: - return c.syncFederatedWechatConfig(obj.(*v2alpha1.WechatConfig)) - case *v2alpha1.WechatReceiver: - return c.syncFederatedWechatReceiver(obj.(*v2alpha1.WechatReceiver)) + case *v2beta1.Config: + return c.syncFederatedConfig(obj.(*v2beta1.Config)) + case *v2beta1.Receiver: + return c.syncFederatedReceiver(obj.(*v2beta1.Receiver)) case *corev1.Secret: return c.syncFederatedSecret(obj.(*corev1.Secret)) default: @@ -297,22 +273,22 @@ func (c *Controller) multiClusterSync(ctx context.Context, obj runtime.Object) e } } -func (c *Controller) syncFederatedDingTalkConfig(obj *v2alpha1.DingTalkConfig) error { +func (c *Controller) syncFederatedConfig(obj *v2beta1.Config) error { - fedObj := &v1beta1.FederatedDingTalkConfig{} + fedObj := &v1beta1.FederatedNotificationConfig{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) if err != nil { if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedDingTalkConfig{ + fedObj = &v1beta1.FederatedNotificationConfig{ TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedDingTalkConfigKind, + Kind: v1beta1.FederatedNotificationConfigKind, APIVersion: v1beta1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: obj.Name, }, - Spec: v1beta1.FederatedDingTalkConfigSpec{ - Template: v1beta1.DingTalkConfigTemplate{ + Spec: v1beta1.FederatedNotificationConfigSpec{ + Template: v1beta1.NotificationConfigTemplate{ ObjectMeta: metav1.ObjectMeta{ Labels: obj.Labels, }, @@ -353,470 +329,22 @@ func (c *Controller) syncFederatedDingTalkConfig(obj *v2alpha1.DingTalkConfig) e return nil } -func (c *Controller) syncFederatedDingTalkReceiver(obj *v2alpha1.DingTalkReceiver) error { +func (c *Controller) syncFederatedReceiver(obj *v2beta1.Receiver) error { - fedObj := &v1beta1.FederatedDingTalkReceiver{} + fedObj := &v1beta1.FederatedNotificationReceiver{} err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) if err != nil { if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedDingTalkReceiver{ + fedObj = &v1beta1.FederatedNotificationReceiver{ TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedDingTalkReceiverKind, + Kind: v1beta1.FederatedNotificationReceiverKind, APIVersion: v1beta1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: obj.Name, }, - Spec: v1beta1.FederatedDingTalkReceiverSpec{ - Template: v1beta1.DingTalkReceiverTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedEmailConfig(obj *v2alpha1.EmailConfig) error { - - fedObj := &v1beta1.FederatedEmailConfig{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedEmailConfig{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedEmailConfigKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedEmailConfigSpec{ - Template: v1beta1.EmailConfigTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedEmailReceiver(obj *v2alpha1.EmailReceiver) error { - - fedObj := &v1beta1.FederatedEmailReceiver{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedEmailReceiver{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedEmailReceiverKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedEmailReceiverSpec{ - Template: v1beta1.EmailReceiverTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedSlackConfig(obj *v2alpha1.SlackConfig) error { - - fedObj := &v1beta1.FederatedSlackConfig{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedSlackConfig{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedSlackConfigKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedSlackConfigSpec{ - Template: v1beta1.SlackConfigTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedSlackReceiver(obj *v2alpha1.SlackReceiver) error { - - fedObj := &v1beta1.FederatedSlackReceiver{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedSlackReceiver{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedSlackReceiverKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedSlackReceiverSpec{ - Template: v1beta1.SlackReceiverTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedWebhookConfig(obj *v2alpha1.WebhookConfig) error { - - fedObj := &v1beta1.FederatedWebhookConfig{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedWebhookConfig{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedWebhookConfigKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedWebhookConfigSpec{ - Template: v1beta1.WebhookConfigTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedWebhookReceiver(obj *v2alpha1.WebhookReceiver) error { - - fedObj := &v1beta1.FederatedWebhookReceiver{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedWebhookReceiver{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedWebhookReceiverKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedWebhookReceiverSpec{ - Template: v1beta1.WebhookReceiverTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedWechatConfig(obj *v2alpha1.WechatConfig) error { - - fedObj := &v1beta1.FederatedWechatConfig{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedWechatConfig{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedWechatConfigKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedWechatConfigSpec{ - Template: v1beta1.WechatConfigTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: obj.Labels, - }, - Spec: obj.Spec, - }, - Placement: v1beta1.GenericPlacementFields{ - ClusterSelector: &metav1.LabelSelector{}, - }, - }, - } - - err := controllerutil.SetControllerReference(obj, fedObj, scheme.Scheme) - if err != nil { - return err - } - if err := c.Create(context.Background(), fedObj); err != nil { - klog.Errorf("create '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - - return nil - } - klog.Error(err) - return err - } - - if !reflect.DeepEqual(fedObj.Spec.Template.Labels, obj.Labels) || !reflect.DeepEqual(fedObj.Spec.Template.Spec, obj.Spec) { - - fedObj.Spec.Template.Spec = obj.Spec - fedObj.Spec.Template.Labels = obj.Labels - - if err := c.Update(context.Background(), fedObj); err != nil { - klog.Errorf("update '%s:%s' failed, %s", fedObj.GetObjectKind().GroupVersionKind().String(), obj.Name, err) - return err - } - } - - return nil -} - -func (c *Controller) syncFederatedWechatReceiver(obj *v2alpha1.WechatReceiver) error { - - fedObj := &v1beta1.FederatedWechatReceiver{} - err := c.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) - if err != nil { - if errors.IsNotFound(err) { - fedObj = &v1beta1.FederatedWechatReceiver{ - TypeMeta: metav1.TypeMeta{ - Kind: v1beta1.FederatedWechatReceiverKind, - APIVersion: v1beta1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: obj.Name, - }, - Spec: v1beta1.FederatedWechatReceiverSpec{ - Template: v1beta1.WechatReceiverTemplate{ + Spec: v1beta1.FederatedNotificationReceiverSpec{ + Template: v1beta1.NotificationReceiverTemplate{ ObjectMeta: metav1.ObjectMeta{ Labels: obj.Labels, }, diff --git a/pkg/controller/notification/notification_controller_suite_test.go b/pkg/controller/notification/notification_controller_suite_test.go index 3ddba360f..cee2730cd 100644 --- a/pkg/controller/notification/notification_controller_suite_test.go +++ b/pkg/controller/notification/notification_controller_suite_test.go @@ -20,7 +20,7 @@ import ( "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/scheme" "kubesphere.io/kubesphere/pkg/apis" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" "path/filepath" "testing" @@ -53,7 +53,7 @@ var _ = BeforeSuite(func(done Done) { Expect(err).NotTo(HaveOccurred()) Expect(cfg).ToNot(BeNil()) - err = v2alpha1.AddToScheme(scheme.Scheme) + err = v2beta1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) err = apis.AddToScheme(scheme.Scheme) diff --git a/pkg/controller/notification/notification_controller_test.go b/pkg/controller/notification/notification_controller_test.go index 4bc0a1d9c..d3d317114 100644 --- a/pkg/controller/notification/notification_controller_test.go +++ b/pkg/controller/notification/notification_controller_test.go @@ -23,7 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" "kubesphere.io/kubesphere/pkg/constants" "sigs.k8s.io/controller-runtime/pkg/cache" @@ -126,7 +126,7 @@ var ( const timeout = time.Second * 30 const interval = time.Second * 1 - obj := &v2alpha1.DingTalkConfig{ + obj := &v2beta1.Config{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", Namespace: constants.NotificationSecretNamespace, @@ -175,7 +175,7 @@ var ( Expect(cl.Create(context.Background(), obj)).Should(Succeed()) time.Sleep(time.Second) - fedObj := &v1beta1.FederatedDingTalkConfig{} + fedObj := &v1beta1.FederatedNotificationConfig{} By("Expecting to create federated object successfully") Eventually(func() bool { err := ksCache.Get(context.Background(), client.ObjectKey{Name: obj.Name}, fedObj) diff --git a/pkg/kapis/notification/v2alpha1/handler.go b/pkg/kapis/notification/v2beta1/handler.go similarity index 86% rename from pkg/kapis/notification/v2alpha1/handler.go rename to pkg/kapis/notification/v2beta1/handler.go index f7ca1aa1d..39ed02e5a 100644 --- a/pkg/kapis/notification/v2alpha1/handler.go +++ b/pkg/kapis/notification/v2beta1/handler.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2alpha1 +package v2beta1 import ( "github.com/emicklei/go-restful" @@ -47,14 +47,15 @@ func (h *handler) ListResource(req *restful.Request, resp *restful.Response) { user := req.PathParameter("user") resource := req.PathParameter("resources") + subresource := req.QueryParameter("type") q := query.ParseQueryParameter(req) - if !h.operator.IsKnownResource(resource) { - api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) + if !h.operator.IsKnownResource(resource, subresource) { + api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s/%s", resource, subresource)) return } - objs, err := h.operator.List(user, resource, q) + objs, err := h.operator.List(user, resource, subresource, q) handleResponse(req, resp, objs, err) } @@ -63,13 +64,14 @@ func (h *handler) GetResource(req *restful.Request, resp *restful.Response) { user := req.PathParameter("user") resource := req.PathParameter("resources") name := req.PathParameter("name") + subresource := req.QueryParameter("type") - if !h.operator.IsKnownResource(resource) { - api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) + if !h.operator.IsKnownResource(resource, subresource) { + api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s/%s", resource, subresource)) return } - obj, err := h.operator.Get(user, resource, name) + obj, err := h.operator.Get(user, resource, name, subresource) handleResponse(req, resp, obj, err) } @@ -78,7 +80,7 @@ func (h *handler) CreateResource(req *restful.Request, resp *restful.Response) { user := req.PathParameter("user") resource := req.PathParameter("resources") - if !h.operator.IsKnownResource(resource) { + if !h.operator.IsKnownResource(resource, "") { api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) return } @@ -99,7 +101,7 @@ func (h *handler) UpdateResource(req *restful.Request, resp *restful.Response) { resource := req.PathParameter("resources") name := req.PathParameter("name") - if !h.operator.IsKnownResource(resource) { + if !h.operator.IsKnownResource(resource, "") { api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) return } @@ -120,7 +122,7 @@ func (h *handler) DeleteResource(req *restful.Request, resp *restful.Response) { resource := req.PathParameter("resources") name := req.PathParameter("name") - if !h.operator.IsKnownResource(resource) { + if !h.operator.IsKnownResource(resource, "") { api.HandleBadRequest(resp, req, servererr.New("unknown resource type %s", resource)) return } diff --git a/pkg/kapis/notification/v2alpha1/register.go b/pkg/kapis/notification/v2beta1/register.go similarity index 66% rename from pkg/kapis/notification/v2alpha1/register.go rename to pkg/kapis/notification/v2beta1/register.go index f93fbdafc..a9d4a65a2 100644 --- a/pkg/kapis/notification/v2alpha1/register.go +++ b/pkg/kapis/notification/v2beta1/register.go @@ -16,7 +16,7 @@ */ -package v2alpha1 +package v2beta1 import ( "github.com/emicklei/go-restful" @@ -38,7 +38,7 @@ const ( KeyOpenAPITags = openapi.KeyOpenAPITags ) -var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2alpha1"} +var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2beta1"} func AddToContainer( container *restful.Container, @@ -54,9 +54,10 @@ func AddToContainer( To(h.ListResource). Doc("list the notification configs or receivers"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). + Param(ws.QueryParameter("type", "config or receiver type, known values include dingtalk, email, slack, webhook, wechat").Required(false)). Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). @@ -67,31 +68,32 @@ func AddToContainer( To(h.GetResource). Doc("get the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). - Param(ws.PathParameter("name", "the name of the resource")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). + Param(ws.PathParameter(query.ParameterName, "the name of the resource")). + Param(ws.QueryParameter("type", "config or receiver type, known values include dingtalk, email, slack, webhook, wechat").Required(false)). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.POST("/{resources}"). To(h.CreateResource). Doc("create a notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resource", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.PUT("/{resources}/{name}"). To(h.UpdateResource). Doc("update the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). - Param(ws.PathParameter("name", "the name of the resource")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). + Param(ws.PathParameter(query.ParameterName, "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.DELETE("/{resources}/{name}"). To(h.DeleteResource). Doc("delete the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). - Param(ws.PathParameter("name", "the name of the resource")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). + Param(ws.PathParameter(query.ParameterName, "the name of the resource")). Returns(http.StatusOK, api.StatusOK, errors.None)) // apis for tenant notification config and receiver @@ -100,9 +102,10 @@ func AddToContainer( Doc("list the notification configs or receivers"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). Param(ws.QueryParameter(query.ParameterName, "name used for filtering").Required(false)). Param(ws.QueryParameter(query.ParameterLabelSelector, "label selector used for filtering").Required(false)). + Param(ws.QueryParameter("type", "config or receiver type, known values include dingtalk, email, slack, webhook, wechat").Required(false)). Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). @@ -114,8 +117,9 @@ func AddToContainer( Doc("get the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). - Param(ws.PathParameter("name", "the name of the resource")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). + Param(ws.PathParameter(query.ParameterName, "the name of the resource")). + Param(ws.QueryParameter("type", "config or receiver type, known values include dingtalk, email, slack, webhook, wechat").Required(false)). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.POST("/users/{user}/{resources}"). @@ -123,6 +127,7 @@ func AddToContainer( Doc("create the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.PUT("/users/{user}/{resources}/{name}"). @@ -130,8 +135,8 @@ func AddToContainer( Doc("update the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification configs or receivers, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). - Param(ws.PathParameter("name", "the name of the resource")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). + Param(ws.PathParameter(query.ParameterName, "the name of the resource")). Returns(http.StatusOK, api.StatusOK, nil)) ws.Route(ws.DELETE("/users/{user}/{resources}/{name}"). @@ -139,8 +144,8 @@ func AddToContainer( Doc("delete the specified notification config or receiver"). Metadata(KeyOpenAPITags, []string{constants.NotificationTag}). Param(ws.PathParameter("user", "user name")). - Param(ws.PathParameter("resources", "notification config or receiver, known values include dingtalkconfigs, dingtalkreceivers, emailconfigs. emailreceivers, slackconfigs, slackreceivers, webhookconfigs, webhookreceivers, wechatconfigs, wechatreceivers, secrets")). - Param(ws.PathParameter("name", "the name of the resource")). + Param(ws.PathParameter("resources", "known values include configs, receivers, secrets")). + Param(ws.PathParameter(query.ParameterName, "the name of the resource")). Returns(http.StatusOK, api.StatusOK, errors.None)) container.Add(ws) diff --git a/pkg/models/notification/notification.go b/pkg/models/notification/notification.go index 807389f4f..69bdc3228 100644 --- a/pkg/models/notification/notification.go +++ b/pkg/models/notification/notification.go @@ -11,23 +11,24 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/klog" "kubesphere.io/kubesphere/pkg/api" - v2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" "kubesphere.io/kubesphere/pkg/apiserver/query" kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned" "kubesphere.io/kubesphere/pkg/constants" "kubesphere.io/kubesphere/pkg/informers" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3/resource" + "reflect" ) type Operator interface { - List(user, resource string, query *query.Query) (*api.ListResult, error) - Get(user, resource, name string) (runtime.Object, error) + List(user, resource, subresource string, query *query.Query) (*api.ListResult, error) + Get(user, resource, name, subresource string) (runtime.Object, error) Create(user, resource string, obj runtime.Object) (runtime.Object, error) Delete(user, resource, name string) error Update(user, resource, name string, obj runtime.Object) (runtime.Object, error) GetObject(resource string) runtime.Object - IsKnownResource(resource string) bool + IsKnownResource(resource, subresource string) bool } type operator struct { @@ -52,7 +53,7 @@ func NewOperator( // List objects. Only global objects will be returned if the user is nil. // If the user is not nil, only tenant objects whose tenant label matches the user will be returned. -func (o *operator) List(user, resource string, q *query.Query) (*api.ListResult, error) { +func (o *operator) List(user, resource, subresource string, q *query.Query) (*api.ListResult, error) { if len(q.LabelSelector) > 0 { q.LabelSelector = q.LabelSelector + "," @@ -73,12 +74,30 @@ func (o *operator) List(user, resource string, q *query.Query) (*api.ListResult, q.LabelSelector = q.LabelSelector + filter - return o.resourceGetter.List(resource, constants.NotificationSecretNamespace, q) + res, err := o.resourceGetter.List(resource, constants.NotificationSecretNamespace, q) + if err != nil { + return nil, err + } + + if subresource == "" || resource == "secrets" { + return res, nil + } + + results := &api.ListResult{} + for _, item := range res.Items { + obj := clean(item, resource, subresource) + if obj != nil { + results.Items = append(results.Items, obj) + } + } + results.TotalItems = len(results.Items) + + return results, nil } // Get the specified object, if you want to get a global object, the user must be nil. // If you want to get a tenant object, the user must equal to the tenant specified in labels of the object. -func (o *operator) Get(user, resource, name string) (runtime.Object, error) { +func (o *operator) Get(user, resource, name, subresource string) (runtime.Object, error) { obj, err := o.resourceGetter.Get(resource, constants.NotificationSecretNamespace, name) if err != nil { return nil, err @@ -88,7 +107,16 @@ func (o *operator) Get(user, resource, name string) (runtime.Object, error) { return nil, err } - return obj, nil + if subresource == "" || resource == "secrets" { + return obj, nil + } + + res := clean(obj, resource, subresource) + if res == nil { + return nil, errors.NewNotFound(v2beta1.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), name) + } + + return res, nil } // Create an object. A global object will be created if the user is nil. @@ -100,26 +128,10 @@ func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Ob } switch resource { - case v2alpha1.ResourcesPluralDingTalkConfig: - return o.ksClient.NotificationV2alpha1().DingTalkConfigs().Create(context.Background(), obj.(*v2alpha1.DingTalkConfig), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralDingTalkReceiver: - return o.ksClient.NotificationV2alpha1().DingTalkReceivers().Create(context.Background(), obj.(*v2alpha1.DingTalkReceiver), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralEmailConfig: - return o.ksClient.NotificationV2alpha1().EmailConfigs().Create(context.Background(), obj.(*v2alpha1.EmailConfig), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralEmailReceiver: - return o.ksClient.NotificationV2alpha1().EmailReceivers().Create(context.Background(), obj.(*v2alpha1.EmailReceiver), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralSlackConfig: - return o.ksClient.NotificationV2alpha1().SlackConfigs().Create(context.Background(), obj.(*v2alpha1.SlackConfig), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralSlackReceiver: - return o.ksClient.NotificationV2alpha1().SlackReceivers().Create(context.Background(), obj.(*v2alpha1.SlackReceiver), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralWebhookConfig: - return o.ksClient.NotificationV2alpha1().WebhookConfigs().Create(context.Background(), obj.(*v2alpha1.WebhookConfig), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralWebhookReceiver: - return o.ksClient.NotificationV2alpha1().WebhookReceivers().Create(context.Background(), obj.(*v2alpha1.WebhookReceiver), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralWechatConfig: - return o.ksClient.NotificationV2alpha1().WechatConfigs().Create(context.Background(), obj.(*v2alpha1.WechatConfig), v1.CreateOptions{}) - case v2alpha1.ResourcesPluralWechatReceiver: - return o.ksClient.NotificationV2alpha1().WechatReceivers().Create(context.Background(), obj.(*v2alpha1.WechatReceiver), v1.CreateOptions{}) + case v2beta1.ResourcesPluralConfig: + return o.ksClient.NotificationV2beta1().Configs().Create(context.Background(), obj.(*v2beta1.Config), v1.CreateOptions{}) + case v2beta1.ResourcesPluralReceiver: + return o.ksClient.NotificationV2beta1().Receivers().Create(context.Background(), obj.(*v2beta1.Receiver), v1.CreateOptions{}) case "secrets": return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Create(context.Background(), obj.(*corev1.Secret), v1.CreateOptions{}) default: @@ -131,7 +143,7 @@ func (o *operator) Create(user, resource string, obj runtime.Object) (runtime.Ob // If the user is not nil, a tenant object whose tenant label matches the user will be deleted. func (o *operator) Delete(user, resource, name string) error { - if obj, err := o.Get(user, resource, name); err != nil { + if obj, err := o.Get(user, resource, name, ""); err != nil { return err } else { if err := authorizer(user, obj); err != nil { @@ -140,26 +152,10 @@ func (o *operator) Delete(user, resource, name string) error { } switch resource { - case v2alpha1.ResourcesPluralDingTalkConfig: - return o.ksClient.NotificationV2alpha1().DingTalkConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralDingTalkReceiver: - return o.ksClient.NotificationV2alpha1().DingTalkReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralEmailConfig: - return o.ksClient.NotificationV2alpha1().EmailConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralEmailReceiver: - return o.ksClient.NotificationV2alpha1().EmailReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralSlackConfig: - return o.ksClient.NotificationV2alpha1().SlackConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralSlackReceiver: - return o.ksClient.NotificationV2alpha1().SlackReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralWebhookConfig: - return o.ksClient.NotificationV2alpha1().WebhookConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralWebhookReceiver: - return o.ksClient.NotificationV2alpha1().WebhookReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralWechatConfig: - return o.ksClient.NotificationV2alpha1().WechatConfigs().Delete(context.Background(), name, v1.DeleteOptions{}) - case v2alpha1.ResourcesPluralWechatReceiver: - return o.ksClient.NotificationV2alpha1().WechatReceivers().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2beta1.ResourcesPluralConfig: + return o.ksClient.NotificationV2beta1().Configs().Delete(context.Background(), name, v1.DeleteOptions{}) + case v2beta1.ResourcesPluralReceiver: + return o.ksClient.NotificationV2beta1().Receivers().Delete(context.Background(), name, v1.DeleteOptions{}) case "secrets": return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Delete(context.Background(), name, v1.DeleteOptions{}) default: @@ -175,7 +171,7 @@ func (o *operator) Update(user, resource, name string, obj runtime.Object) (runt return nil, err } - if old, err := o.Get(user, resource, name); err != nil { + if old, err := o.Get(user, resource, name, ""); err != nil { return nil, err } else { if err := authorizer(user, old); err != nil { @@ -184,26 +180,10 @@ func (o *operator) Update(user, resource, name string, obj runtime.Object) (runt } switch resource { - case v2alpha1.ResourcesPluralDingTalkConfig: - return o.ksClient.NotificationV2alpha1().DingTalkConfigs().Update(context.Background(), obj.(*v2alpha1.DingTalkConfig), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralDingTalkReceiver: - return o.ksClient.NotificationV2alpha1().DingTalkReceivers().Update(context.Background(), obj.(*v2alpha1.DingTalkReceiver), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralEmailConfig: - return o.ksClient.NotificationV2alpha1().EmailConfigs().Update(context.Background(), obj.(*v2alpha1.EmailConfig), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralEmailReceiver: - return o.ksClient.NotificationV2alpha1().EmailReceivers().Update(context.Background(), obj.(*v2alpha1.EmailReceiver), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralSlackConfig: - return o.ksClient.NotificationV2alpha1().SlackConfigs().Update(context.Background(), obj.(*v2alpha1.SlackConfig), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralSlackReceiver: - return o.ksClient.NotificationV2alpha1().SlackReceivers().Update(context.Background(), obj.(*v2alpha1.SlackReceiver), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralWebhookConfig: - return o.ksClient.NotificationV2alpha1().WebhookConfigs().Update(context.Background(), obj.(*v2alpha1.WebhookConfig), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralWebhookReceiver: - return o.ksClient.NotificationV2alpha1().WebhookReceivers().Update(context.Background(), obj.(*v2alpha1.WebhookReceiver), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralWechatConfig: - return o.ksClient.NotificationV2alpha1().WechatConfigs().Update(context.Background(), obj.(*v2alpha1.WechatConfig), v1.UpdateOptions{}) - case v2alpha1.ResourcesPluralWechatReceiver: - return o.ksClient.NotificationV2alpha1().WechatReceivers().Update(context.Background(), obj.(*v2alpha1.WechatReceiver), v1.UpdateOptions{}) + case v2beta1.ResourcesPluralConfig: + return o.ksClient.NotificationV2beta1().Configs().Update(context.Background(), obj.(*v2beta1.Config), v1.UpdateOptions{}) + case v2beta1.ResourcesPluralReceiver: + return o.ksClient.NotificationV2beta1().Receivers().Update(context.Background(), obj.(*v2beta1.Receiver), v1.UpdateOptions{}) case "secrets": return o.k8sClient.CoreV1().Secrets(constants.NotificationSecretNamespace).Update(context.Background(), obj.(*corev1.Secret), v1.UpdateOptions{}) default: @@ -214,26 +194,10 @@ func (o *operator) Update(user, resource, name string, obj runtime.Object) (runt func (o *operator) GetObject(resource string) runtime.Object { switch resource { - case v2alpha1.ResourcesPluralDingTalkConfig: - return &v2alpha1.DingTalkConfig{} - case v2alpha1.ResourcesPluralDingTalkReceiver: - return &v2alpha1.DingTalkReceiver{} - case v2alpha1.ResourcesPluralEmailConfig: - return &v2alpha1.EmailConfig{} - case v2alpha1.ResourcesPluralEmailReceiver: - return &v2alpha1.EmailReceiver{} - case v2alpha1.ResourcesPluralSlackConfig: - return &v2alpha1.SlackConfig{} - case v2alpha1.ResourcesPluralSlackReceiver: - return &v2alpha1.SlackReceiver{} - case v2alpha1.ResourcesPluralWebhookConfig: - return &v2alpha1.WebhookConfig{} - case v2alpha1.ResourcesPluralWebhookReceiver: - return &v2alpha1.WebhookReceiver{} - case v2alpha1.ResourcesPluralWechatConfig: - return &v2alpha1.WechatConfig{} - case v2alpha1.ResourcesPluralWechatReceiver: - return &v2alpha1.WechatReceiver{} + case v2beta1.ResourcesPluralConfig: + return &v2beta1.Config{} + case v2beta1.ResourcesPluralReceiver: + return &v2beta1.Receiver{} case "secrets": return &corev1.Secret{} default: @@ -241,12 +205,22 @@ func (o *operator) GetObject(resource string) runtime.Object { } } -func (o *operator) IsKnownResource(resource string) bool { +func (o *operator) IsKnownResource(resource, subresource string) bool { if obj := o.GetObject(resource); obj == nil { return false } + // "" means get all types of the config or receiver. + if subresource != "dingtalk" && + subresource != "email" && + subresource != "slack" && + subresource != "webhook" && + subresource != "wechat" && + subresource != "" { + return false + } + return true } @@ -254,13 +228,13 @@ func (o *operator) IsKnownResource(resource string) bool { func authorizer(user string, obj runtime.Object) error { // If the user is not nil, it must equal to the tenant specified in labels of the object. if user != "" && !isOwner(user, obj) { - return errors.NewForbidden(v2alpha1.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", + return errors.NewForbidden(v2beta1.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", fmt.Errorf("user '%s' is not the owner of object", user)) } // If the user is nil, the object must be a global object. if user == "" && !isGlobal(obj) { - return errors.NewForbidden(v2alpha1.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", + return errors.NewForbidden(v2beta1.Resource(obj.GetObjectKind().GroupVersionKind().GroupKind().Kind), "", fmt.Errorf("object is not a global object")) } @@ -281,7 +255,7 @@ func isOwner(user string, obj interface{}) bool { func isConfig(obj runtime.Object) bool { switch obj.(type) { - case *v2alpha1.DingTalkConfig, *v2alpha1.EmailConfig, *v2alpha1.SlackConfig, *v2alpha1.WebhookConfig, *v2alpha1.WechatConfig: + case *v2beta1.Config: return true default: return false @@ -330,3 +304,55 @@ func appendLabel(user string, obj runtime.Object) error { accessor.SetLabels(labels) return nil } + +func clean(obj interface{}, resource, subresource string) runtime.Object { + if resource == v2beta1.ResourcesPluralConfig { + config := obj.(*v2beta1.Config) + newConfig := config.DeepCopy() + newConfig.Spec = v2beta1.ConfigSpec{} + switch subresource { + case "dingtalk": + newConfig.Spec.DingTalk = config.Spec.DingTalk + case "email": + newConfig.Spec.Email = config.Spec.Email + case "slack": + newConfig.Spec.Slack = config.Spec.Slack + case "webhook": + newConfig.Spec.Webhook = config.Spec.Webhook + case "wechat": + newConfig.Spec.Wechat = config.Spec.Wechat + default: + return nil + } + + if reflect.ValueOf(newConfig.Spec).IsZero() { + return nil + } + + return newConfig + } else { + receiver := obj.(*v2beta1.Receiver) + newReceiver := receiver.DeepCopy() + newReceiver.Spec = v2beta1.ReceiverSpec{} + switch subresource { + case "dingtalk": + newReceiver.Spec.DingTalk = receiver.Spec.DingTalk + case "email": + newReceiver.Spec.Email = receiver.Spec.Email + case "slack": + newReceiver.Spec.Slack = receiver.Spec.Slack + case "webhook": + newReceiver.Spec.Webhook = receiver.Spec.Webhook + case "wechat": + newReceiver.Spec.Wechat = receiver.Spec.Wechat + default: + return nil + } + + if reflect.ValueOf(newReceiver.Spec).IsZero() { + return nil + } + + return newReceiver + } +} diff --git a/pkg/models/notification/notification_test.go b/pkg/models/notification/notification_test.go index cce007f81..a4152b3af 100644 --- a/pkg/models/notification/notification_test.go +++ b/pkg/models/notification/notification_test.go @@ -46,7 +46,7 @@ func TestOperator_List(t *testing.T) { } for i, test := range tests { - result, err := o.List("", "secrets", &query.Query{ + result, err := o.List("", "secrets", "", &query.Query{ SortBy: query.FieldName, Ascending: true, }) @@ -83,7 +83,7 @@ func TestOperator_Get(t *testing.T) { } for _, test := range tests { - result, err := o.Get("", "secrets", test.name) + result, err := o.Get("", "secrets", test.name, "") if err != nil { if !reflect.DeepEqual(err, test.expectError) { diff --git a/pkg/models/resources/v1alpha3/notification/notification.go b/pkg/models/resources/v1alpha3/notification/notification.go index 92e3aee69..47ad0ff30 100644 --- a/pkg/models/resources/v1alpha3/notification/notification.go +++ b/pkg/models/resources/v1alpha3/notification/notification.go @@ -23,22 +23,23 @@ import ( "kubesphere.io/kubesphere/pkg/apiserver/query" ksinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" "kubesphere.io/kubesphere/pkg/models/resources/v1alpha3" + "strings" ) -type dingtalkConfigGetter struct { +type configGetter struct { ksInformer ksinformers.SharedInformerFactory } -func NewDingTalkConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &dingtalkConfigGetter{ksInformer: informer} +func NewNotificationConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &configGetter{ksInformer: informer} } -func (g *dingtalkConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().DingTalkConfigs().Lister().Get(name) +func (g *configGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2beta1().Configs().Lister().Get(name) } -func (g *dingtalkConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().DingTalkConfigs().Lister().List(query.Selector()) +func (g *configGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2beta1().Configs().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -50,220 +51,20 @@ func (g *dingtalkConfigGetter) List(_ string, query *query.Query) (*api.ListResu return v1alpha3.DefaultList(result, query, compare, filter), nil } -type dingtalkReceiverGetter struct { +type receiverGetter struct { ksInformer ksinformers.SharedInformerFactory } -func NewDingTalkReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &dingtalkReceiverGetter{ksInformer: informer} +func NewNotificationReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { + return &receiverGetter{ksInformer: informer} } -func (g *dingtalkReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().DingTalkReceivers().Lister().Get(name) +func (g *receiverGetter) Get(_, name string) (runtime.Object, error) { + return g.ksInformer.Notification().V2beta1().Receivers().Lister().Get(name) } -func (g *dingtalkReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().DingTalkReceivers().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type emailConfigGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewEmailConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &emailConfigGetter{ksInformer: informer} -} - -func (g *emailConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().EmailConfigs().Lister().Get(name) -} - -func (g *emailConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().EmailConfigs().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type emailReceiverGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewEmailReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &emailReceiverGetter{ksInformer: informer} -} - -func (g *emailReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().EmailReceivers().Lister().Get(name) -} - -func (g *emailReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().EmailReceivers().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type slackConfigGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewSlackConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &slackConfigGetter{ksInformer: informer} -} - -func (g *slackConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().SlackConfigs().Lister().Get(name) -} - -func (g *slackConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().SlackConfigs().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type slackReceiverGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewSlackReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &slackReceiverGetter{ksInformer: informer} -} - -func (g *slackReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().SlackReceivers().Lister().Get(name) -} - -func (g *slackReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().SlackReceivers().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type webhookConfigGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewWebhookConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &webhookConfigGetter{ksInformer: informer} -} - -func (g *webhookConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().WebhookConfigs().Lister().Get(name) -} - -func (g *webhookConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().WebhookConfigs().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type webhookReceiverGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewWebhookReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &webhookReceiverGetter{ksInformer: informer} -} - -func (g *webhookReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().WebhookReceivers().Lister().Get(name) -} - -func (g *webhookReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().WebhookReceivers().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type wechatConfigGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewWechatConfigGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &wechatConfigGetter{ksInformer: informer} -} - -func (g *wechatConfigGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().WechatConfigs().Lister().Get(name) -} - -func (g *wechatConfigGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().WechatConfigs().Lister().List(query.Selector()) - if err != nil { - return nil, err - } - - var result []runtime.Object - for _, obj := range objs { - result = append(result, obj) - } - return v1alpha3.DefaultList(result, query, compare, filter), nil -} - -type wechatReceiverGetter struct { - ksInformer ksinformers.SharedInformerFactory -} - -func NewWechatReceiverGetter(informer ksinformers.SharedInformerFactory) v1alpha3.Interface { - return &wechatReceiverGetter{ksInformer: informer} -} - -func (g *wechatReceiverGetter) Get(_, name string) (runtime.Object, error) { - return g.ksInformer.Notification().V2alpha1().WechatReceivers().Lister().Get(name) -} - -func (g *wechatReceiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { - objs, err := g.ksInformer.Notification().V2alpha1().WechatReceivers().Lister().List(query.Selector()) +func (g *receiverGetter) List(_ string, query *query.Query) (*api.ListResult, error) { + objs, err := g.ksInformer.Notification().V2beta1().Receivers().Lister().List(query.Selector()) if err != nil { return nil, err } @@ -298,5 +99,17 @@ func filter(object runtime.Object, filter query.Filter) bool { return false } - return v1alpha3.DefaultObjectMetaFilter(meta.AsPartialObjectMetadata(accessor).ObjectMeta, filter) + switch filter.Field { + case query.FieldNames: + for _, name := range strings.Split(string(filter.Value), ",") { + if accessor.GetName() == name { + return true + } + } + return false + case query.FieldName: + return strings.Contains(accessor.GetName(), string(filter.Value)) + default: + return true + } } diff --git a/pkg/models/resources/v1alpha3/notification/notification_test.go b/pkg/models/resources/v1alpha3/notification/notification_test.go index 52bbb0b1a..6be481afa 100644 --- a/pkg/models/resources/v1alpha3/notification/notification_test.go +++ b/pkg/models/resources/v1alpha3/notification/notification_test.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/cache" "kubesphere.io/kubesphere/pkg/api" - "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" "kubesphere.io/kubesphere/pkg/apiserver/query" "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" ksinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" @@ -47,43 +47,11 @@ func TestListObjects(t *testing.T) { }{ { "test name filter", - v2alpha1.ResourcesPluralDingTalkConfig, + v2beta1.ResourcesPluralConfig, }, { "test name filter", - v2alpha1.ResourcesPluralDingTalkReceiver, - }, - { - "test name filter", - v2alpha1.ResourcesPluralEmailConfig, - }, - { - "test name filter", - v2alpha1.ResourcesPluralEmailReceiver, - }, - { - "test name filter", - v2alpha1.ResourcesPluralSlackConfig, - }, - { - "test name filter", - v2alpha1.ResourcesPluralSlackReceiver, - }, - { - "test name filter", - v2alpha1.ResourcesPluralWebhookConfig, - }, - { - "test name filter", - v2alpha1.ResourcesPluralWebhookReceiver, - }, - { - "test name filter", - v2alpha1.ResourcesPluralWechatConfig, - }, - { - "test name filter", - v2alpha1.ResourcesPluralWechatReceiver, + v2beta1.ResourcesPluralReceiver, }, } @@ -128,46 +96,14 @@ func prepare(key string) (v1alpha3.Interface, []interface{}, error) { var indexer cache.Indexer var getter func(informer ksinformers.SharedInformerFactory) v1alpha3.Interface switch key { - case v2alpha1.ResourcesPluralDingTalkConfig: - indexer = informer.Notification().V2alpha1().DingTalkConfigs().Informer().GetIndexer() - getter = NewDingTalkConfigGetter - obj = &v2alpha1.DingTalkConfig{} - case v2alpha1.ResourcesPluralDingTalkReceiver: - indexer = informer.Notification().V2alpha1().DingTalkReceivers().Informer().GetIndexer() - getter = NewDingTalkReceiverGetter - obj = &v2alpha1.DingTalkReceiver{} - case v2alpha1.ResourcesPluralEmailConfig: - indexer = informer.Notification().V2alpha1().EmailConfigs().Informer().GetIndexer() - getter = NewEmailConfigGetter - obj = &v2alpha1.EmailConfig{} - case v2alpha1.ResourcesPluralEmailReceiver: - indexer = informer.Notification().V2alpha1().EmailReceivers().Informer().GetIndexer() - getter = NewEmailReceiverGetter - obj = &v2alpha1.EmailReceiver{} - case v2alpha1.ResourcesPluralSlackConfig: - indexer = informer.Notification().V2alpha1().SlackConfigs().Informer().GetIndexer() - getter = NewSlackConfigGetter - obj = &v2alpha1.SlackConfig{} - case v2alpha1.ResourcesPluralSlackReceiver: - indexer = informer.Notification().V2alpha1().SlackReceivers().Informer().GetIndexer() - getter = NewSlackReceiverGetter - obj = &v2alpha1.SlackReceiver{} - case v2alpha1.ResourcesPluralWebhookConfig: - indexer = informer.Notification().V2alpha1().WebhookConfigs().Informer().GetIndexer() - getter = NewWebhookConfigGetter - obj = &v2alpha1.WebhookConfig{} - case v2alpha1.ResourcesPluralWebhookReceiver: - indexer = informer.Notification().V2alpha1().WebhookReceivers().Informer().GetIndexer() - getter = NewWebhookReceiverGetter - obj = &v2alpha1.WebhookReceiver{} - case v2alpha1.ResourcesPluralWechatConfig: - indexer = informer.Notification().V2alpha1().WechatConfigs().Informer().GetIndexer() - getter = NewWechatConfigGetter - obj = &v2alpha1.WechatConfig{} - case v2alpha1.ResourcesPluralWechatReceiver: - indexer = informer.Notification().V2alpha1().WechatReceivers().Informer().GetIndexer() - getter = NewWechatReceiverGetter - obj = &v2alpha1.WechatReceiver{} + case v2beta1.ResourcesPluralConfig: + indexer = informer.Notification().V2beta1().Configs().Informer().GetIndexer() + getter = NewNotificationConfigGetter + obj = &v2beta1.Config{} + case v2beta1.ResourcesPluralReceiver: + indexer = informer.Notification().V2beta1().Receivers().Informer().GetIndexer() + getter = NewNotificationReceiverGetter + obj = &v2beta1.Receiver{} default: return nil, nil, errors.New("unowned type %s", key) } diff --git a/pkg/models/resources/v1alpha3/resource/resource.go b/pkg/models/resources/v1alpha3/resource/resource.go index a205b0922..e457e4da7 100644 --- a/pkg/models/resources/v1alpha3/resource/resource.go +++ b/pkg/models/resources/v1alpha3/resource/resource.go @@ -26,7 +26,7 @@ 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" - notificationv2alpha1 "kubesphere.io/kubesphere/pkg/apis/notification/v2alpha1" + notificationv2beta1 "kubesphere.io/kubesphere/pkg/apis/notification/v2beta1" tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1" tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2" typesv1beta1 "kubesphere.io/kubesphere/pkg/apis/types/v1beta1" @@ -126,16 +126,8 @@ func NewResourceGetter(factory informers.InformerFactory, cache cache.Cache) *Re getters[schema.GroupVersionResource{Group: "cluster.kubesphere.io", Version: "v1alpha1", Resource: "clusters"}] = cluster.New(factory.KubeSphereSharedInformerFactory()) getters[schema.GroupVersionResource{Group: "apiextensions.k8s.io", Version: "v1", Resource: "customresourcedefinitions"}] = customresourcedefinition.New(factory.ApiExtensionSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralDingTalkConfig)] = notification.NewDingTalkConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralDingTalkReceiver)] = notification.NewDingTalkReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralEmailConfig)] = notification.NewEmailConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralEmailReceiver)] = notification.NewEmailReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralSlackConfig)] = notification.NewSlackConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralSlackReceiver)] = notification.NewSlackReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWebhookConfig)] = notification.NewWebhookConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWebhookReceiver)] = notification.NewWebhookReceiverGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWechatConfig)] = notification.NewWechatConfigGetter(factory.KubeSphereSharedInformerFactory()) - getters[notificationv2alpha1.SchemeGroupVersion.WithResource(notificationv2alpha1.ResourcesPluralWechatReceiver)] = notification.NewWechatReceiverGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2beta1.SchemeGroupVersion.WithResource(notificationv2beta1.ResourcesPluralConfig)] = notification.NewNotificationConfigGetter(factory.KubeSphereSharedInformerFactory()) + getters[notificationv2beta1.SchemeGroupVersion.WithResource(notificationv2beta1.ResourcesPluralReceiver)] = notification.NewNotificationReceiverGetter(factory.KubeSphereSharedInformerFactory()) // federated resources getters[typesv1beta1.SchemeGroupVersion.WithResource(typesv1beta1.ResourcePluralFederatedNamespace)] = federatednamespace.New(factory.KubeSphereSharedInformerFactory())