diff --git a/config/ks-core/templates/kubesphere-config.yaml b/config/ks-core/templates/kubesphere-config.yaml index 85c84245d..107a5973b 100644 --- a/config/ks-core/templates/kubesphere-config.yaml +++ b/config/ks-core/templates/kubesphere-config.yaml @@ -24,7 +24,8 @@ data: {{- end }} monitoring: endpoint: {{ .Values.config.monitoring.endpoint | default "http://prometheus-operated.kubesphere-monitoring-system.svc:9090" }} - + notification: + endpoint: {{ .Values.config.notification.endpoint | default "http://notification-manager-svc.kubesphere-monitoring-system.svc:19093" }} {{- with .Values.config.servicemesh }} servicemesh: {{- toYaml . | nindent 6 }} diff --git a/config/ks-core/values.yaml b/config/ks-core/values.yaml index e06efbe5c..bff01e530 100644 --- a/config/ks-core/values.yaml +++ b/config/ks-core/values.yaml @@ -43,6 +43,7 @@ config: jwtSecret: "" multicluster: {} monitoring: {} + notification: {} imagePullSecrets: [] nameOverride: "" diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 94de8b3e0..3c72773b9 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -77,6 +77,7 @@ import ( networkv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/network/v1alpha2" notificationv1 "kubesphere.io/kubesphere/pkg/kapis/notification/v1" notificationkapisv2beta1 "kubesphere.io/kubesphere/pkg/kapis/notification/v2beta1" + notificationkapisv2beta2 "kubesphere.io/kubesphere/pkg/kapis/notification/v2beta2" "kubesphere.io/kubesphere/pkg/kapis/oauth" openpitrixv1 "kubesphere.io/kubesphere/pkg/kapis/openpitrix/v1" operationsv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/operations/v1alpha2" @@ -271,6 +272,7 @@ func (s *APIServer) installKubeSphereAPIs() { urlruntime.Must(kubeedgev1alpha1.AddToContainer(s.container, s.Config.KubeEdgeOptions.Endpoint)) urlruntime.Must(notificationkapisv2beta1.AddToContainer(s.container, s.InformerFactory, s.KubernetesClient.Kubernetes(), s.KubernetesClient.KubeSphere())) + urlruntime.Must(notificationkapisv2beta2.AddToContainer(s.container, s.Config.NotificationOptions)) urlruntime.Must(gatewayv1alpha1.AddToContainer(s.container, s.Config.GatewayOptions, s.RuntimeCache, s.RuntimeClient)) } diff --git a/pkg/kapis/notification/v2beta2/handler.go b/pkg/kapis/notification/v2beta2/handler.go new file mode 100644 index 000000000..a9dc3bbcd --- /dev/null +++ b/pkg/kapis/notification/v2beta2/handler.go @@ -0,0 +1,114 @@ +package v2beta2 + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + + "github.com/emicklei/go-restful" + "kubesphere.io/api/notification/v2beta2" + + nm "kubesphere.io/kubesphere/pkg/simple/client/notification" +) + +const ( + VerificationAPIPath = "/api/v2/verify" +) + +type handler struct { + option *nm.Options +} + +type Result struct { + Code int `json:"Status"` + Message string `json:"Message"` +} +type notification struct { + Config v2beta2.Config `json:"config"` + Receiver v2beta2.Receiver `json:"receiver"` +} + +func newHandler(option *nm.Options) *handler { + return &handler{ + option, + } +} + +func (h handler) Verify(request *restful.Request, response *restful.Response) { + opt := h.option + if opt == nil || len(opt.Endpoint) == 0 { + response.WriteAsJson(Result{ + http.StatusBadRequest, + "Cannot find Notification Manager endpoint", + }) + } + host := opt.Endpoint + notification := notification{} + reqBody, err := ioutil.ReadAll(request.Request.Body) + if err != nil { + response.WriteHeaderAndEntity(http.StatusInternalServerError, err) + return + } + + err = json.Unmarshal(reqBody, ¬ification) + if err != nil { + response.WriteHeaderAndEntity(http.StatusInternalServerError, err) + return + } + + receiver := notification.Receiver + user := request.PathParameter("user") + + if receiver.Labels["type"] == "tenant" { + if user != receiver.Labels["user"] { + response.WriteAsJson(Result{ + http.StatusForbidden, + "Permission denied", + }) + return + } + } + if receiver.Labels["type"] == "global" { + if user != "" { + response.WriteAsJson(Result{ + http.StatusForbidden, + "Permission denied", + }) + return + } + } + + req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", host, VerificationAPIPath), bytes.NewReader(reqBody)) + if err != nil { + response.WriteHeaderAndEntity(http.StatusInternalServerError, err) + return + } + req.Header = request.Request.Header + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + response.WriteHeaderAndEntity(http.StatusInternalServerError, err) + return + } + defer resp.Body.Close() + + body, err := io.ReadAll(resp.Body) + if err != nil { + // return 500 + response.WriteHeaderAndEntity(http.StatusInternalServerError, err) + return + } + + var result Result + err = json.Unmarshal(body, &result) + if err != nil { + response.WriteHeaderAndEntity(http.StatusInternalServerError, err) + return + } + + response.WriteAsJson(result) +} diff --git a/pkg/kapis/notification/v2beta2/register.go b/pkg/kapis/notification/v2beta2/register.go new file mode 100644 index 000000000..83174aeb9 --- /dev/null +++ b/pkg/kapis/notification/v2beta2/register.go @@ -0,0 +1,50 @@ +/* + + Copyright 2021 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 v2beta2 + +import ( + "net/http" + + nm "kubesphere.io/kubesphere/pkg/simple/client/notification" + + "github.com/emicklei/go-restful" + "k8s.io/apimachinery/pkg/runtime/schema" + + "kubesphere.io/kubesphere/pkg/api" + "kubesphere.io/kubesphere/pkg/apiserver/runtime" +) + +var GroupVersion = schema.GroupVersion{Group: "notification.kubesphere.io", Version: "v2beta2"} + +func AddToContainer(container *restful.Container, option *nm.Options) error { + h := newHandler(option) + ws := runtime.NewWebService(GroupVersion) + ws.Route(ws.POST("/configs/notification/verification"). + Reads(""). + To(h.Verify). + Returns(http.StatusOK, api.StatusOK, http.Response{}.Body)). + Doc("Provide validation for notification-manager information") + ws.Route(ws.POST("/configs/notification/users/{user}/verification"). + To(h.Verify). + Param(ws.PathParameter("user", "user name")). + Returns(http.StatusOK, api.StatusOK, http.Response{}.Body)). + Doc("Provide validation for notification-manager information") + container.Add(ws) + return nil +} diff --git a/staging/src/kubesphere.io/api/notification/v2beta2/config_types.go b/staging/src/kubesphere.io/api/notification/v2beta2/config_types.go new file mode 100644 index 000000000..1e0a57c43 --- /dev/null +++ b/staging/src/kubesphere.io/api/notification/v2beta2/config_types.go @@ -0,0 +1,209 @@ +/* + + +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 v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// DingTalkApplicationConfig it th configuration of conversation +type DingTalkApplicationConfig struct { + // The key of the application with which to send messages. + AppKey *Credential `json:"appkey"` + // The key in the secret to be used. Must be a valid secret key. + AppSecret *Credential `json:"appsecret"` +} + +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 *Credential `json:"cert"` + // The client key file for the targets. + Key *Credential `json:"key"` +} + +// TLSConfig configures the options for TLS connections. +type TLSConfig struct { + // RootCA defines the root certificate authorities + // that clients use when verifying server certificates. + RootCA *Credential `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 *Credential `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 *Credential `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 *Credential `json:"authPassword,omitempty"` + // The secret contains the SMTP secret for CRAM-MD5 authentication. + AuthSecret *Credential `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 *Credential `json:"slackTokenSecret"` +} + +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 *Credential `json:"wechatApiSecret"` +} + +// Sms Aliyun provider parameters +type AliyunSMS struct { + SignName string `json:"signName"` + TemplateCode string `json:"templateCode,omitempty"` + AccessKeyId *Credential `json:"accessKeyId"` + AccessKeySecret *Credential `json:"accessKeySecret"` +} + +// Sms tencent provider parameters +type TencentSMS struct { + Sign string `json:"sign"` + TemplateID string `json:"templateID"` + SmsSdkAppid string `json:"smsSdkAppid"` + SecretId *Credential `json:"secretId"` + SecretKey *Credential `json:"secretKey"` +} + +// Sms huawei provider parameters +type HuaweiSMS struct { + Url string `json:"url,omitempty"` + Signature string `json:"signature"` + TemplateId string `json:"templateId"` + Sender string `json:"sender"` + AppSecret *Credential `json:"appSecret"` + AppKey *Credential `json:"appKey"` +} + +type Providers struct { + Aliyun *AliyunSMS `json:"aliyun,omitempty"` + Tencent *TencentSMS `json:"tencent,omitempty"` + Huawei *HuaweiSMS `json:"huawei,omitempty"` +} + +type SmsConfig struct { + // The default sms provider, optional, use the first provider if not set + DefaultProvider string `json:"defaultProvider,omitempty"` + // All sms providers + Providers *Providers `json:"providers"` +} + +type PushoverConfig struct { + Labels map[string]string `json:"labels,omitempty"` + // The token of a pushover application. + PushoverTokenSecret *Credential `json:"pushoverTokenSecret"` +} + +//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"` + Sms *SmsConfig `json:"sms,omitempty"` + Pushover *PushoverConfig `json:"pushover,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 +// +kubebuilder:storageversion + +// Config 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/staging/src/kubesphere.io/api/notification/v2beta2/doc.go b/staging/src/kubesphere.io/api/notification/v2beta2/doc.go new file mode 100644 index 000000000..30baec621 --- /dev/null +++ b/staging/src/kubesphere.io/api/notification/v2beta2/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2021 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 v2beta2 contains API Schema definitions for the notification v2beta2 API group +// +groupName=notification.kubesphere.io +// +genclient +// +genclient:nonNamespaced +package v2beta2 diff --git a/staging/src/kubesphere.io/api/notification/v2beta2/notificationmanager_types.go b/staging/src/kubesphere.io/api/notification/v2beta2/notificationmanager_types.go new file mode 100644 index 000000000..de4dad770 --- /dev/null +++ b/staging/src/kubesphere.io/api/notification/v2beta2/notificationmanager_types.go @@ -0,0 +1,267 @@ +/* + + +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 v2beta2 + +import ( + "time" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + Tenant = "tenant" +) + +// SecretKeySelector selects a key of a Secret. +type SecretKeySelector struct { + // The namespace of the secret, default to the `defaultSecretNamespace` of `NotificationManager` crd. + // If the `defaultSecretNamespace` does not set, default to the pod's namespace. + // +optional + Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` + // Name of the secret. + 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"` +} + +type ValueSource struct { + // Selects a key of a secret in the pod's namespace + // +optional + SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty" protobuf:"bytes,4,opt,name=secretKeyRef"` +} + +type Credential struct { + // +optional + Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` + ValueFrom *ValueSource `json:"valueFrom,omitempty" protobuf:"bytes,3,opt,name=valueFrom"` +} + +// Sidecar defines a sidecar container which will be add to the notification manager deployment pod. +type Sidecar struct { + // The type of sidecar, it can be specified to any value. + // Notification manager built-in sidecar for KubeSphere, + // It can be used with set `type` to `kubesphere`. + Type string `json:"type" protobuf:"bytes,2,opt,name=type"` + // Container of sidecar. + *v1.Container `json:",inline"` +} + +// 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 toleration. + 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"` + // 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. + // 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. + // +optional + Args []string `json:"args,omitempty"` + // Sidecar containers. The key is the type of sidecar, known value include: tenant. + // Tenant sidecar used to manage the tenants which will receive notifications. + // It needs to provide the API `/api/v2/tenant` at port `19094`, this api receives + // a parameter `namespace` and return all tenants which need to receive notifications in this namespace. + Sidecars map[string]*Sidecar `json:"sidecars,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"` + // Deprecated + 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"` + // template type: text or html, default type is html + TmplType string `json:"tmplType,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"` + // template type: text or markdown, default type is text + TmplType string `json:"tmplType,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"` +} + +// Throttle is 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 name of the template to generate markdown title + TitleTemplate string `json:"titleTemplate,omitempty"` + // template type: text or markdown, default type is text + TmplType string `json:"tmplType,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 SmsOptions struct { + // Notification Sending Timeout + NotificationTimeout *int32 `json:"notificationTimeout,omitempty"` + // The name of the template to generate sms message. + // If the global template is not set, it will use default. + Template string `json:"template,omitempty"` +} + +type PushoverOptions struct { + // Notification Sending Timeout + NotificationTimeout *int32 `json:"notificationTimeout,omitempty"` + // The name of the template to generate pushover message. + // If the global template is not set, it will use default. + Template string `json:"template,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"` + Sms *SmsOptions `json:"sms,omitempty"` + Pushover *PushoverOptions `json:"pushover,omitempty"` +} + +// NotificationManagerStatus defines the observed state of NotificationManager +type NotificationManagerStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=nm,categories=notification-manager +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// 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/staging/src/kubesphere.io/api/notification/v2beta2/receiver_types.go b/staging/src/kubesphere.io/api/notification/v2beta2/receiver_types.go new file mode 100644 index 000000000..87ca0b09a --- /dev/null +++ b/staging/src/kubesphere.io/api/notification/v2beta2/receiver_types.go @@ -0,0 +1,271 @@ +/* + + +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 v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// DingTalkChatBot is the configuration of ChatBot +type DingTalkChatBot struct { + // The webhook of ChatBot which the message will send to. + Webhook *Credential `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 *Credential `json:"secret,omitempty"` + // The phone numbers of the users which will be @. + AtMobiles []string `json:"atMobiles,omitempty"` + // The users who will be @. + AtUsers []string `json:"atUsers,omitempty"` + // Whether @everyone. + AtAll bool `json:"atAll,omitempty"` +} + +// DingTalkConversation of conversation +type DingTalkConversation struct { + ChatIDs []string `json:"chatids"` +} + +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"` + // 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 name of the template to generate markdown title + TitleTemplate *string `json:"titleTemplate,omitempty"` + // template type: text or markdown + TmplType *string `json:"tmplType,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"` + // 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 name of the template to generate email subject + SubjectTemplate *string `json:"subjectTemplate,omitempty"` + // template type: text or html, default type is html + TmplType *string `json:"tmplType,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"` + // 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"` +} + +// 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"` +} + +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. + 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"` + // 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"` +} + +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"` + // 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"` + // template type: text or markdown, default type is text + TmplType *string `json:"tmplType,omitempty"` +} + +type SmsReceiver struct { + // whether the receiver is enabled + Enabled *bool `json:"enabled,omitempty"` + // SmsConfig to be selected for this receiver + SmsConfigSelector *metav1.LabelSelector `json:"smsConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,omitempty"` + // Receivers' phone numbers + PhoneNumbers []string `json:"phoneNumbers"` + // The name of the template to generate Sms message. + // If the global template is not set, it will use default. + Template *string `json:"template,omitempty"` +} + +// PushoverUserProfile includes userKey and other preferences +type PushoverUserProfile struct { + // UserKey is the user (Pushover User Key) to send notifications to. + // +kubebuilder:validation:Pattern=`^[A-Za-z0-9]{30}$` + UserKey *string `json:"userKey"` + // Devices refers to device name to send the message directly to that device, rather than all of the user's devices + Devices []string `json:"devices,omitempty"` + // Title refers to message's title, otherwise your app's name is used. + Title *string `json:"title,omitempty"` + // Sound refers to the name of one of the sounds (https://pushover.net/api#sounds) supported by device clients + Sound *string `json:"sound,omitempty"` +} + +type PushoverReceiver struct { + // whether the receiver is enabled + Enabled *bool `json:"enabled,omitempty"` + // PushoverConfig to be selected for this receiver + PushoverConfigSelector *metav1.LabelSelector `json:"pushoverConfigSelector,omitempty"` + // Selector to filter alerts. + AlertSelector *metav1.LabelSelector `json:"alertSelector,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 users profile. + Profiles []*PushoverUserProfile `json:"profiles"` +} + +//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"` + Sms *SmsReceiver `json:"sms,omitempty"` + Pushover *PushoverReceiver `json:"pushover,omitempty"` +} + +// ReceiverStatus defines the observed state of Receiver +type ReceiverStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster,shortName=nr,categories=notification-manager +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// Receiver is the Schema for the receivers API +type Receiver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ReceiverSpec `json:"spec,omitempty"` + Status ReceiverStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ReceiverList contains a list of Receiver +type ReceiverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Receiver `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Receiver{}, &ReceiverList{}) +} diff --git a/staging/src/kubesphere.io/api/notification/v2beta2/register.go b/staging/src/kubesphere.io/api/notification/v2beta2/register.go new file mode 100644 index 000000000..34dfb4227 --- /dev/null +++ b/staging/src/kubesphere.io/api/notification/v2beta2/register.go @@ -0,0 +1,40 @@ +/* + + +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 v2beta2 contains API Schema definitions for the notification v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=notification.kubesphere.io +package v2beta2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "notification.kubesphere.io", Version: "v2beta2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +func Resource(resource string) schema.GroupResource { + return GroupVersion.WithResource(resource).GroupResource() +} diff --git a/staging/src/kubesphere.io/api/notification/v2beta2/types.go b/staging/src/kubesphere.io/api/notification/v2beta2/types.go new file mode 100644 index 000000000..0c4f29c99 --- /dev/null +++ b/staging/src/kubesphere.io/api/notification/v2beta2/types.go @@ -0,0 +1,27 @@ +/* +Copyright 2021 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 v2beta2 + +const ( + ResourceKindConfig = "Configs" + ResourcesSingularConfig = "config" + ResourcesPluralConfig = "configs" + + ResourceKindReceiver = "Receiver" + ResourcesSingularReceiver = "receiver" + ResourcesPluralReceiver = "receivers" +) diff --git a/staging/src/kubesphere.io/api/notification/v2beta2/zz_generated.deepcopy.go b/staging/src/kubesphere.io/api/notification/v2beta2/zz_generated.deepcopy.go new file mode 100644 index 000000000..250573a4a --- /dev/null +++ b/staging/src/kubesphere.io/api/notification/v2beta2/zz_generated.deepcopy.go @@ -0,0 +1,1702 @@ +// +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 v2beta2 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AliyunSMS) DeepCopyInto(out *AliyunSMS) { + *out = *in + if in.AccessKeyId != nil { + in, out := &in.AccessKeyId, &out.AccessKeyId + *out = new(Credential) + (*in).DeepCopyInto(*out) + } + if in.AccessKeySecret != nil { + in, out := &in.AccessKeySecret, &out.AccessKeySecret + *out = new(Credential) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AliyunSMS. +func (in *AliyunSMS) DeepCopy() *AliyunSMS { + if in == nil { + return nil + } + out := new(AliyunSMS) + in.DeepCopyInto(out) + return out +} + +// 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(Credential) + (*in).DeepCopyInto(*out) + } +} + +// 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(Credential) + (*in).DeepCopyInto(*out) + } + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(Credential) + (*in).DeepCopyInto(*out) + } +} + +// 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 *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) + } + if in.Sms != nil { + in, out := &in.Sms, &out.Sms + *out = new(SmsConfig) + (*in).DeepCopyInto(*out) + } + if in.Pushover != nil { + in, out := &in.Pushover, &out.Pushover + *out = new(PushoverConfig) + (*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 *Credential) DeepCopyInto(out *Credential) { + *out = *in + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(ValueSource) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Credential. +func (in *Credential) DeepCopy() *Credential { + if in == nil { + return nil + } + out := new(Credential) + 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(Credential) + (*in).DeepCopyInto(*out) + } + if in.AppSecret != nil { + in, out := &in.AppSecret, &out.AppSecret + *out = new(Credential) + (*in).DeepCopyInto(*out) + } +} + +// 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(Credential) + (*in).DeepCopyInto(*out) + } + 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(Credential) + (*in).DeepCopyInto(*out) + } + if in.AtMobiles != nil { + in, out := &in.AtMobiles, &out.AtMobiles + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.AtUsers != nil { + in, out := &in.AtUsers, &out.AtUsers + *out = make([]string, len(*in)) + copy(*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 + 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. +func (in *DingTalkConfig) DeepCopy() *DingTalkConfig { + if in == nil { + return nil + } + out := new(DingTalkConfig) + 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. +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 + 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) + } + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(string) + **out = **in + } + if in.TitleTemplate != nil { + in, out := &in.TitleTemplate, &out.TitleTemplate + *out = new(string) + **out = **in + } + if in.TmplType != nil { + in, out := &in.TmplType, &out.TmplType + *out = new(string) + **out = **in + } +} + +// 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 +} + +// 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 + 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 + } + } + 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(Credential) + (*in).DeepCopyInto(*out) + } + if in.AuthSecret != nil { + in, out := &in.AuthSecret, &out.AuthSecret + *out = new(Credential) + (*in).DeepCopyInto(*out) + } + 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 EmailConfig. +func (in *EmailConfig) DeepCopy() *EmailConfig { + if in == nil { + return nil + } + out := new(EmailConfig) + 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 + 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) + } + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(string) + **out = **in + } + if in.SubjectTemplate != nil { + in, out := &in.SubjectTemplate, &out.SubjectTemplate + *out = new(string) + **out = **in + } + if in.TmplType != nil { + in, out := &in.TmplType, &out.TmplType + *out = new(string) + **out = **in + } +} + +// 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 +} + +// 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(Credential) + (*in).DeepCopyInto(*out) + } + 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 *HuaweiSMS) DeepCopyInto(out *HuaweiSMS) { + *out = *in + if in.AppSecret != nil { + in, out := &in.AppSecret, &out.AppSecret + *out = new(Credential) + (*in).DeepCopyInto(*out) + } + if in.AppKey != nil { + in, out := &in.AppKey, &out.AppKey + *out = new(Credential) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HuaweiSMS. +func (in *HuaweiSMS) DeepCopy() *HuaweiSMS { + if in == nil { + return nil + } + out := new(HuaweiSMS) + 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(v1.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(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *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(metav1.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([]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([]v1.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) + } + if in.Sidecars != nil { + in, out := &in.Sidecars, &out.Sidecars + *out = make(map[string]*Sidecar, len(*in)) + for key, val := range *in { + var outVal *Sidecar + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(Sidecar) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } +} + +// 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) + } + if in.Sms != nil { + in, out := &in.Sms, &out.Sms + *out = new(SmsOptions) + (*in).DeepCopyInto(*out) + } + if in.Pushover != nil { + in, out := &in.Pushover, &out.Pushover + *out = new(PushoverOptions) + (*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 *Providers) DeepCopyInto(out *Providers) { + *out = *in + if in.Aliyun != nil { + in, out := &in.Aliyun, &out.Aliyun + *out = new(AliyunSMS) + (*in).DeepCopyInto(*out) + } + if in.Tencent != nil { + in, out := &in.Tencent, &out.Tencent + *out = new(TencentSMS) + (*in).DeepCopyInto(*out) + } + if in.Huawei != nil { + in, out := &in.Huawei, &out.Huawei + *out = new(HuaweiSMS) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Providers. +func (in *Providers) DeepCopy() *Providers { + if in == nil { + return nil + } + out := new(Providers) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PushoverConfig) DeepCopyInto(out *PushoverConfig) { + *out = *in + 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.PushoverTokenSecret != nil { + in, out := &in.PushoverTokenSecret, &out.PushoverTokenSecret + *out = new(Credential) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PushoverConfig. +func (in *PushoverConfig) DeepCopy() *PushoverConfig { + if in == nil { + return nil + } + out := new(PushoverConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PushoverOptions) DeepCopyInto(out *PushoverOptions) { + *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 PushoverOptions. +func (in *PushoverOptions) DeepCopy() *PushoverOptions { + if in == nil { + return nil + } + out := new(PushoverOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PushoverReceiver) DeepCopyInto(out *PushoverReceiver) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.PushoverConfigSelector != nil { + in, out := &in.PushoverConfigSelector, &out.PushoverConfigSelector + *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.Template != nil { + in, out := &in.Template, &out.Template + *out = new(string) + **out = **in + } + if in.Profiles != nil { + in, out := &in.Profiles, &out.Profiles + *out = make([]*PushoverUserProfile, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(PushoverUserProfile) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PushoverReceiver. +func (in *PushoverReceiver) DeepCopy() *PushoverReceiver { + if in == nil { + return nil + } + out := new(PushoverReceiver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PushoverUserProfile) DeepCopyInto(out *PushoverUserProfile) { + *out = *in + if in.UserKey != nil { + in, out := &in.UserKey, &out.UserKey + *out = new(string) + **out = **in + } + if in.Devices != nil { + in, out := &in.Devices, &out.Devices + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Title != nil { + in, out := &in.Title, &out.Title + *out = new(string) + **out = **in + } + if in.Sound != nil { + in, out := &in.Sound, &out.Sound + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PushoverUserProfile. +func (in *PushoverUserProfile) DeepCopy() *PushoverUserProfile { + if in == nil { + return nil + } + out := new(PushoverUserProfile) + in.DeepCopyInto(out) + 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) + } + if in.Sms != nil { + in, out := &in.Sms, &out.Sms + *out = new(SmsReceiver) + (*in).DeepCopyInto(*out) + } + if in.Pushover != nil { + in, out := &in.Pushover, &out.Pushover + *out = new(PushoverReceiver) + (*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(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.TenantReceiverSelector != nil { + in, out := &in.TenantReceiverSelector, &out.TenantReceiverSelector + *out = new(metav1.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 *Sidecar) DeepCopyInto(out *Sidecar) { + *out = *in + if in.Container != nil { + in, out := &in.Container, &out.Container + *out = new(v1.Container) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sidecar. +func (in *Sidecar) DeepCopy() *Sidecar { + if in == nil { + return nil + } + out := new(Sidecar) + 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 + 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(Credential) + (*in).DeepCopyInto(*out) + } +} + +// 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 +} + +// 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 + 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) + } + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(string) + **out = **in + } +} + +// 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 +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SmsConfig) DeepCopyInto(out *SmsConfig) { + *out = *in + if in.Providers != nil { + in, out := &in.Providers, &out.Providers + *out = new(Providers) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SmsConfig. +func (in *SmsConfig) DeepCopy() *SmsConfig { + if in == nil { + return nil + } + out := new(SmsConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SmsOptions) DeepCopyInto(out *SmsOptions) { + *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 SmsOptions. +func (in *SmsOptions) DeepCopy() *SmsOptions { + if in == nil { + return nil + } + out := new(SmsOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SmsReceiver) DeepCopyInto(out *SmsReceiver) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.SmsConfigSelector != nil { + in, out := &in.SmsConfigSelector, &out.SmsConfigSelector + *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.PhoneNumbers != nil { + in, out := &in.PhoneNumbers, &out.PhoneNumbers + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SmsReceiver. +func (in *SmsReceiver) DeepCopy() *SmsReceiver { + if in == nil { + return nil + } + out := new(SmsReceiver) + 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(Credential) + (*in).DeepCopyInto(*out) + } + 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 *TencentSMS) DeepCopyInto(out *TencentSMS) { + *out = *in + if in.SecretId != nil { + in, out := &in.SecretId, &out.SecretId + *out = new(Credential) + (*in).DeepCopyInto(*out) + } + if in.SecretKey != nil { + in, out := &in.SecretKey, &out.SecretKey + *out = new(Credential) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TencentSMS. +func (in *TencentSMS) DeepCopy() *TencentSMS { + if in == nil { + return nil + } + out := new(TencentSMS) + 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 *ValueSource) DeepCopyInto(out *ValueSource) { + *out = *in + if in.SecretKeyRef != nil { + in, out := &in.SecretKeyRef, &out.SecretKeyRef + *out = new(SecretKeySelector) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValueSource. +func (in *ValueSource) DeepCopy() *ValueSource { + if in == nil { + return nil + } + out := new(ValueSource) + 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 + 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. +func (in *WebhookConfig) DeepCopy() *WebhookConfig { + if in == nil { + return nil + } + out := new(WebhookConfig) + 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 + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.WebhookConfigSelector != nil { + in, out := &in.WebhookConfigSelector, &out.WebhookConfigSelector + *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.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) + } + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(string) + **out = **in + } +} + +// 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 +} + +// 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 + 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(Credential) + (*in).DeepCopyInto(*out) + } +} + +// 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 +} + +// 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 + 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) + } + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(string) + **out = **in + } + if in.TmplType != nil { + in, out := &in.TmplType, &out.TmplType + *out = new(string) + **out = **in + } +} + +// 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 +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 18b6ef3e0..ab555ee19 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1977,6 +1977,7 @@ kubesphere.io/api/constants kubesphere.io/api/devops/crdinstall kubesphere.io/api/devops/v1alpha1 kubesphere.io/api/devops/v1alpha3 +kubesphere.io/api/gateway/v1alpha1 kubesphere.io/api/iam/v1alpha2 kubesphere.io/api/network/calicov3 kubesphere.io/api/network/crdinstall