support clean up the notification configure when delete cluster (#5077)
This commit is contained in:
@@ -313,10 +313,10 @@ type Options struct {
|
||||
type NotificationManagerStatus struct {
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:scope=Cluster,shortName=nm,categories=notification-manager
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:storageversion
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// NotificationManager is the Schema for the notificationmanagers API
|
||||
type NotificationManager struct {
|
||||
@@ -327,7 +327,8 @@ type NotificationManager struct {
|
||||
Status NotificationManagerStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// NotificationManagerList contains a list of NotificationManager
|
||||
type NotificationManagerList struct {
|
||||
|
||||
@@ -17,6 +17,10 @@ limitations under the License.
|
||||
package v2beta2
|
||||
|
||||
const (
|
||||
ResourceKindNotificationManager = "NotificationManagers"
|
||||
ResourcesSingularNotificationManager = "notificationmanager"
|
||||
ResourcesPluralNotificationManager = "notificationmanagers"
|
||||
|
||||
ResourceKindConfig = "Configs"
|
||||
ResourcesSingularConfig = "config"
|
||||
ResourcesPluralConfig = "configs"
|
||||
|
||||
22
staging/src/kubesphere.io/api/types/v1beta2/doc.go
Normal file
22
staging/src/kubesphere.io/api/types/v1beta2/doc.go
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:conversion-gen=kubesphere.io/api/types
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=types.kubefed.io
|
||||
package v1beta2
|
||||
@@ -30,13 +30,13 @@ const (
|
||||
FederatedNotificationConfigKind = "FederatedNotificationConfig"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +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
|
||||
// +kubebuilder:storageversion
|
||||
|
||||
type FederatedNotificationConfig struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -57,8 +57,8 @@ type NotificationConfigTemplate struct {
|
||||
Spec v2beta2.ConfigSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// FederatedNotificationConfigList contains a list of federatednotificationconfiglists
|
||||
type FederatedNotificationConfigList struct {
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
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 v1beta2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"kubesphere.io/api/notification/v2beta2"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourcePluralFederatedNotificationManager = "federatednotificationmanagers"
|
||||
ResourceSingularFederatedNotificationManager = "federatednotificationmanager"
|
||||
FederatedNotificationManagerKind = "FederatedNotificationManager"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:resource:scope=Cluster
|
||||
// +kubebuilder:subresource:status
|
||||
|
||||
type FederatedNotificationManager struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec FederatedNotificationManagerSpec `json:"spec"`
|
||||
|
||||
Status *GenericFederatedStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type FederatedNotificationManagerSpec struct {
|
||||
Template NotificationManagerTemplate `json:"template"`
|
||||
Placement GenericPlacementFields `json:"placement"`
|
||||
Overrides []GenericOverrideItem `json:"overrides,omitempty"`
|
||||
}
|
||||
|
||||
type NotificationManagerTemplate struct {
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec v2beta2.NotificationManagerSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// FederatedNotificationManagerList contains a list of federatednotificationmanagerlists
|
||||
type FederatedNotificationManagerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []FederatedNotificationManager `json:"items"`
|
||||
}
|
||||
@@ -30,12 +30,13 @@ const (
|
||||
FederatedNotificationReceiverKind = "FederatedNotificationReceiver"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:resource:scope=Cluster
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:storageversion
|
||||
|
||||
type FederatedNotificationReceiver struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -56,8 +57,8 @@ type NotificationReceiverTemplate struct {
|
||||
Spec v2beta2.ReceiverSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// FederatedNotificationReceiverList contains a list of federatednotificationreceiverlists
|
||||
type FederatedNotificationReceiverList struct {
|
||||
|
||||
@@ -27,12 +27,13 @@ const (
|
||||
FederatedNotificationRouterKind = "FederatedNotificationRouter"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +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 FederatedNotificationRouter struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -53,8 +54,8 @@ type NotificationRouterTemplate struct {
|
||||
Spec v2beta2.RouterSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// FederatedNotificationRouterList contains a list of federatednotificationrouterlists
|
||||
type FederatedNotificationRouterList struct {
|
||||
|
||||
@@ -27,12 +27,13 @@ const (
|
||||
FederatedNotificationSilenceKind = "FederatedNotificationSilence"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +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 FederatedNotificationSilence struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -53,8 +54,8 @@ type NotificationSilenceTemplate struct {
|
||||
Spec v2beta2.SilenceSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// FederatedNotificationSilenceList contains a list of federatednotificationsilencelists
|
||||
type FederatedNotificationSilenceList struct {
|
||||
|
||||
@@ -45,6 +45,8 @@ func Resource(resource string) schema.GroupResource {
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(
|
||||
&FederatedNotificationManager{},
|
||||
&FederatedNotificationManagerList{},
|
||||
&FederatedNotificationConfig{},
|
||||
&FederatedNotificationConfigList{},
|
||||
&FederatedNotificationReceiver{},
|
||||
|
||||
@@ -129,6 +129,93 @@ func (in *FederatedNotificationConfigSpec) DeepCopy() *FederatedNotificationConf
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FederatedNotificationManager) DeepCopyInto(out *FederatedNotificationManager) {
|
||||
*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 FederatedNotificationManager.
|
||||
func (in *FederatedNotificationManager) DeepCopy() *FederatedNotificationManager {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedNotificationManager)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FederatedNotificationManager) 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 *FederatedNotificationManagerList) DeepCopyInto(out *FederatedNotificationManagerList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]FederatedNotificationManager, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederatedNotificationManagerList.
|
||||
func (in *FederatedNotificationManagerList) DeepCopy() *FederatedNotificationManagerList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedNotificationManagerList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FederatedNotificationManagerList) 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 *FederatedNotificationManagerSpec) DeepCopyInto(out *FederatedNotificationManagerSpec) {
|
||||
*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 FederatedNotificationManagerSpec.
|
||||
func (in *FederatedNotificationManagerSpec) DeepCopy() *FederatedNotificationManagerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FederatedNotificationManagerSpec)
|
||||
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
|
||||
@@ -630,6 +717,23 @@ func (in *NotificationConfigTemplate) DeepCopy() *NotificationConfigTemplate {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NotificationManagerTemplate) DeepCopyInto(out *NotificationManagerTemplate) {
|
||||
*out = *in
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationManagerTemplate.
|
||||
func (in *NotificationManagerTemplate) DeepCopy() *NotificationManagerTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NotificationManagerTemplate)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user