diff --git a/go.mod b/go.mod index 9cd988d52..102ee9c64 100644 --- a/go.mod +++ b/go.mod @@ -32,6 +32,7 @@ require ( k8s.io/apiserver v0.30.2 k8s.io/client-go v0.30.2 k8s.io/klog/v2 v2.130.1 + k8s.io/kube-aggregator v0.30.2 k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 kmodules.xyz/authorizer v0.29.1 kmodules.xyz/client-go v0.30.42 diff --git a/go.sum b/go.sum index 73744fe55..23560d47c 100644 --- a/go.sum +++ b/go.sum @@ -766,6 +766,8 @@ k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kms v0.30.2 h1:VSZILO/tkzrz5Tu2j+yFQZ2Dc5JerQZX2GqhFJbQrfw= k8s.io/kms v0.30.2/go.mod h1:GrMurD0qk3G4yNgGcsCEmepqf9KyyIrTXYR2lyUOJC4= +k8s.io/kube-aggregator v0.30.2 h1:0+yk/ED6foCprY8VmkDPUhngjaAPKsNTXB/UrtvbIz0= +k8s.io/kube-aggregator v0.30.2/go.mod h1:EhqCfDdxysNWXk1wRL9SEHAdo1DKl6EULQagztkBcXE= k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b h1:Q9xmGWBvOGd8UJyccgpYlLosk/JlfP3xQLNkQlHJeXw= k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b/go.mod h1:UxDHUPsUwTOOxSU+oXURfFBcAS6JwiRXTYqYwfuGowc= k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCIXHaathvJg1C3ak= diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 242b64f01..ba1f83a1e 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -27,8 +27,9 @@ import ( "go.openviz.dev/apimachinery/apis/ui" uiinstall "go.openviz.dev/apimachinery/apis/ui/install" uiapi "go.openviz.dev/apimachinery/apis/ui/v1alpha1" + alertmanagercontroller "go.openviz.dev/grafana-tools/pkg/controllers/alertmanager" namespacecontroller "go.openviz.dev/grafana-tools/pkg/controllers/namespace" - promtehsucontroller "go.openviz.dev/grafana-tools/pkg/controllers/prometheus" + prometheuscontroller "go.openviz.dev/grafana-tools/pkg/controllers/prometheus" "go.openviz.dev/grafana-tools/pkg/controllers/ranchertoken" servicemonitorcontroller "go.openviz.dev/grafana-tools/pkg/controllers/servicemonitor" "go.openviz.dev/grafana-tools/pkg/detector" @@ -36,6 +37,7 @@ import ( "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring" monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + monitoringv1beta1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1" core "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,6 +51,7 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" "k8s.io/klog/v2" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" "kmodules.xyz/authorizer" "kmodules.xyz/client-go/apiextensions" clustermeta "kmodules.xyz/client-go/cluster" @@ -74,7 +77,9 @@ func init() { uiinstall.Install(Scheme) openvizinstall.Install(Scheme) utilruntime.Must(clientgoscheme.AddToScheme(Scheme)) + utilruntime.Must(apiregistrationv1.AddToScheme(Scheme)) utilruntime.Must(monitoringv1.AddToScheme(Scheme)) + utilruntime.Must(monitoringv1beta1.AddToScheme(Scheme)) utilruntime.Must(appcatalogapi.AddToScheme(Scheme)) utilruntime.Must(chartsapi.AddToScheme(Scheme)) utilruntime.Must(apiextensionsv1.AddToScheme(Scheme)) @@ -174,9 +179,9 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { return nil, err } - var bc *promtehsucontroller.Client + var bc *prometheuscontroller.Client if c.ExtraConfig.BaseURL != "" && c.ExtraConfig.Token != "" { - bc, err = promtehsucontroller.NewClient(c.ExtraConfig.BaseURL, c.ExtraConfig.Token, c.ExtraConfig.CACert) + bc, err = prometheuscontroller.NewClient(c.ExtraConfig.BaseURL, c.ExtraConfig.Token, c.ExtraConfig.CACert) if err != nil { return nil, err } @@ -187,7 +192,8 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { os.Exit(1) } - d := detector.New(mgr.GetClient()) + promDetector := detector.NewPrometheusDetector(mgr.GetClient()) + amgrDetector := detector.NewAlertmanagerDetector(mgr.GetClient()) if c.ExtraConfig.RancherAuthSecret != "" { if err = ranchertoken.NewTokenRefresher( @@ -208,25 +214,39 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { bc, cid, c.ExtraConfig.HubUID, - d, + promDetector, ).SetupWithManager(mgr); err != nil { klog.Error(err, "unable to create controller", "controller", "ClientOrg") os.Exit(1) } - if err = promtehsucontroller.NewReconciler( + if err = prometheuscontroller.NewReconciler( mgr.GetClient(), bc, cid, c.ExtraConfig.HubUID, c.ExtraConfig.RancherAuthSecret, - d, + promDetector, ).SetupWithManager(mgr); err != nil { klog.Error(err, "unable to create controller", "controller", "Prometheus") os.Exit(1) } }) + apiextensions.RegisterSetup(schema.GroupKind{ + Group: monitoring.GroupName, + Kind: monitoringv1.AlertmanagersKind, + }, func(ctx context.Context, mgr ctrl.Manager) { + if err = alertmanagercontroller.NewReconciler( + mgr.GetClient(), + cid, + amgrDetector, + ).SetupWithManager(mgr); err != nil { + klog.Error(err, "unable to create controller", "controller", "Alertmanagers") + os.Exit(1) + } + }) + apiextensions.RegisterSetup(schema.GroupKind{ Group: monitoring.GroupName, Kind: monitoringv1.ServiceMonitorsKind, @@ -242,7 +262,7 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { if err = servicemonitorcontroller.NewFederationReconciler( c.ExtraConfig.ClientConfig, mgr.GetClient(), - d, + promDetector, ).SetupWithManager(mgr); err != nil { klog.Error(err, "unable to create controller", " federation controller", "ServiceMonitor") os.Exit(1) @@ -302,7 +322,7 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(ui.GroupName, Scheme, metav1.ParameterCodec, Codecs) v1alpha1storage := map[string]rest.Storage{} - v1alpha1storage[uiapi.ResourceDashboardGroups] = dashgroupstorage.NewStorage(ctrlClient, rbacAuthorizer, d) + v1alpha1storage[uiapi.ResourceDashboardGroups] = dashgroupstorage.NewStorage(ctrlClient, rbacAuthorizer, promDetector) apiGroupInfo.VersionedResourcesStorageMap["v1alpha1"] = v1alpha1storage if err := s.GenericAPIServer.InstallAPIGroup(&apiGroupInfo); err != nil { diff --git a/pkg/controllers/alertmanager/alertmanager_controller.go b/pkg/controllers/alertmanager/alertmanager_controller.go new file mode 100644 index 000000000..fae314609 --- /dev/null +++ b/pkg/controllers/alertmanager/alertmanager_controller.go @@ -0,0 +1,199 @@ +/* +Copyright AppsCode Inc. and Contributors + +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 alertmanager + +import ( + "context" + "fmt" + + "go.openviz.dev/grafana-tools/pkg/detector" + + monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + monitoringv1beta1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/klog/v2" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" + "k8s.io/utils/ptr" + cu "kmodules.xyz/client-go/client" + meta_util "kmodules.xyz/client-go/meta" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/builder" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +// v1alpha1.inbox.monitoring.appscode.com monitoring/inbox-agent +// Grant permission to alertmanager to call webhook + +const ( + inboxAPIServiceGroup = "inbox.monitoring.appscode.com" + amcfgInboxAgent = "inbox-agent" +) + +var selfNamespace = meta_util.PodNamespace() + +var defaultPresetsLabels = map[string]string{ + "charts.x-helm.dev/is-default-preset": "true", +} + +// AlertmanagerReconciler reconciles an Alertmanager object +type AlertmanagerReconciler struct { + kc client.Client + scheme *runtime.Scheme + clusterUID string + d detector.AlertmanagerDetector +} + +func NewReconciler(kc client.Client, clusterUID string, d detector.AlertmanagerDetector) *AlertmanagerReconciler { + return &AlertmanagerReconciler{ + kc: kc, + scheme: kc.Scheme(), + clusterUID: clusterUID, + d: d, + } +} + +// Reconcile is part of the main kubernetes reconciliation loop which aims to +// move the current state of the cluster closer to the desired state. +// TODO(user): Modify the Reconcile function to compare the state specified by +// the Alertmanager object against the actual cluster state, and then +// perform operations to make the cluster state reflect the state specified by +// the user. +// +// For more details, check Reconcile and its Result here: +// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.0/pkg/reconcile +func (r *AlertmanagerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + log := log.FromContext(ctx) + + var am monitoringv1.Alertmanager + if err := r.kc.Get(ctx, req.NamespacedName, &am); err != nil { + log.Error(err, "unable to fetch Alertmanager") + // we'll ignore not-found errors, since they can't be fixed by an immediate + // requeue (we'll need to wait for a new notification), and we can get them + // on deleted requests. + return ctrl.Result{}, client.IgnoreNotFound(err) + } + + if ready, err := r.d.Ready(); !ready { + return ctrl.Result{}, err + } + + if am.DeletionTimestamp != nil { + return ctrl.Result{}, nil + } + + apisvc, err := r.GetInboxAPIService(ctx) + if err != nil || apisvc == nil { + return ctrl.Result{}, err + } + + if err := r.SetupClusterForAlertmanager(ctx, &am, apisvc); err != nil { + log.Error(err, "unable to setup Alertmanager config") + return ctrl.Result{}, err + } + + return ctrl.Result{}, nil +} + +func (r *AlertmanagerReconciler) SetupClusterForAlertmanager(ctx context.Context, am *monitoringv1.Alertmanager, apisvc *apiregistrationv1.APIService) error { + cr := monitoringv1beta1.AlertmanagerConfig{ + ObjectMeta: metav1.ObjectMeta{ + Name: amcfgInboxAgent, + Namespace: am.Namespace, + }, + } + crvt, err := cu.CreateOrPatch(ctx, r.kc, &cr, func(in client.Object, createOp bool) client.Object { + obj := in.(*monitoringv1beta1.AlertmanagerConfig) + + obj.Spec.Receivers = []monitoringv1beta1.Receiver{ + { + Name: "webhook", + WebhookConfigs: []monitoringv1beta1.WebhookConfig{ + { + SendResolved: ptr.To(true), + URL: ptr.To(fmt.Sprintf("https://%s.%s.svc:443/alerts", apisvc.Spec.Service.Name, apisvc.Spec.Service.Namespace)), + HTTPConfig: &monitoringv1beta1.HTTPConfig{ + TLSConfig: &monitoringv1.SafeTLSConfig{ + InsecureSkipVerify: ptr.To(true), + }, + }, + MaxAlerts: 0, + }, + }, + }, + } + + obj.Spec.Route = &monitoringv1beta1.Route{ + GroupBy: []string{"job"}, + GroupWait: "10s", + GroupInterval: "1m", + Receiver: "webhook", + RepeatInterval: "1h", + } + + return obj + }) + if err != nil { + return err + } + klog.Infof("%s AlertmanagerConfig %s", crvt, cr.Name) + + return nil +} + +func (r *AlertmanagerReconciler) GetInboxAPIService(ctx context.Context) (*apiregistrationv1.APIService, error) { + var list apiregistrationv1.APIServiceList + err := r.kc.List(ctx, &list) + if err != nil { + return nil, err + } + for _, apisvc := range list.Items { + if apisvc.Spec.Group == inboxAPIServiceGroup { + return &apisvc, nil + } + } + return nil, nil +} + +// SetupWithManager sets up the controller with the Manager. +func (r *AlertmanagerReconciler) SetupWithManager(mgr ctrl.Manager) error { + stateHandler := handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, a client.Object) []reconcile.Request { + var amList monitoringv1.AlertmanagerList + err := r.kc.List(ctx, &amList) + if err != nil { + return nil + } + + var req []reconcile.Request + for _, am := range amList.Items { + req = append(req, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&am)}) + } + return req + }) + + return ctrl.NewControllerManagedBy(mgr). + For(&monitoringv1.Alertmanager{}). + Watches(&apiregistrationv1.APIService{}, stateHandler, builder.WithPredicates(predicate.NewPredicateFuncs(func(obj client.Object) bool { + apisvc := obj.(*apiregistrationv1.APIService) + return apisvc.Spec.Group == inboxAPIServiceGroup + }))). + Complete(r) +} diff --git a/pkg/controllers/namespace/namespace_controller.go b/pkg/controllers/namespace/namespace_controller.go index 4092dfdf5..7b46fccf8 100644 --- a/pkg/controllers/namespace/namespace_controller.go +++ b/pkg/controllers/namespace/namespace_controller.go @@ -62,10 +62,10 @@ type ClientOrgReconciler struct { bc *prometheus.Client clusterUID string hubUID string - d detector.Detector + d detector.PrometheusDetector } -func NewReconciler(kc client.Client, bc *prometheus.Client, clusterUID, hubUID string, d detector.Detector) *ClientOrgReconciler { +func NewReconciler(kc client.Client, bc *prometheus.Client, clusterUID, hubUID string, d detector.PrometheusDetector) *ClientOrgReconciler { return &ClientOrgReconciler{ kc: kc, scheme: kc.Scheme(), diff --git a/pkg/controllers/prometheus/prometheus_controller.go b/pkg/controllers/prometheus/prometheus_controller.go index 083125edd..5fe7d8e14 100644 --- a/pkg/controllers/prometheus/prometheus_controller.go +++ b/pkg/controllers/prometheus/prometheus_controller.go @@ -86,10 +86,10 @@ type PrometheusReconciler struct { clusterUID string hubUID string rancherAuthSecretName string - d detector.Detector + d detector.PrometheusDetector } -func NewReconciler(kc client.Client, bc *Client, clusterUID, hubUID, rancherAuthSecretName string, d detector.Detector) *PrometheusReconciler { +func NewReconciler(kc client.Client, bc *Client, clusterUID, hubUID, rancherAuthSecretName string, d detector.PrometheusDetector) *PrometheusReconciler { return &PrometheusReconciler{ kc: kc, scheme: kc.Scheme(), diff --git a/pkg/controllers/servicemonitor/federation_controller.go b/pkg/controllers/servicemonitor/federation_controller.go index fff290178..858d84f22 100644 --- a/pkg/controllers/servicemonitor/federation_controller.go +++ b/pkg/controllers/servicemonitor/federation_controller.go @@ -54,10 +54,10 @@ type FederationReconciler struct { cfg *rest.Config kc client.Client scheme *runtime.Scheme - d detector.Detector + d detector.PrometheusDetector } -func NewFederationReconciler(cfg *rest.Config, kc client.Client, d detector.Detector) *FederationReconciler { +func NewFederationReconciler(cfg *rest.Config, kc client.Client, d detector.PrometheusDetector) *FederationReconciler { return &FederationReconciler{ cfg: cfg, kc: kc, diff --git a/pkg/detector/alertmanager.go b/pkg/detector/alertmanager.go new file mode 100644 index 000000000..b87972284 --- /dev/null +++ b/pkg/detector/alertmanager.go @@ -0,0 +1,166 @@ +/* +Copyright AppsCode Inc. and Contributors + +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 detector + +import ( + "context" + "sync" + + "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring" + monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + clustermeta "kmodules.xyz/client-go/cluster" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +var GVKAlertmanager = schema.GroupVersionKind{ + Group: monitoring.GroupName, + Version: monitoringv1.Version, + Kind: "Alertmanager", +} + +type AlertmanagerDetector interface { + Ready() (bool, error) + RancherManaged() bool + Federated() bool + IsDefault(key types.NamespacedName) bool +} + +func NewAlertmanagerDetector(kc client.Client) AlertmanagerDetector { + return &lazyAlertmanager{kc: kc} +} + +type lazyAlertmanager struct { + kc client.Client + delegated AlertmanagerDetector + mu sync.Mutex +} + +var _ AlertmanagerDetector = &lazyAlertmanager{} + +func (l *lazyAlertmanager) detect() error { + var list unstructured.UnstructuredList + list.SetGroupVersionKind(GVKAlertmanager) + err := l.kc.List(context.TODO(), &list) + if err != nil { + return err + } + if len(list.Items) == 0 { + return errUnknown + } + + if clustermeta.IsRancherManaged(l.kc.RESTMapper()) { + for _, obj := range list.Items { + if obj.GetNamespace() == clustermeta.RancherMonitoringNamespace && + obj.GetName() == clustermeta.RancherMonitoringAlertmanager { + l.delegated = &federatedAlertmanager{} // rancher style federatedAlertmanager + return nil + } + } + + // rancher cluster but using alertmanager directly + l.delegated = &standaloneAlertmanager{rancher: true, singleton: len(list.Items) == 1} + return nil + } + + // using alertmanager directly and not rancher managed + l.delegated = &standaloneAlertmanager{rancher: false, singleton: len(list.Items) == 1} + return nil +} + +func (l *lazyAlertmanager) Ready() (bool, error) { + l.mu.Lock() + defer l.mu.Unlock() + if l.delegated == nil { + err := l.detect() + return err == nil, err + } + return true, nil +} + +func (l *lazyAlertmanager) RancherManaged() bool { + l.mu.Lock() + defer l.mu.Unlock() + if l.delegated == nil { + panic("NotReady") + } + return l.delegated.RancherManaged() +} + +func (l *lazyAlertmanager) Federated() bool { + l.mu.Lock() + defer l.mu.Unlock() + if l.delegated == nil { + panic("NotReady") + } + return l.delegated.Federated() +} + +func (l *lazyAlertmanager) IsDefault(key types.NamespacedName) bool { + l.mu.Lock() + defer l.mu.Unlock() + if l.delegated == nil { + panic("NotReady") + } + return l.delegated.IsDefault(key) +} + +type federatedAlertmanager struct{} + +var _ AlertmanagerDetector = federatedAlertmanager{} + +func (f federatedAlertmanager) Ready() (bool, error) { + return true, nil +} + +func (f federatedAlertmanager) RancherManaged() bool { + return true +} + +func (f federatedAlertmanager) Federated() bool { + return true +} + +func (f federatedAlertmanager) IsDefault(key types.NamespacedName) bool { + return key.Namespace == clustermeta.RancherMonitoringNamespace && + key.Name == clustermeta.RancherMonitoringAlertmanager +} + +type standaloneAlertmanager struct { + rancher bool + singleton bool +} + +var _ AlertmanagerDetector = standaloneAlertmanager{} + +func (s standaloneAlertmanager) Ready() (bool, error) { + return true, nil +} + +func (s standaloneAlertmanager) RancherManaged() bool { + return s.rancher +} + +func (s standaloneAlertmanager) Federated() bool { + return false +} + +func (s standaloneAlertmanager) IsDefault(key types.NamespacedName) bool { + return s.singleton +} diff --git a/pkg/detector/api.go b/pkg/detector/prometheus.go similarity index 66% rename from pkg/detector/api.go rename to pkg/detector/prometheus.go index 6d446dd4c..3bfaabea7 100644 --- a/pkg/detector/api.go +++ b/pkg/detector/prometheus.go @@ -36,28 +36,28 @@ var GVKPrometheus = schema.GroupVersionKind{ Kind: "Prometheus", } -type Detector interface { +type PrometheusDetector interface { Ready() (bool, error) RancherManaged() bool Federated() bool IsDefault(key types.NamespacedName) bool } -func New(kc client.Client) Detector { - return &lazy{kc: kc} +func NewPrometheusDetector(kc client.Client) PrometheusDetector { + return &lazyPrometheus{kc: kc} } var errUnknown = errors.New("unknown") -type lazy struct { +type lazyPrometheus struct { kc client.Client - delegated Detector + delegated PrometheusDetector mu sync.Mutex } -var _ Detector = &lazy{} +var _ PrometheusDetector = &lazyPrometheus{} -func (l *lazy) detect() error { +func (l *lazyPrometheus) detect() error { var list unstructured.UnstructuredList list.SetGroupVersionKind(GVKPrometheus) err := l.kc.List(context.TODO(), &list) @@ -72,22 +72,22 @@ func (l *lazy) detect() error { for _, obj := range list.Items { if obj.GetNamespace() == clustermeta.RancherMonitoringNamespace && obj.GetName() == clustermeta.RancherMonitoringPrometheus { - l.delegated = &federated{} // rancher style federated + l.delegated = &federatedPrometheus{} // rancher style federatedPrometheus return nil } } // rancher cluster but using prometheus directly - l.delegated = &standalone{rancher: true, singleton: len(list.Items) == 1} + l.delegated = &standalonePrometheus{rancher: true, singleton: len(list.Items) == 1} return nil } // using prometheus directly and not rancher managed - l.delegated = &standalone{rancher: false, singleton: len(list.Items) == 1} + l.delegated = &standalonePrometheus{rancher: false, singleton: len(list.Items) == 1} return nil } -func (l *lazy) Ready() (bool, error) { +func (l *lazyPrometheus) Ready() (bool, error) { l.mu.Lock() defer l.mu.Unlock() if l.delegated == nil { @@ -97,7 +97,7 @@ func (l *lazy) Ready() (bool, error) { return true, nil } -func (l *lazy) RancherManaged() bool { +func (l *lazyPrometheus) RancherManaged() bool { l.mu.Lock() defer l.mu.Unlock() if l.delegated == nil { @@ -106,7 +106,7 @@ func (l *lazy) RancherManaged() bool { return l.delegated.RancherManaged() } -func (l *lazy) Federated() bool { +func (l *lazyPrometheus) Federated() bool { l.mu.Lock() defer l.mu.Unlock() if l.delegated == nil { @@ -115,7 +115,7 @@ func (l *lazy) Federated() bool { return l.delegated.Federated() } -func (l *lazy) IsDefault(key types.NamespacedName) bool { +func (l *lazyPrometheus) IsDefault(key types.NamespacedName) bool { l.mu.Lock() defer l.mu.Unlock() if l.delegated == nil { @@ -124,46 +124,46 @@ func (l *lazy) IsDefault(key types.NamespacedName) bool { return l.delegated.IsDefault(key) } -type federated struct{} +type federatedPrometheus struct{} -var _ Detector = federated{} +var _ PrometheusDetector = federatedPrometheus{} -func (f federated) Ready() (bool, error) { +func (f federatedPrometheus) Ready() (bool, error) { return true, nil } -func (f federated) RancherManaged() bool { +func (f federatedPrometheus) RancherManaged() bool { return true } -func (f federated) Federated() bool { +func (f federatedPrometheus) Federated() bool { return true } -func (f federated) IsDefault(key types.NamespacedName) bool { +func (f federatedPrometheus) IsDefault(key types.NamespacedName) bool { return key.Namespace == clustermeta.RancherMonitoringNamespace && key.Name == clustermeta.RancherMonitoringPrometheus } -type standalone struct { +type standalonePrometheus struct { rancher bool singleton bool } -var _ Detector = standalone{} +var _ PrometheusDetector = standalonePrometheus{} -func (s standalone) Ready() (bool, error) { +func (s standalonePrometheus) Ready() (bool, error) { return true, nil } -func (s standalone) RancherManaged() bool { +func (s standalonePrometheus) RancherManaged() bool { return s.rancher } -func (s standalone) Federated() bool { +func (s standalonePrometheus) Federated() bool { return false } -func (s standalone) IsDefault(key types.NamespacedName) bool { +func (s standalonePrometheus) IsDefault(key types.NamespacedName) bool { return s.singleton } diff --git a/pkg/registry/ui/dashboardgroup/storage.go b/pkg/registry/ui/dashboardgroup/storage.go index 64518d124..50f528045 100644 --- a/pkg/registry/ui/dashboardgroup/storage.go +++ b/pkg/registry/ui/dashboardgroup/storage.go @@ -52,7 +52,7 @@ import ( type Storage struct { kc client.Client a authorizer.Authorizer - d detector.Detector + d detector.PrometheusDetector gr schema.GroupResource } @@ -64,7 +64,7 @@ var ( _ rest.SingularNameProvider = &Storage{} ) -func NewStorage(kc client.Client, a authorizer.Authorizer, d detector.Detector) *Storage { +func NewStorage(kc client.Client, a authorizer.Authorizer, d detector.PrometheusDetector) *Storage { return &Storage{ kc: kc, a: a, diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/alertmanager_config_conversion.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/alertmanager_config_conversion.go new file mode 100644 index 000000000..9e7e59f6e --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/alertmanager_config_conversion.go @@ -0,0 +1,18 @@ +// Copyright 2022 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +// Hub marks this type as a conversion hub. +func (*AlertmanagerConfig) Hub() {} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go new file mode 100644 index 000000000..de1f852ca --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go @@ -0,0 +1,1215 @@ +// Copyright 2020 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + "encoding/json" + "errors" + "fmt" + "html/template" + "regexp" + "strings" + + monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + + v1 "k8s.io/api/core/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +const ( + Version = "v1alpha1" + + AlertmanagerConfigKind = "AlertmanagerConfig" + AlertmanagerConfigName = "alertmanagerconfigs" + AlertmanagerConfigKindKey = "alertmanagerconfig" +) + +// +genclient +// +k8s:openapi-gen=true +// +kubebuilder:resource:categories="prometheus-operator",shortName="amcfg" +// +kubebuilder:storageversion + +// AlertmanagerConfig configures the Prometheus Alertmanager, +// specifying how alerts should be grouped, inhibited and notified to external systems. +type AlertmanagerConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AlertmanagerConfigSpec `json:"spec"` +} + +// AlertmanagerConfigList is a list of AlertmanagerConfig. +// +k8s:openapi-gen=true +type AlertmanagerConfigList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of AlertmanagerConfig + Items []*AlertmanagerConfig `json:"items"` +} + +// AlertmanagerConfigSpec is a specification of the desired behavior of the Alertmanager configuration. +// By definition, the Alertmanager configuration only applies to alerts for which +// the `namespace` label is equal to the namespace of the AlertmanagerConfig resource. +type AlertmanagerConfigSpec struct { + // The Alertmanager route definition for alerts matching the resource's + // namespace. If present, it will be added to the generated Alertmanager + // configuration as a first-level route. + // +optional + Route *Route `json:"route"` + // List of receivers. + // +optional + Receivers []Receiver `json:"receivers"` + // List of inhibition rules. The rules will only apply to alerts matching + // the resource's namespace. + // +optional + InhibitRules []InhibitRule `json:"inhibitRules,omitempty"` + // List of MuteTimeInterval specifying when the routes should be muted. + // +optional + MuteTimeIntervals []MuteTimeInterval `json:"muteTimeIntervals,omitempty"` +} + +// Route defines a node in the routing tree. +type Route struct { + // Name of the receiver for this route. If not empty, it should be listed in + // the `receivers` field. + // +optional + Receiver string `json:"receiver"` + // List of labels to group by. + // Labels must not be repeated (unique list). + // Special label "..." (aggregate by all possible labels), if provided, must be the only element in the list. + // +optional + GroupBy []string `json:"groupBy,omitempty"` + // How long to wait before sending the initial notification. + // Must match the regular expression`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // Example: "30s" + // +optional + GroupWait string `json:"groupWait,omitempty"` + // How long to wait before sending an updated notification. + // Must match the regular expression`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // Example: "5m" + // +optional + GroupInterval string `json:"groupInterval,omitempty"` + // How long to wait before repeating the last notification. + // Must match the regular expression`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // Example: "4h" + // +optional + RepeatInterval string `json:"repeatInterval,omitempty"` + // List of matchers that the alert's labels should match. For the first + // level route, the operator removes any existing equality and regexp + // matcher on the `namespace` label and adds a `namespace: ` matcher. + // +optional + Matchers []Matcher `json:"matchers,omitempty"` + // Boolean indicating whether an alert should continue matching subsequent + // sibling nodes. It will always be overridden to true for the first-level + // route by the Prometheus operator. + // +optional + Continue bool `json:"continue,omitempty"` + // Child routes. + Routes []apiextensionsv1.JSON `json:"routes,omitempty"` + // Note: this comment applies to the field definition above but appears + // below otherwise it gets included in the generated manifest. + // CRD schema doesn't support self-referential types for now (see + // https://github.com/kubernetes/kubernetes/issues/62872). We have to use + // an alternative type to circumvent the limitation. The downside is that + // the Kube API can't validate the data beyond the fact that it is a valid + // JSON representation. + // MuteTimeIntervals is a list of MuteTimeInterval names that will mute this route when matched, + // +optional + MuteTimeIntervals []string `json:"muteTimeIntervals,omitempty"` + // ActiveTimeIntervals is a list of MuteTimeInterval names when this route should be active. + // +optional + ActiveTimeIntervals []string `json:"activeTimeIntervals,omitempty"` +} + +// ChildRoutes extracts the child routes. +func (r *Route) ChildRoutes() ([]Route, error) { + out := make([]Route, len(r.Routes)) + + for i, v := range r.Routes { + if err := json.Unmarshal(v.Raw, &out[i]); err != nil { + return nil, fmt.Errorf("route[%d]: %w", i, err) + } + } + + return out, nil +} + +// Receiver defines one or more notification integrations. +type Receiver struct { + // Name of the receiver. Must be unique across all items from the list. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + // List of OpsGenie configurations. + OpsGenieConfigs []OpsGenieConfig `json:"opsgenieConfigs,omitempty"` + // List of PagerDuty configurations. + PagerDutyConfigs []PagerDutyConfig `json:"pagerdutyConfigs,omitempty"` + // List of Discord configurations. + // +optional + DiscordConfigs []DiscordConfig `json:"discordConfigs,omitempty"` + // List of Slack configurations. + SlackConfigs []SlackConfig `json:"slackConfigs,omitempty"` + // List of webhook configurations. + WebhookConfigs []WebhookConfig `json:"webhookConfigs,omitempty"` + // List of WeChat configurations. + WeChatConfigs []WeChatConfig `json:"wechatConfigs,omitempty"` + // List of Email configurations. + EmailConfigs []EmailConfig `json:"emailConfigs,omitempty"` + // List of VictorOps configurations. + VictorOpsConfigs []VictorOpsConfig `json:"victoropsConfigs,omitempty"` + // List of Pushover configurations. + PushoverConfigs []PushoverConfig `json:"pushoverConfigs,omitempty"` + // List of SNS configurations + SNSConfigs []SNSConfig `json:"snsConfigs,omitempty"` + // List of Telegram configurations. + TelegramConfigs []TelegramConfig `json:"telegramConfigs,omitempty"` + // List of Webex configurations. + WebexConfigs []WebexConfig `json:"webexConfigs,omitempty"` + // List of MSTeams configurations. + // It requires Alertmanager >= 0.26.0. + MSTeamsConfigs []MSTeamsConfig `json:"msteamsConfigs,omitempty"` +} + +// PagerDutyConfig configures notifications via PagerDuty. +// See https://prometheus.io/docs/alerting/latest/configuration/#pagerduty_config +type PagerDutyConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the PagerDuty integration key (when using + // Events API v2). Either this field or `serviceKey` needs to be defined. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + RoutingKey *v1.SecretKeySelector `json:"routingKey,omitempty"` + // The secret's key that contains the PagerDuty service key (when using + // integration type "Prometheus"). Either this field or `routingKey` needs to + // be defined. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + ServiceKey *v1.SecretKeySelector `json:"serviceKey,omitempty"` + // The URL to send requests to. + // +optional + URL string `json:"url,omitempty"` + // Client identification. + // +optional + Client string `json:"client,omitempty"` + // Backlink to the sender of notification. + // +optional + ClientURL string `json:"clientURL,omitempty"` + // Description of the incident. + // +optional + Description string `json:"description,omitempty"` + // Severity of the incident. + // +optional + Severity string `json:"severity,omitempty"` + // The class/type of the event. + // +optional + Class string `json:"class,omitempty"` + // A cluster or grouping of sources. + // +optional + Group string `json:"group,omitempty"` + // The part or component of the affected system that is broken. + // +optional + Component string `json:"component,omitempty"` + // Arbitrary key/value pairs that provide further detail about the incident. + // +optional + Details []KeyValue `json:"details,omitempty"` + // A list of image details to attach that provide further detail about an incident. + // +optional + PagerDutyImageConfigs []PagerDutyImageConfig `json:"pagerDutyImageConfigs,omitempty"` + // A list of link details to attach that provide further detail about an incident. + // +optional + PagerDutyLinkConfigs []PagerDutyLinkConfig `json:"pagerDutyLinkConfigs,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + // Unique location of the affected system. + // +optional + Source *string `yaml:"source,omitempty" json:"source,omitempty"` +} + +// PagerDutyImageConfig attaches images to an incident +type PagerDutyImageConfig struct { + // Src of the image being attached to the incident + // +optional + Src string `json:"src,omitempty"` + // Optional URL; makes the image a clickable link. + // +optional + Href string `json:"href,omitempty"` + // Alt is the optional alternative text for the image. + // +optional + Alt string `json:"alt,omitempty"` +} + +// PagerDutyLinkConfig attaches text links to an incident +type PagerDutyLinkConfig struct { + // Href is the URL of the link to be attached + // +optional + Href string `json:"href,omitempty"` + // Text that describes the purpose of the link, and can be used as the link's text. + // +optional + Text string `json:"alt,omitempty"` +} + +// DiscordConfig configures notifications via Discord. +// See https://prometheus.io/docs/alerting/latest/configuration/#discord_config +type DiscordConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + + // The secret's key that contains the Discord webhook URL. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +required + APIURL v1.SecretKeySelector `json:"apiURL"` + + // The template of the message's title. + // +optional + Title *string `json:"title,omitempty"` + + // The template of the message's body. + // +optional + Message *string `json:"message,omitempty"` + + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// SlackConfig configures notifications via Slack. +// See https://prometheus.io/docs/alerting/latest/configuration/#slack_config +type SlackConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the Slack webhook URL. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APIURL *v1.SecretKeySelector `json:"apiURL,omitempty"` + // The channel or user to send notifications to. + // +optional + Channel string `json:"channel,omitempty"` + // +optional + Username string `json:"username,omitempty"` + // +optional + Color string `json:"color,omitempty"` + // +optional + Title string `json:"title,omitempty"` + // +optional + TitleLink string `json:"titleLink,omitempty"` + // +optional + Pretext string `json:"pretext,omitempty"` + // +optional + Text string `json:"text,omitempty"` + // A list of Slack fields that are sent with each notification. + // +optional + Fields []SlackField `json:"fields,omitempty"` + // +optional + ShortFields bool `json:"shortFields,omitempty"` + // +optional + Footer string `json:"footer,omitempty"` + // +optional + Fallback string `json:"fallback,omitempty"` + // +optional + CallbackID string `json:"callbackId,omitempty"` + // +optional + IconEmoji string `json:"iconEmoji,omitempty"` + // +optional + IconURL string `json:"iconURL,omitempty"` + // +optional + ImageURL string `json:"imageURL,omitempty"` + // +optional + ThumbURL string `json:"thumbURL,omitempty"` + // +optional + LinkNames bool `json:"linkNames,omitempty"` + // +optional + MrkdwnIn []string `json:"mrkdwnIn,omitempty"` + // A list of Slack actions that are sent with each notification. + // +optional + Actions []SlackAction `json:"actions,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// Validate ensures SlackConfig is valid. +func (sc *SlackConfig) Validate() error { + for _, action := range sc.Actions { + if err := action.Validate(); err != nil { + return err + } + } + + for _, field := range sc.Fields { + if err := field.Validate(); err != nil { + return err + } + } + + return nil +} + +// SlackAction configures a single Slack action that is sent with each +// notification. +// See https://api.slack.com/docs/message-attachments#action_fields and +// https://api.slack.com/docs/message-buttons for more information. +type SlackAction struct { + // +kubebuilder:validation:MinLength=1 + Type string `json:"type"` + // +kubebuilder:validation:MinLength=1 + Text string `json:"text"` + // +optional + URL string `json:"url,omitempty"` + // +optional + Style string `json:"style,omitempty"` + // +optional + Name string `json:"name,omitempty"` + // +optional + Value string `json:"value,omitempty"` + // +optional + ConfirmField *SlackConfirmationField `json:"confirm,omitempty"` +} + +// Validate ensures SlackAction is valid. +func (sa *SlackAction) Validate() error { + if sa.Type == "" { + return errors.New("missing type in Slack action configuration") + } + + if sa.Text == "" { + return errors.New("missing text in Slack action configuration") + } + + if sa.URL == "" && sa.Name == "" { + return errors.New("missing name or url in Slack action configuration") + } + + if sa.ConfirmField != nil { + if err := sa.ConfirmField.Validate(); err != nil { + return err + } + } + + return nil +} + +// SlackConfirmationField protect users from destructive actions or +// particularly distinguished decisions by asking them to confirm their button +// click one more time. +// See https://api.slack.com/docs/interactive-message-field-guide#confirmation_fields +// for more information. +type SlackConfirmationField struct { + // +kubebuilder:validation:MinLength=1 + Text string `json:"text"` + // +optional + Title string `json:"title,omitempty"` + // +optional + OkText string `json:"okText,omitempty"` + // +optional + DismissText string `json:"dismissText,omitempty"` +} + +// Validate ensures SlackConfirmationField is valid. +func (scf *SlackConfirmationField) Validate() error { + if scf.Text == "" { + return errors.New("missing text in Slack confirmation configuration") + } + return nil +} + +// SlackField configures a single Slack field that is sent with each notification. +// Each field must contain a title, value, and optionally, a boolean value to indicate if the field +// is short enough to be displayed next to other fields designated as short. +// See https://api.slack.com/docs/message-attachments#fields for more information. +type SlackField struct { + // +kubebuilder:validation:MinLength=1 + Title string `json:"title"` + // +kubebuilder:validation:MinLength=1 + Value string `json:"value"` + // +optional + Short *bool `json:"short,omitempty"` +} + +// Validate ensures SlackField is valid +func (sf *SlackField) Validate() error { + if sf.Title == "" { + return errors.New("missing title in Slack field configuration") + } + + if sf.Value == "" { + return errors.New("missing value in Slack field configuration") + } + + return nil +} + +// WebhookConfig configures notifications via a generic receiver supporting the webhook payload. +// See https://prometheus.io/docs/alerting/latest/configuration/#webhook_config +type WebhookConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The URL to send HTTP POST requests to. `urlSecret` takes precedence over + // `url`. One of `urlSecret` and `url` should be defined. + // +optional + URL *string `json:"url,omitempty"` + // The secret's key that contains the webhook URL to send HTTP requests to. + // `urlSecret` takes precedence over `url`. One of `urlSecret` and `url` + // should be defined. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + URLSecret *v1.SecretKeySelector `json:"urlSecret,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + // Maximum number of alerts to be sent per webhook message. When 0, all alerts are included. + // +optional + // +kubebuilder:validation:Minimum=0 + MaxAlerts int32 `json:"maxAlerts,omitempty"` +} + +// OpsGenieConfig configures notifications via OpsGenie. +// See https://prometheus.io/docs/alerting/latest/configuration/#opsgenie_config +type OpsGenieConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the OpsGenie API key. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APIKey *v1.SecretKeySelector `json:"apiKey,omitempty"` + // The URL to send OpsGenie API requests to. + // +optional + APIURL string `json:"apiURL,omitempty"` + // Alert text limited to 130 characters. + // +optional + Message string `json:"message,omitempty"` + // Description of the incident. + // +optional + Description string `json:"description,omitempty"` + // Backlink to the sender of the notification. + // +optional + Source string `json:"source,omitempty"` + // Comma separated list of tags attached to the notifications. + // +optional + Tags string `json:"tags,omitempty"` + // Additional alert note. + // +optional + Note string `json:"note,omitempty"` + // Priority level of alert. Possible values are P1, P2, P3, P4, and P5. + // +optional + Priority string `json:"priority,omitempty"` + // Whether to update message and description of the alert in OpsGenie if it already exists + // By default, the alert is never updated in OpsGenie, the new message only appears in activity log. + // +optional + UpdateAlerts *bool `json:"updateAlerts,omitempty"` + // A set of arbitrary key/value pairs that provide further detail about the incident. + // +optional + Details []KeyValue `json:"details,omitempty"` + // List of responders responsible for notifications. + // +optional + Responders []OpsGenieConfigResponder `json:"responders,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + // Optional field that can be used to specify which domain alert is related to. + // +optional + Entity string `json:"entity,omitempty"` + // Comma separated list of actions that will be available for the alert. + // +optional + Actions string `json:"actions,omitempty"` +} + +// Validate ensures OpsGenieConfig is valid +func (o *OpsGenieConfig) Validate() error { + for _, responder := range o.Responders { + if err := responder.Validate(); err != nil { + return err + } + } + return nil +} + +// OpsGenieConfigResponder defines a responder to an incident. +// One of `id`, `name` or `username` has to be defined. +type OpsGenieConfigResponder struct { + // ID of the responder. + // +optional + ID string `json:"id,omitempty"` + // Name of the responder. + // +optional + Name string `json:"name,omitempty"` + // Username of the responder. + // +optional + Username string `json:"username,omitempty"` + // Type of responder. + // +kubebuilder:validation:MinLength=1 + Type string `json:"type"` +} + +const opsgenieValidTypesRe = `^(team|teams|user|escalation|schedule)$` + +var opsgenieTypeMatcher = regexp.MustCompile(opsgenieValidTypesRe) + +// Validate ensures OpsGenieConfigResponder is valid. +func (r *OpsGenieConfigResponder) Validate() error { + if r.ID == "" && r.Name == "" && r.Username == "" { + return errors.New("responder must have at least an ID, a Name or an Username defined") + } + + if strings.Contains(r.Type, "{{") { + _, err := template.New("").Parse(r.Type) + if err != nil { + return fmt.Errorf("responder %v type is not a valid template: %w", r, err) + } + return nil + } + + if opsgenieTypeMatcher.MatchString(strings.ToLower(r.Type)) { + return nil + } + return fmt.Errorf("opsGenieConfig responder %v type does not match valid options %s", r, opsgenieValidTypesRe) +} + +// HTTPConfig defines a client HTTP configuration. +// See https://prometheus.io/docs/alerting/latest/configuration/#http_config +type HTTPConfig struct { + // Authorization header configuration for the client. + // This is mutually exclusive with BasicAuth and is only available starting from Alertmanager v0.22+. + // +optional + Authorization *monitoringv1.SafeAuthorization `json:"authorization,omitempty"` + // BasicAuth for the client. + // This is mutually exclusive with Authorization. If both are defined, BasicAuth takes precedence. + // +optional + BasicAuth *monitoringv1.BasicAuth `json:"basicAuth,omitempty"` + // OAuth2 client credentials used to fetch a token for the targets. + // +optional + OAuth2 *monitoringv1.OAuth2 `json:"oauth2,omitempty"` + // The secret's key that contains the bearer token to be used by the client + // for authentication. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + BearerTokenSecret *v1.SecretKeySelector `json:"bearerTokenSecret,omitempty"` + // TLS configuration for the client. + // +optional + TLSConfig *monitoringv1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // Optional proxy URL. + // +optional + ProxyURL string `json:"proxyURL,omitempty"` + // FollowRedirects specifies whether the client should follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` +} + +// WebexConfig configures notification via Cisco Webex +// See https://prometheus.io/docs/alerting/latest/configuration/#webex_config +type WebexConfig struct { + // Whether to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + + // The Webex Teams API URL i.e. https://webexapis.com/v1/messages + // Provide if different from the default API URL. + // +optional + APIURL *URL `json:"apiURL,omitempty"` + + // The HTTP client's configuration. + // You must supply the bot token via the `httpConfig.authorization` field. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + + // Message template + // +optional + Message *string `json:"message,omitempty"` + + // ID of the Webex Teams room where to send the messages. + // +kubebuilder:validation:MinLength=1 + // +required + RoomID string `json:"roomID"` +} + +// WeChatConfig configures notifications via WeChat. +// See https://prometheus.io/docs/alerting/latest/configuration/#wechat_config +type WeChatConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the WeChat API key. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APISecret *v1.SecretKeySelector `json:"apiSecret,omitempty"` + // The WeChat API URL. + // +optional + APIURL string `json:"apiURL,omitempty"` + // The corp id for authentication. + // +optional + CorpID string `json:"corpID,omitempty"` + // +optional + AgentID string `json:"agentID,omitempty"` + // +optional + ToUser string `json:"toUser,omitempty"` + // +optional + ToParty string `json:"toParty,omitempty"` + // +optional + ToTag string `json:"toTag,omitempty"` + // API request data as defined by the WeChat API. + Message string `json:"message,omitempty"` + // +optional + MessageType string `json:"messageType,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// EmailConfig configures notifications via Email. +type EmailConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The email address to send notifications to. + // +optional + To string `json:"to,omitempty"` + // The sender address. + // +optional + From string `json:"from,omitempty"` + // The hostname to identify to the SMTP server. + // +optional + Hello string `json:"hello,omitempty"` + // The SMTP host and port through which emails are sent. E.g. example.com:25 + // +optional + Smarthost string `json:"smarthost,omitempty"` + // The username to use for authentication. + // +optional + AuthUsername string `json:"authUsername,omitempty"` + // The secret's key that contains the password to use for authentication. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + AuthPassword *v1.SecretKeySelector `json:"authPassword,omitempty"` + // The secret's key that contains the CRAM-MD5 secret. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + AuthSecret *v1.SecretKeySelector `json:"authSecret,omitempty"` + // The identity to use for authentication. + // +optional + AuthIdentity string `json:"authIdentity,omitempty"` + // Further headers email header key/value pairs. Overrides any headers + // previously set by the notification implementation. + Headers []KeyValue `json:"headers,omitempty"` + // The HTML body of the email notification. + // +optional + HTML *string `json:"html,omitempty"` + // The text body of the email notification. + // +optional + Text *string `json:"text,omitempty"` + // The SMTP TLS requirement. + // Note that Go does not support unencrypted connections to remote SMTP endpoints. + // +optional + RequireTLS *bool `json:"requireTLS,omitempty"` + // TLS configuration + // +optional + TLSConfig *monitoringv1.SafeTLSConfig `json:"tlsConfig,omitempty"` +} + +// VictorOpsConfig configures notifications via VictorOps. +// See https://prometheus.io/docs/alerting/latest/configuration/#victorops_config +type VictorOpsConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the API key to use when talking to the VictorOps API. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APIKey *v1.SecretKeySelector `json:"apiKey,omitempty"` + // The VictorOps API URL. + // +optional + APIURL string `json:"apiUrl,omitempty"` + // A key used to map the alert to a team. + // +optional + RoutingKey string `json:"routingKey"` + // Describes the behavior of the alert (CRITICAL, WARNING, INFO). + // +optional + MessageType string `json:"messageType,omitempty"` + // Contains summary of the alerted problem. + // +optional + EntityDisplayName string `json:"entityDisplayName,omitempty"` + // Contains long explanation of the alerted problem. + // +optional + StateMessage string `json:"stateMessage,omitempty"` + // The monitoring tool the state message is from. + // +optional + MonitoringTool string `json:"monitoringTool,omitempty"` + // Additional custom fields for notification. + // +optional + CustomFields []KeyValue `json:"customFields,omitempty"` + // The HTTP client's configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// PushoverConfig configures notifications via Pushover. +// See https://prometheus.io/docs/alerting/latest/configuration/#pushover_config +type PushoverConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the recipient user's user key. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // Either `userKey` or `userKeyFile` is required. + // +optional + UserKey *v1.SecretKeySelector `json:"userKey,omitempty"` + // The user key file that contains the recipient user's user key. + // Either `userKey` or `userKeyFile` is required. + // It requires Alertmanager >= v0.26.0. + // +optional + UserKeyFile *string `json:"userKeyFile,omitempty"` + // The secret's key that contains the registered application's API token, see https://pushover.net/apps. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // Either `token` or `tokenFile` is required. + // +optional + Token *v1.SecretKeySelector `json:"token,omitempty"` + // The token file that contains the registered application's API token, see https://pushover.net/apps. + // Either `token` or `tokenFile` is required. + // It requires Alertmanager >= v0.26.0. + // +optional + TokenFile *string `json:"tokenFile,omitempty"` + // Notification title. + // +optional + Title string `json:"title,omitempty"` + // Notification message. + // +optional + Message string `json:"message,omitempty"` + // A supplementary URL shown alongside the message. + // +optional + URL string `json:"url,omitempty"` + // A title for supplementary URL, otherwise just the URL is shown + // +optional + URLTitle string `json:"urlTitle,omitempty"` + // The time to live definition for the alert notification + // +optional + TTL *monitoringv1.Duration `json:"ttl,omitempty"` + // The name of a device to send the notification to + // +optional + Device *string `json:"device,omitempty"` + // The name of one of the sounds supported by device clients to override the user's default sound choice + // +optional + Sound string `json:"sound,omitempty"` + // Priority, see https://pushover.net/api#priority + // +optional + Priority string `json:"priority,omitempty"` + // How often the Pushover servers will send the same notification to the user. + // Must be at least 30 seconds. + // +kubebuilder:validation:Pattern=`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // +optional + Retry string `json:"retry,omitempty"` + // How long your notification will continue to be retried for, unless the user + // acknowledges the notification. + // +kubebuilder:validation:Pattern=`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // +optional + Expire string `json:"expire,omitempty"` + // Whether notification message is HTML or plain text. + // +optional + HTML bool `json:"html,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// SNSConfig configures notifications via AWS SNS. +// See https://prometheus.io/docs/alerting/latest/configuration/#sns_configs +type SNSConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The SNS API URL i.e. https://sns.us-east-2.amazonaws.com. + // If not specified, the SNS API URL from the SNS SDK will be used. + // +optional + ApiURL string `json:"apiURL,omitempty"` + // Configures AWS's Signature Verification 4 signing process to sign requests. + // +optional + Sigv4 *monitoringv1.Sigv4 `json:"sigv4,omitempty"` + // SNS topic ARN, i.e. arn:aws:sns:us-east-2:698519295917:My-Topic + // If you don't specify this value, you must specify a value for the PhoneNumber or TargetARN. + // +optional + TopicARN string `json:"topicARN,omitempty"` + // Subject line when the message is delivered to email endpoints. + // +optional + Subject string `json:"subject,omitempty"` + // Phone number if message is delivered via SMS in E.164 format. + // If you don't specify this value, you must specify a value for the TopicARN or TargetARN. + // +optional + PhoneNumber string `json:"phoneNumber,omitempty"` + // The mobile platform endpoint ARN if message is delivered via mobile notifications. + // If you don't specify this value, you must specify a value for the topic_arn or PhoneNumber. + // +optional + TargetARN string `json:"targetARN,omitempty"` + // The message content of the SNS notification. + // +optional + Message string `json:"message,omitempty"` + // SNS message attributes. + // +optional + Attributes map[string]string `json:"attributes,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// TelegramConfig configures notifications via Telegram. +// See https://prometheus.io/docs/alerting/latest/configuration/#telegram_config +type TelegramConfig struct { + // Whether to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The Telegram API URL i.e. https://api.telegram.org. + // If not specified, default API URL will be used. + // +optional + APIURL string `json:"apiURL,omitempty"` + // Telegram bot token. It is mutually exclusive with `botTokenFile`. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // + // Either `botToken` or `botTokenFile` is required. + // + //+optional + BotToken *v1.SecretKeySelector `json:"botToken,omitempty"` + // File to read the Telegram bot token from. It is mutually exclusive with `botToken`. + // Either `botToken` or `botTokenFile` is required. + // + // It requires Alertmanager >= v0.26.0. + // + // +optional + BotTokenFile *string `json:"botTokenFile,omitempty"` + // The Telegram chat ID. + // +required + ChatID int64 `json:"chatID,omitempty"` + // Message template + // +optional + Message string `json:"message,omitempty"` + // Disable telegram notifications + // +optional + DisableNotifications *bool `json:"disableNotifications,omitempty"` + // Parse mode for telegram message + //+kubebuilder:validation:Enum=MarkdownV2;Markdown;HTML + // +optional + ParseMode string `json:"parseMode,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// MSTeamsConfig configures notifications via Microsoft Teams. +// It requires Alertmanager >= 0.26.0. +type MSTeamsConfig struct { + // Whether to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // MSTeams webhook URL. + // +kubebuilder:validation:Required + WebhookURL v1.SecretKeySelector `json:"webhookUrl"` + // Message title template. + // +optional + Title *string `json:"title,omitempty"` + // Message summary template. + // It requires Alertmanager >= 0.27.0. + // +optional + Summary *string `json:"summary,omitempty"` + // Message body template. + // +optional + Text *string `json:"text,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// InhibitRule defines an inhibition rule that allows to mute alerts when other +// alerts are already firing. +// See https://prometheus.io/docs/alerting/latest/configuration/#inhibit_rule +type InhibitRule struct { + // Matchers that have to be fulfilled in the alerts to be muted. The + // operator enforces that the alert matches the resource's namespace. + TargetMatch []Matcher `json:"targetMatch,omitempty"` + // Matchers for which one or more alerts have to exist for the inhibition + // to take effect. The operator enforces that the alert matches the + // resource's namespace. + SourceMatch []Matcher `json:"sourceMatch,omitempty"` + // Labels that must have an equal value in the source and target alert for + // the inhibition to take effect. + Equal []string `json:"equal,omitempty"` +} + +// KeyValue defines a (key, value) tuple. +type KeyValue struct { + // Key of the tuple. + // +kubebuilder:validation:MinLength=1 + Key string `json:"key"` + // Value of the tuple. + Value string `json:"value"` +} + +// Matcher defines how to match on alert's labels. +type Matcher struct { + // Label to match. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + // Label value to match. + // +optional + Value string `json:"value"` + // Match operation available with AlertManager >= v0.22.0 and + // takes precedence over Regex (deprecated) if non-empty. + // +kubebuilder:validation:Enum=!=;=;=~;!~ + // +optional + MatchType MatchType `json:"matchType,omitempty"` + // Whether to match on equality (false) or regular-expression (true). + // +optional + // Deprecated: for AlertManager >= v0.22.0, `matchType` should be used instead. + Regex bool `json:"regex,omitempty"` +} + +// String returns Matcher as a string +// Use only for MatchType Matcher +func (in Matcher) String() string { + return fmt.Sprintf(`%s%s"%s"`, in.Name, in.MatchType, openMetricsEscape(in.Value)) +} + +// Validate the Matcher returns an error if the matcher is invalid +// Validates only non-deprecated matching fields +func (in Matcher) Validate() error { + // nothing to do + if in.MatchType == "" { + return nil + } + + if !in.MatchType.Valid() { + return fmt.Errorf("invalid 'matchType' '%s' provided'", in.MatchType) + } + + if strings.TrimSpace(in.Name) == "" { + return errors.New("matcher 'name' is required") + } + + return nil +} + +// MatchType is a comparison operator on a Matcher +type MatchType string + +// Valid MatchType returns true if the operator is acceptable +func (mt MatchType) Valid() bool { + _, ok := validMatchTypes[mt] + return ok +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *AlertmanagerConfig) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *AlertmanagerConfigList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +const ( + MatchEqual MatchType = "=" + MatchNotEqual MatchType = "!=" + MatchRegexp MatchType = "=~" + MatchNotRegexp MatchType = "!~" +) + +var validMatchTypes = map[MatchType]bool{ + MatchEqual: true, + MatchNotEqual: true, + MatchRegexp: true, + MatchNotRegexp: true, +} + +// openMetricsEscape is similar to the usual string escaping, but more +// restricted. It merely replaces a new-line character with '\n', a double-quote +// character with '\"', and a backslash with '\\', which is the escaping used by +// OpenMetrics. +// * Copied from alertmanager codebase pkg/labels * +func openMetricsEscape(s string) string { + r := strings.NewReplacer( + `\`, `\\`, + "\n", `\n`, + `"`, `\"`, + ) + return r.Replace(s) +} + +// MuteTimeInterval specifies the periods in time when notifications will be muted +type MuteTimeInterval struct { + // Name of the time interval + // +kubebuilder:validation:Required + Name string `json:"name,omitempty"` + // TimeIntervals is a list of TimeInterval + TimeIntervals []TimeInterval `json:"timeIntervals,omitempty"` +} + +// TimeInterval describes intervals of time +type TimeInterval struct { + // Times is a list of TimeRange + // +optional + Times []TimeRange `json:"times,omitempty"` + // Weekdays is a list of WeekdayRange + // +optional + Weekdays []WeekdayRange `json:"weekdays,omitempty"` + // DaysOfMonth is a list of DayOfMonthRange + // +optional + DaysOfMonth []DayOfMonthRange `json:"daysOfMonth,omitempty"` + // Months is a list of MonthRange + // +optional + Months []MonthRange `json:"months,omitempty"` + // Years is a list of YearRange + // +optional + Years []YearRange `json:"years,omitempty"` +} + +// Time defines a time in 24hr format +// +kubebuilder:validation:Pattern=`^((([01][0-9])|(2[0-3])):[0-5][0-9])$|(^24:00$)` +type Time string + +// TimeRange defines a start and end time in 24hr format +type TimeRange struct { + // StartTime is the start time in 24hr format. + StartTime Time `json:"startTime,omitempty"` + // EndTime is the end time in 24hr format. + EndTime Time `json:"endTime,omitempty"` +} + +// WeekdayRange is an inclusive range of days of the week beginning on Sunday +// Days can be specified by name (e.g 'Sunday') or as an inclusive range (e.g 'Monday:Friday') +// +kubebuilder:validation:Pattern=`^((?i)sun|mon|tues|wednes|thurs|fri|satur)day(?:((:(sun|mon|tues|wednes|thurs|fri|satur)day)$)|$)` +type WeekdayRange string + +// DayOfMonthRange is an inclusive range of days of the month beginning at 1 +type DayOfMonthRange struct { + // Start of the inclusive range + // +kubebuilder:validation:Minimum=-31 + // +kubebuilder:validation:Maximum=31 + Start int `json:"start,omitempty"` + // End of the inclusive range + // +kubebuilder:validation:Minimum=-31 + // +kubebuilder:validation:Maximum=31 + End int `json:"end,omitempty"` +} + +// MonthRange is an inclusive range of months of the year beginning in January +// Months can be specified by name (e.g 'January') by numerical month (e.g '1') or as an inclusive range (e.g 'January:March', '1:3', '1:March') +// +kubebuilder:validation:Pattern=`^((?i)january|february|march|april|may|june|july|august|september|october|november|december|1[0-2]|[1-9])(?:((:((?i)january|february|march|april|may|june|july|august|september|october|november|december|1[0-2]|[1-9]))$)|$)` +type MonthRange string + +// YearRange is an inclusive range of years +// +kubebuilder:validation:Pattern=`^2\d{3}(?::2\d{3}|$)` +type YearRange string + +// Weekday is day of the week +type Weekday string + +const ( + Sunday Weekday = "sunday" + Monday Weekday = "monday" + Tuesday Weekday = "tuesday" + Wednesday Weekday = "wednesday" + Thursday Weekday = "thursday" + Friday Weekday = "friday" + Saturday Weekday = "saturday" +) + +var daysOfWeek = map[Weekday]int{ + Sunday: 0, + Monday: 1, + Tuesday: 2, + Wednesday: 3, + Thursday: 4, + Friday: 5, + Saturday: 6, +} + +var daysOfWeekInv = map[int]Weekday{ + 0: Sunday, + 1: Monday, + 2: Tuesday, + 3: Wednesday, + 4: Thursday, + 5: Friday, + 6: Saturday, +} + +// Month of the year +type Month string + +const ( + January Month = "january" + February Month = "february" + March Month = "march" + April Month = "april" + May Month = "may" + June Month = "june" + July Month = "july" + August Month = "august" + September Month = "september" + October Month = "october" + November Month = "november" + December Month = "december" +) + +var months = map[Month]int{ + January: 1, + February: 2, + March: 3, + April: 4, + May: 5, + June: 6, + July: 7, + August: 8, + September: 9, + October: 10, + November: 11, + December: 12, +} + +var monthsInv = map[int]Month{ + 1: January, + 2: February, + 3: March, + 4: April, + 5: May, + 6: June, + 7: July, + 8: August, + 9: September, + 10: October, + 11: November, + 12: December, +} + +// URL represents a valid URL +// +kubebuilder:validation:Pattern=`^https?://.+$` +type URL string diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/doc.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/doc.go new file mode 100644 index 000000000..aca68fd17 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2020 The prometheus-operator 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:deepcopy-gen=package +// +groupName=monitoring.coreos.com + +package v1alpha1 diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/prometheusagent_types.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/prometheusagent_types.go new file mode 100644 index 000000000..139d016e5 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/prometheusagent_types.go @@ -0,0 +1,104 @@ +// Copyright 2023 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +const ( + PrometheusAgentsKind = "PrometheusAgent" + PrometheusAgentName = "prometheusagents" + PrometheusAgentKindKey = "prometheusagent" +) + +func (l *PrometheusAgent) GetCommonPrometheusFields() monitoringv1.CommonPrometheusFields { + return l.Spec.CommonPrometheusFields +} + +func (l *PrometheusAgent) SetCommonPrometheusFields(f monitoringv1.CommonPrometheusFields) { + l.Spec.CommonPrometheusFields = f +} + +func (l *PrometheusAgent) GetStatus() monitoringv1.PrometheusStatus { + return l.Status +} + +// +genclient +// +k8s:openapi-gen=true +// +kubebuilder:resource:categories="prometheus-operator",shortName="promagent" +// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version",description="The version of Prometheus agent" +// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas" +// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.availableReplicas",description="The number of ready replicas" +// +kubebuilder:printcolumn:name="Reconciled",type="string",JSONPath=".status.conditions[?(@.type == 'Reconciled')].status" +// +kubebuilder:printcolumn:name="Available",type="string",JSONPath=".status.conditions[?(@.type == 'Available')].status" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="Paused",type="boolean",JSONPath=".status.paused",description="Whether the resource reconciliation is paused or not",priority=1 +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.shards,statuspath=.status.shards,selectorpath=.status.selector +// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale +// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale + +// PrometheusAgent defines a Prometheus agent deployment. +type PrometheusAgent struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the Prometheus agent. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Spec PrometheusAgentSpec `json:"spec"` + // Most recent observed status of the Prometheus cluster. Read-only. + // More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + Status monitoringv1.PrometheusStatus `json:"status,omitempty"` +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *PrometheusAgent) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// PrometheusAgentList is a list of Prometheus agents. +// +k8s:openapi-gen=true +type PrometheusAgentList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of Prometheus agents + Items []*PrometheusAgent `json:"items"` +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *PrometheusAgentList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// PrometheusAgentSpec is a specification of the desired behavior of the Prometheus agent. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type PrometheusAgentSpec struct { + // Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s). + // For now this field has no effect. + // + // (Alpha) Using this field requires the `PrometheusAgentDaemonSet` feature gate to be enabled. + // + // +kubebuilder:validation:Enum=StatefulSet;DaemonSet + // +optional + Mode *string `json:"mode,omitempty"` + + monitoringv1.CommonPrometheusFields `json:",inline"` +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/register.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/register.go new file mode 100644 index 000000000..e78380913 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/register.go @@ -0,0 +1,59 @@ +// Copyright 2020 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring" +) + +// SchemeGroupVersion is the group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: monitoring.GroupName, Version: Version} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &AlertmanagerConfig{}, + &AlertmanagerConfigList{}, + &PrometheusAgent{}, + &PrometheusAgentList{}, + &ScrapeConfig{}, + &ScrapeConfigList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/scrapeconfig_types.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/scrapeconfig_types.go new file mode 100644 index 000000000..7e510c1bf --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/scrapeconfig_types.go @@ -0,0 +1,1170 @@ +// Copyright 2023 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +const ( + ScrapeConfigsKind = "ScrapeConfig" + ScrapeConfigName = "scrapeconfigs" + ScrapeConfigKindKey = "scrapeconfig" +) + +// Target represents a target for Prometheus to scrape +type Target string + +// SDFile represents a file used for service discovery +// +kubebuilder:validation:Pattern=`^[^*]*(\*[^/]*)?\.(json|yml|yaml|JSON|YML|YAML)$` +type SDFile string + +// NamespaceDiscovery is the configuration for discovering +// Kubernetes namespaces. +type NamespaceDiscovery struct { + // Includes the namespace in which the Prometheus pod exists to the list of watched namesapces. + // +optional + IncludeOwnNamespace *bool `json:"ownNamespace,omitempty"` + // List of namespaces where to watch for resources. + // If empty and `ownNamespace` isn't true, Prometheus watches for resources in all namespaces. + // +optional + Names []string `json:"names,omitempty"` +} + +type AttachMetadata struct { + // Attaches node metadata to discovered targets. + // When set to true, Prometheus must have the `get` permission on the + // `Nodes` objects. + // Only valid for Pod, Endpoint and Endpointslice roles. + // + // +optional + Node *bool `json:"node,omitempty"` +} + +// EC2Filter is the configuration for filtering EC2 instances. +type EC2Filter struct { + Name string `json:"name"` + Values []string `json:"values"` +} + +// DockerFilter is the configuration to limit the discovery process to a subset of available resources. +type DockerFilter struct { + Name string `json:"name"` + Values []string `json:"values"` +} + +// Filter is the configuration to limit the discovery process to a subset of available resources. +type DockerSwarmFilter struct { + // Name is the key of the field to check against. + // +kubebuilder:vaidation:MinLength=1 + // +required + Name string `json:"name"` + // Values is the value or set of values to check for a match. + // +kubebuilder:validation:MinItems=1 + // +required + Values []string `json:"values"` +} + +// Role is role of the service in Kubernetes. +// +kubebuilder:validation:Enum=Node;node;Service;service;Pod;pod;Endpoints;endpoints;EndpointSlice;endpointslice;Ingress;ingress +type Role string + +// K8SSelectorConfig is Kubernetes Selector Config +type K8SSelectorConfig struct { + // +kubebuilder:validation:Required + Role Role `json:"role"` + Label string `json:"label,omitempty"` + Field string `json:"field,omitempty"` +} + +// +genclient +// +k8s:openapi-gen=true +// +kubebuilder:resource:categories="prometheus-operator",shortName="scfg" +// +kubebuilder:storageversion + +// ScrapeConfig defines a namespaced Prometheus scrape_config to be aggregated across +// multiple namespaces into the Prometheus configuration. +type ScrapeConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ScrapeConfigSpec `json:"spec"` +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *ScrapeConfig) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// ScrapeConfigList is a list of ScrapeConfigs. +// +k8s:openapi-gen=true +type ScrapeConfigList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of ScrapeConfigs + Items []*ScrapeConfig `json:"items"` +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *ScrapeConfigList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// ScrapeConfigSpec is a specification of the desired configuration for a scrape configuration. +// +k8s:openapi-gen=true +type ScrapeConfigSpec struct { + // The value of the `job` label assigned to the scraped metrics by default. + // + // The `job_name` field in the rendered scrape configuration is always controlled by the + // operator to prevent duplicate job names, which Prometheus does not allow. Instead the + // `job` label is set by means of relabeling configs. + // + // +optional + // +kubebuilder:validation:MinLength=1 + JobName *string `json:"jobName,omitempty"` + // StaticConfigs defines a list of static targets with a common label set. + // +optional + StaticConfigs []StaticConfig `json:"staticConfigs,omitempty"` + // FileSDConfigs defines a list of file service discovery configurations. + // +optional + FileSDConfigs []FileSDConfig `json:"fileSDConfigs,omitempty"` + // HTTPSDConfigs defines a list of HTTP service discovery configurations. + // +optional + HTTPSDConfigs []HTTPSDConfig `json:"httpSDConfigs,omitempty"` + // KubernetesSDConfigs defines a list of Kubernetes service discovery configurations. + // +optional + KubernetesSDConfigs []KubernetesSDConfig `json:"kubernetesSDConfigs,omitempty"` + // ConsulSDConfigs defines a list of Consul service discovery configurations. + // +optional + ConsulSDConfigs []ConsulSDConfig `json:"consulSDConfigs,omitempty"` + //DNSSDConfigs defines a list of DNS service discovery configurations. + // +optional + DNSSDConfigs []DNSSDConfig `json:"dnsSDConfigs,omitempty"` + // EC2SDConfigs defines a list of EC2 service discovery configurations. + // +optional + EC2SDConfigs []EC2SDConfig `json:"ec2SDConfigs,omitempty"` + // AzureSDConfigs defines a list of Azure service discovery configurations. + // +optional + AzureSDConfigs []AzureSDConfig `json:"azureSDConfigs,omitempty"` + // GCESDConfigs defines a list of GCE service discovery configurations. + // +optional + GCESDConfigs []GCESDConfig `json:"gceSDConfigs,omitempty"` + // OpenStackSDConfigs defines a list of OpenStack service discovery configurations. + // +optional + OpenStackSDConfigs []OpenStackSDConfig `json:"openstackSDConfigs,omitempty"` + // DigitalOceanSDConfigs defines a list of DigitalOcean service discovery configurations. + // +optional + DigitalOceanSDConfigs []DigitalOceanSDConfig `json:"digitalOceanSDConfigs,omitempty"` + // KumaSDConfigs defines a list of Kuma service discovery configurations. + // +optional + KumaSDConfigs []KumaSDConfig `json:"kumaSDConfigs,omitempty"` + // EurekaSDConfigs defines a list of Eureka service discovery configurations. + // +optional + EurekaSDConfigs []EurekaSDConfig `json:"eurekaSDConfigs,omitempty"` + // DockerSDConfigs defines a list of Docker service discovery configurations. + // +optional + DockerSDConfigs []DockerSDConfig `json:"dockerSDConfigs,omitempty"` + // LinodeSDConfigs defines a list of Linode service discovery configurations. + // +optional + LinodeSDConfigs []LinodeSDConfig `json:"linodeSDConfigs,omitempty"` + // HetznerSDConfigs defines a list of Hetzner service discovery configurations. + // +optional + HetznerSDConfigs []HetznerSDConfig `json:"hetznerSDConfigs,omitempty"` + // NomadSDConfigs defines a list of Nomad service discovery configurations. + // +optional + NomadSDConfigs []NomadSDConfig `json:"NomadSDConfigs,omitempty"` + // DockerswarmSDConfigs defines a list of Dockerswarm service discovery configurations. + // +optional + DockerSwarmSDConfigs []DockerSwarmSDConfig `json:"dockerSwarmSDConfigs,omitempty"` + // PuppetDBSDConfigs defines a list of PuppetDB service discovery configurations. + // +optional + PuppetDBSDConfigs []PuppetDBSDConfig `json:"puppetDBSDConfigs,omitempty"` + // LightsailSDConfigs defines a list of Lightsail service discovery configurations. + // +optional + LightSailSDConfigs []LightSailSDConfig `json:"lightSailSDConfigs,omitempty"` + // OVHCloudSDConfigs defines a list of OVHcloud service discovery configurations. + // +optional + OVHCloudSDConfigs []OVHCloudSDConfig `json:"ovhcloudSDConfigs,omitempty"` + // RelabelConfigs defines how to rewrite the target's labels before scraping. + // Prometheus Operator automatically adds relabelings for a few standard Kubernetes fields. + // The original scrape job's name is available via the `__tmp_prometheus_job_name` label. + // More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config + // +optional + RelabelConfigs []v1.RelabelConfig `json:"relabelings,omitempty"` + // MetricsPath HTTP path to scrape for metrics. If empty, Prometheus uses the default value (e.g. /metrics). + // +optional + MetricsPath *string `json:"metricsPath,omitempty"` + // ScrapeInterval is the interval between consecutive scrapes. + // +optional + ScrapeInterval *v1.Duration `json:"scrapeInterval,omitempty"` + // ScrapeTimeout is the number of seconds to wait until a scrape request times out. + // +optional + ScrapeTimeout *v1.Duration `json:"scrapeTimeout,omitempty"` + // The protocols to negotiate during a scrape. It tells clients the + // protocols supported by Prometheus in order of preference (from most to least preferred). + // + // If unset, Prometheus uses its default value. + // + // It requires Prometheus >= v2.49.0. + // + // +listType=set + // +optional + ScrapeProtocols []v1.ScrapeProtocol `json:"scrapeProtocols,omitempty"` + // HonorTimestamps controls whether Prometheus respects the timestamps present in scraped data. + // +optional + HonorTimestamps *bool `json:"honorTimestamps,omitempty"` + // TrackTimestampsStaleness whether Prometheus tracks staleness of + // the metrics that have an explicit timestamp present in scraped data. + // Has no effect if `honorTimestamps` is false. + // It requires Prometheus >= v2.48.0. + // + // +optional + TrackTimestampsStaleness *bool `json:"trackTimestampsStaleness,omitempty"` + // HonorLabels chooses the metric's labels on collisions with target labels. + // +optional + HonorLabels *bool `json:"honorLabels,omitempty"` + // Optional HTTP URL parameters + // +optional + // +mapType:=atomic + Params map[string][]string `json:"params,omitempty"` + // Configures the protocol scheme used for requests. + // If empty, Prometheus uses HTTP by default. + // +kubebuilder:validation:Enum=HTTP;HTTPS + // +optional + Scheme *string `json:"scheme,omitempty"` + // When false, Prometheus will request uncompressed response from the scraped target. + // + // It requires Prometheus >= v2.49.0. + // + // If unset, Prometheus uses true by default. + // +optional + EnableCompression *bool `json:"enableCompression,omitempty"` + // BasicAuth information to use on every scrape request. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header to use on every scrape request. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // TLS configuration to use on every scrape request + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. + // +optional + SampleLimit *uint64 `json:"sampleLimit,omitempty"` + // TargetLimit defines a limit on the number of scraped targets that will be accepted. + // +optional + TargetLimit *uint64 `json:"targetLimit,omitempty"` + // Per-scrape limit on number of labels that will be accepted for a sample. + // Only valid in Prometheus versions 2.27.0 and newer. + // +optional + LabelLimit *uint64 `json:"labelLimit,omitempty"` + // Per-scrape limit on length of labels name that will be accepted for a sample. + // Only valid in Prometheus versions 2.27.0 and newer. + // +optional + LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"` + // Per-scrape limit on length of labels value that will be accepted for a sample. + // Only valid in Prometheus versions 2.27.0 and newer. + // +optional + LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"` + // Per-scrape limit on the number of targets dropped by relabeling + // that will be kept in memory. 0 means no limit. + // + // It requires Prometheus >= v2.47.0. + // + // +optional + KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"` + // MetricRelabelConfigs to apply to samples before ingestion. + // +optional + MetricRelabelConfigs []v1.RelabelConfig `json:"metricRelabelings,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + + // The scrape class to apply. + // +optional + // +kubebuilder:validation:MinLength=1 + ScrapeClassName *string `json:"scrapeClass,omitempty"` +} + +// StaticConfig defines a Prometheus static configuration. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config +// +k8s:openapi-gen=true +type StaticConfig struct { + // List of targets for this static configuration. + // +optional + Targets []Target `json:"targets,omitempty"` + // Labels assigned to all metrics scraped from the targets. + // +mapType:=atomic + // +optional + Labels map[v1.LabelName]string `json:"labels,omitempty"` +} + +// FileSDConfig defines a Prometheus file service discovery configuration +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config +// +k8s:openapi-gen=true +type FileSDConfig struct { + // List of files to be used for file discovery. Recommendation: use absolute paths. While relative paths work, the + // prometheus-operator project makes no guarantees about the working directory where the configuration file is + // stored. + // Files must be mounted using Prometheus.ConfigMaps or Prometheus.Secrets. + // +kubebuilder:validation:MinItems:=1 + Files []SDFile `json:"files"` + // RefreshInterval configures the refresh interval at which Prometheus will reload the content of the files. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` +} + +// HTTPSDConfig defines a prometheus HTTP service discovery configuration +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config +// +k8s:openapi-gen=true +type HTTPSDConfig struct { + // URL from which the targets are fetched. + // +kubebuilder:validation:MinLength:=1 + // +kubebuilder:validation:Pattern:="^http(s)?://.+$" + URL string `json:"url"` + // RefreshInterval configures the refresh interval at which Prometheus will re-query the + // endpoint to update the target list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // BasicAuth information to authenticate against the target HTTP endpoint. + // More info: https://prometheus.io/docs/operating/configuration/#endpoints + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header configuration to authenticate against the target HTTP endpoint. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // TLS configuration applying to the target HTTP endpoint. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` +} + +// KubernetesSDConfig allows retrieving scrape targets from Kubernetes' REST API. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config +// +k8s:openapi-gen=true +type KubernetesSDConfig struct { + // The API server address consisting of a hostname or IP address followed + // by an optional port number. + // If left empty, Prometheus is assumed to run inside + // of the cluster. It will discover API servers automatically and use the pod's + // CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/. + // +optional + APIServer *string `json:"apiServer,omitempty"` + // Role of the Kubernetes entities that should be discovered. + // +required + Role Role `json:"role"` + // BasicAuth information to use on every scrape request. + // Cannot be set at the same time as `authorization`, or `oauth2`. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header to use on every scrape request. + // Cannot be set at the same time as `basicAuth`, or `oauth2`. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be set at the same time as `authorization`, or `basicAuth`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` + // TLS configuration to use on every scrape request. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // Optional namespace discovery. If omitted, Prometheus discovers targets across all namespaces. + // +optional + Namespaces *NamespaceDiscovery `json:"namespaces,omitempty"` + // Optional metadata to attach to discovered targets. + // It requires Prometheus >= v2.35.0 for `pod` role and + // Prometheus >= v2.37.0 for `endpoints` and `endpointslice` roles. + // +optional + AttachMetadata *AttachMetadata `json:"attachMetadata,omitempty"` + // Selector to select objects. + // +optional + // +listType=map + // +listMapKey=role + Selectors []K8SSelectorConfig `json:"selectors,omitempty"` +} + +// ConsulSDConfig defines a Consul service discovery configuration +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#consul_sd_config +// +k8s:openapi-gen=true +type ConsulSDConfig struct { + // A valid string consisting of a hostname or IP followed by an optional port number. + // +kubebuilder:validation:MinLength=1 + // +required + Server string `json:"server"` + // Consul ACL TokenRef, if not provided it will use the ACL from the local Consul Agent. + // +optional + TokenRef *corev1.SecretKeySelector `json:"tokenRef,omitempty"` + // Consul Datacenter name, if not provided it will use the local Consul Agent Datacenter. + // +optional + Datacenter *string `json:"datacenter,omitempty"` + // Namespaces are only supported in Consul Enterprise. + // +optional + Namespace *string `json:"namespace,omitempty"` + // Admin Partitions are only supported in Consul Enterprise. + // +optional + Partition *string `json:"partition,omitempty"` + // HTTP Scheme default "http" + // +kubebuilder:validation:Enum=HTTP;HTTPS + // +optional + Scheme *string `json:"scheme,omitempty"` + // A list of services for which targets are retrieved. If omitted, all services are scraped. + // +listType:=atomic + // +optional + Services []string `json:"services,omitempty"` + // An optional list of tags used to filter nodes for a given service. Services must contain all tags in the list. + //+listType:=atomic + // +optional + Tags []string `json:"tags,omitempty"` + // The string by which Consul tags are joined into the tag label. + // If unset, Prometheus uses its default value. + // +optional + TagSeparator *string `json:"tagSeparator,omitempty"` + // Node metadata key/value pairs to filter nodes for a given service. + // +mapType:=atomic + // +optional + NodeMeta map[string]string `json:"nodeMeta,omitempty"` + // Allow stale Consul results (see https://www.consul.io/api/features/consistency.html). Will reduce load on Consul. + // If unset, Prometheus uses its default value. + // +optional + AllowStale *bool `json:"allowStale,omitempty"` + // The time after which the provided names are refreshed. + // On large setup it might be a good idea to increase this value because the catalog will change all the time. + // If unset, Prometheus uses its default value. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // BasicAuth information to authenticate against the Consul Server. + // More info: https://prometheus.io/docs/operating/configuration/#endpoints + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header configuration to authenticate against the Consul Server. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // +optional + Oauth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // If unset, Prometheus uses its default value. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // If unset, Prometheus uses its default value. + // +optional + EnableHttp2 *bool `json:"enableHTTP2,omitempty"` + // TLS Config + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` +} + +// DNSSDConfig allows specifying a set of DNS domain names which are periodically queried to discover a list of targets. +// The DNS servers to be contacted are read from /etc/resolv.conf. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#dns_sd_config +// +k8s:openapi-gen=true +type DNSSDConfig struct { + // A list of DNS domain names to be queried. + // +kubebuilder:validation:MinItems:=1 + Names []string `json:"names"` + // RefreshInterval configures the time after which the provided names are refreshed. + // If not set, Prometheus uses its default value. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // The type of DNS query to perform. One of SRV, A, AAAA, MX or NS. + // If not set, Prometheus uses its default value. + // + // When set to NS, It requires Prometheus >= 2.49.0. + // + // +kubebuilder:validation:Enum=SRV;A;AAAA;MX;NS + // +optional + Type *string `json:"type"` + // The port number used if the query type is not SRV + // Ignored for SRV records + // +optional + Port *int `json:"port"` +} + +// EC2SDConfig allow retrieving scrape targets from AWS EC2 instances. +// The private IP address is used by default, but may be changed to the public IP address with relabeling. +// The IAM credentials used must have the ec2:DescribeInstances permission to discover scrape targets +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ec2_sd_config +// +k8s:openapi-gen=true +type EC2SDConfig struct { + // The AWS region + // +optional + Region *string `json:"region"` + // AccessKey is the AWS API key. + // +optional + AccessKey *corev1.SecretKeySelector `json:"accessKey,omitempty"` + // SecretKey is the AWS API secret. + // +optional + SecretKey *corev1.SecretKeySelector `json:"secretKey,omitempty"` + // AWS Role ARN, an alternative to using AWS API keys. + // +optional + RoleARN *string `json:"roleARN,omitempty"` + // RefreshInterval configures the refresh interval at which Prometheus will re-read the instance list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // The port to scrape metrics from. If using the public IP address, this must + // instead be specified in the relabeling rule. + // +optional + Port *int `json:"port"` + // Filters can be used optionally to filter the instance list by other criteria. + // Available filter criteria can be found here: + // https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html + // Filter API documentation: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Filter.html + // +optional + Filters []*EC2Filter `json:"filters"` +} + +// AzureSDConfig allow retrieving scrape targets from Azure VMs. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#azure_sd_config +// +k8s:openapi-gen=true +type AzureSDConfig struct { + // The Azure environment. + // +optional + Environment *string `json:"environment,omitempty"` + // # The authentication method, either `OAuth` or `ManagedIdentity` or `SDK`. + // See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview + // SDK authentication method uses environment variables by default. + // See https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication + // +kubebuilder:validation:Enum=OAuth;ManagedIdentity;SDK + // +optional + AuthenticationMethod *string `json:"authenticationMethod,omitempty"` + // The subscription ID. Always required. + // +kubebuilder:validation:MinLength=1 + // +required + SubscriptionID string `json:"subscriptionID"` + // Optional tenant ID. Only required with the OAuth authentication method. + // +optional + TenantID *string `json:"tenantID,omitempty"` + // Optional client ID. Only required with the OAuth authentication method. + // +optional + ClientID *string `json:"clientID,omitempty"` + // Optional client secret. Only required with the OAuth authentication method. + // +optional + ClientSecret *corev1.SecretKeySelector `json:"clientSecret,omitempty"` + // Optional resource group name. Limits discovery to this resource group. + // +optional + ResourceGroup *string `json:"resourceGroup,omitempty"` + // RefreshInterval configures the refresh interval at which Prometheus will re-read the instance list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // The port to scrape metrics from. If using the public IP address, this must + // instead be specified in the relabeling rule. + // +optional + Port *int `json:"port"` +} + +// GCESDConfig configures scrape targets from GCP GCE instances. +// The private IP address is used by default, but may be changed to +// the public IP address with relabeling. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#gce_sd_config +// +// The GCE service discovery will load the Google Cloud credentials +// from the file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable. +// See https://cloud.google.com/kubernetes-engine/docs/tutorials/authenticating-to-cloud-platform +// +// A pre-requisite for using GCESDConfig is that a Secret containing valid +// Google Cloud credentials is mounted into the Prometheus or PrometheusAgent +// pod via the `.spec.secrets` field and that the GOOGLE_APPLICATION_CREDENTIALS +// environment variable is set to /etc/prometheus/secrets//. +// +k8s:openapi-gen=true +type GCESDConfig struct { + // The Google Cloud Project ID + // +kubebuilder:validation:MinLength:=1 + // +required + Project string `json:"project"` + // The zone of the scrape targets. If you need multiple zones use multiple GCESDConfigs. + // +kubebuilder:validation:MinLength:=1 + // +required + Zone string `json:"zone"` + // Filter can be used optionally to filter the instance list by other criteria + // Syntax of this filter is described in the filter query parameter section: + // https://cloud.google.com/compute/docs/reference/latest/instances/list + // +optional + Filter *string `json:"filter,omitempty"` + // RefreshInterval configures the refresh interval at which Prometheus will re-read the instance list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // The port to scrape metrics from. If using the public IP address, this must + // instead be specified in the relabeling rule. + // +optional + Port *int `json:"port"` + // The tag separator is used to separate the tags on concatenation + // +optional + TagSeparator *string `json:"tagSeparator,omitempty"` +} + +// OpenStackSDConfig allow retrieving scrape targets from OpenStack Nova instances. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config +// +k8s:openapi-gen=true +type OpenStackSDConfig struct { + // The OpenStack role of entities that should be discovered. + // +kubebuilder:validation:Enum=Instance;instance;Hypervisor;hypervisor + // +required + Role string `json:"role"` + // The OpenStack Region. + // +kubebuilder:validation:MinLength:=1 + // +required + Region string `json:"region"` + // IdentityEndpoint specifies the HTTP endpoint that is required to work with + // the Identity API of the appropriate version. + // +optional + IdentityEndpoint *string `json:"identityEndpoint,omitempty"` + // Username is required if using Identity V2 API. Consult with your provider's + // control panel to discover your account's username. + // In Identity V3, either userid or a combination of username + // and domainId or domainName are needed + // +optional + Username *string `json:"username,omitempty"` + // UserID + // +optional + UserID *string `json:"userid,omitempty"` + // Password for the Identity V2 and V3 APIs. Consult with your provider's + // control panel to discover your account's preferred method of authentication. + // +optional + Password *corev1.SecretKeySelector `json:"password,omitempty"` + // At most one of domainId and domainName must be provided if using username + // with Identity V3. Otherwise, either are optional. + // +optional + DomainName *string `json:"domainName,omitempty"` + // DomainID + // +optional + DomainID *string `json:"domainID,omitempty"` + // The ProjectId and ProjectName fields are optional for the Identity V2 API. + // Some providers allow you to specify a ProjectName instead of the ProjectId. + // Some require both. Your provider's authentication policies will determine + // how these fields influence authentication. + // +optional + ProjectName *string `json:"projectName,omitempty"` + // ProjectID + // +optional + ProjectID *string `json:"projectID,omitempty"` + // The ApplicationCredentialID or ApplicationCredentialName fields are + // required if using an application credential to authenticate. Some providers + // allow you to create an application credential to authenticate rather than a + // password. + // +optional + ApplicationCredentialName *string `json:"applicationCredentialName,omitempty"` + // ApplicationCredentialID + // +optional + ApplicationCredentialID *string `json:"applicationCredentialId,omitempty"` + // The applicationCredentialSecret field is required if using an application + // credential to authenticate. + // +optional + ApplicationCredentialSecret *corev1.SecretKeySelector `json:"applicationCredentialSecret,omitempty"` + // Whether the service discovery should list all instances for all projects. + // It is only relevant for the 'instance' role and usually requires admin permissions. + // +optional + AllTenants *bool `json:"allTenants,omitempty"` + // Refresh interval to re-read the instance list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // The port to scrape metrics from. If using the public IP address, this must + // instead be specified in the relabeling rule. + // +optional + Port *int `json:"port"` + // Availability of the endpoint to connect to. + // +kubebuilder:validation:Enum=Public;public;Admin;admin;Internal;internal + // +optional + Availability *string `json:"availability,omitempty"` + // TLS configuration applying to the target HTTP endpoint. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` +} + +// DigitalOceanSDConfig allow retrieving scrape targets from DigitalOcean's Droplets API. +// This service discovery uses the public IPv4 address by default, by that can be changed with relabeling +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config +// +k8s:openapi-gen=true +type DigitalOceanSDConfig struct { + // Authorization header configuration to authenticate against the DigitalOcean API. + // Cannot be set at the same time as `oauth2`. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be set at the same time as `authorization`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` + // TLS configuration applying to the target HTTP endpoint. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // The port to scrape metrics from. + // +optional + Port *int `json:"port,omitempty"` + // Refresh interval to re-read the instance list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` +} + +// KumaSDConfig allow retrieving scrape targets from Kuma's control plane. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kuma_sd_config +// +k8s:openapi-gen=true +type KumaSDConfig struct { + // Address of the Kuma Control Plane's MADS xDS server. + // +kubebuilder:validation:MinLength=1 + // +required + Server string `json:"server"` + // Client id is used by Kuma Control Plane to compute Monitoring Assignment for specific Prometheus backend. + // +optional + ClientID *string `json:"clientID,omitempty"` + // The time to wait between polling update requests. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // The time after which the monitoring assignments are refreshed. + // +optional + FetchTimeout *v1.Duration `json:"fetchTimeout,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // TLS configuration to use on every scrape request + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // BasicAuth information to use on every scrape request. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header to use on every scrape request. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be set at the same time as `authorization`, or `basicAuth`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` +} + +// Eureka SD configurations allow retrieving scrape targets using the Eureka REST API. +// Prometheus will periodically check the REST endpoint and create a target for every app instance. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#eureka_sd_config +// +k8s:openapi-gen=true +type EurekaSDConfig struct { + // The URL to connect to the Eureka server. + // +kubebuilder:validation:MinLength=1 + // +required + Server string `json:"server"` + // BasicAuth information to use on every scrape request. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header to use on every scrape request. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be set at the same time as `authorization` or `basic_auth`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // TLS configuration applying to the target HTTP endpoint. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` + // Refresh interval to re-read the instance list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` +} + +// Docker SD configurations allow retrieving scrape targets from Docker Engine hosts. +// This SD discovers "containers" and will create a target for each network IP and +// port the container is configured to expose. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#docker_sd_config +// +k8s:openapi-gen=true +type DockerSDConfig struct { + // Address of the docker daemon + // +kubebuilder:validation:MinLength=1 + // +required + Host string `json:"host"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // TLS configuration applying to the target HTTP endpoint. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // The port to scrape metrics from. + // +optional + Port *int `json:"port,omitempty"` + // The host to use if the container is in host networking mode. + // +optional + HostNetworkingHost *string `json:"hostNetworkingHost,omitempty"` + // Optional filters to limit the discovery process to a subset of the available resources. + // +optional + Filters *[]DockerFilter `json:"filters,omitempty"` + // Time after which the container is refreshed. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // BasicAuth information to use on every scrape request. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header configuration to authenticate against the Docker API. + // Cannot be set at the same time as `oauth2`. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be set at the same time as `authorization`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` +} + +// HetznerSDConfig allow retrieving scrape targets from Hetzner Cloud API and Robot API. +// This service discovery uses the public IPv4 address by default, but that can be changed with relabeling +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#hetzner_sd_config +// +k8s:openapi-gen=true +type HetznerSDConfig struct { + // The Hetzner role of entities that should be discovered. + // +kubebuilder:validation:Enum=hcloud;Hcloud;robot;Robot + // +required + Role string `json:"role"` + // BasicAuth information to use on every scrape request, required when role is robot. + // Role hcloud does not support basic auth. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header configuration, required when role is hcloud. + // Role robot does not support bearer token authentication. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be used at the same time as `basic_auth` or `authorization`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` + // TLS configuration to use on every scrape request. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // The port to scrape metrics from. + // +optional + Port *int `json:"port,omitempty"` + // The time after which the servers are refreshed. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` +} + +// NomadSDConfig configurations allow retrieving scrape targets from Nomad's Service API. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#nomad_sd_config +// +k8s:openapi-gen=true +type NomadSDConfig struct { + // The information to access the Nomad API. It is to be defined + // as the Nomad documentation requires. + // +optional + AllowStale *bool `json:"allowStale,omitempty"` + // +optional + Namespace *string `json:"namespace,omitempty"` + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // +optional + Region *string `json:"region,omitempty"` + // +kubebuilder:validation:MinLength=1 + // +required + Server string `json:"server"` + // +optional + TagSeparator *string `json:"tagSeparator,omitempty"` + // BasicAuth information to use on every scrape request. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header to use on every scrape request. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be set at the same time as `authorization` or `basic_auth`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + // TLS configuration applying to the target HTTP endpoint. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // ProxyConfig allows customizing the proxy behaviour for this scrape config. + // +optional + v1.ProxyConfig `json:",inline"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` +} + +// Service of the targets to retrieve. Must be `VPS` or `DedicatedServer`. +// +kubebuilder:validation:Enum=VPS;DedicatedServer +type OVHService string + +const ( + VPS OVHService = "VPS" + DedicatedServer OVHService = "DedicatedServer" +) + +// OVHCloudSDConfig configurations allow retrieving scrape targets from OVHcloud's dedicated servers and VPS using their API. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ovhcloud_sd_config +// +k8s:openapi-gen=true +type OVHCloudSDConfig struct { + // Access key to use. https://api.ovh.com. + // +kubebuilder:validation:MinLength=1 + // +required + ApplicationKey string `json:"applicationKey"` + // +required + ApplicationSecret corev1.SecretKeySelector `json:"applicationSecret"` + // +required + ConsumerKey corev1.SecretKeySelector `json:"consumerKey"` + // Service of the targets to retrieve. Must be `VPS` or `DedicatedServer`. + // +kubebuilder:validation:Enum=VPS;DedicatedServer + // +required + Service OVHService `json:"service"` + // Custom endpoint to be used. + // +kubebuilder:validation:MinLength=1 + // +optional + Endpoint *string `json:"endpoint,omitempty"` + // Refresh interval to re-read the resources list. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` +} + +// DockerSwarmSDConfig configurations allow retrieving scrape targets from Docker Swarm engine. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#dockerswarm_sd_config +// +k8s:openapi-gen=true +type DockerSwarmSDConfig struct { + // Address of the Docker daemon + // +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9+.-]*://.+$" + // +required + Host string `json:"host"` + // Role of the targets to retrieve. Must be `Services`, `Tasks`, or `Nodes`. + // +kubebuilder:validation:Enum=Services;Tasks;Nodes + // +required + Role string `json:"role"` + // The port to scrape metrics from, when `role` is nodes, and for discovered + // tasks and services that don't have published ports. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=65535 + // +optional + Port *int32 `json:"port"` + // Optional filters to limit the discovery process to a subset of available + // resources. + // The available filters are listed in the upstream documentation: + // Services: https://docs.docker.com/engine/api/v1.40/#operation/ServiceList + // Tasks: https://docs.docker.com/engine/api/v1.40/#operation/TaskList + // Nodes: https://docs.docker.com/engine/api/v1.40/#operation/NodeList + // +optional + Filters []DockerSwarmFilter `json:"filters"` + // The time after which the service discovery data is refreshed. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // Optional HTTP basic authentication information. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Authorization header configuration to authenticate against the target HTTP endpoint. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be set at the same time as `authorization`, or `basicAuth`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + v1.ProxyConfig `json:",inline"` + // TLS configuration to use on every scrape request + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` +} + +// LinodeSDConfig configurations allow retrieving scrape targets from Linode's Linode APIv4. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#linode_sd_config +// +k8s:openapi-gen=true +type LinodeSDConfig struct { + // Optional region to filter on. + // +kubebuilder:validation:MinLength=1 + // +optional + Region *string `json:"region,omitempty"` + // Default port to scrape metrics from. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=65535 + // +optional + Port *int32 `json:"port,omitempty"` + // The string by which Linode Instance tags are joined into the tag label. + // +kubebuilder:validation:MinLength=1 + // +optional + TagSeparator *string `json:"tagSeparator,omitempty"` + // Time after which the linode instances are refreshed. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // Authorization header configuration. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth 2.0 configuration. + // Cannot be used at the same time as `authorization`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + v1.ProxyConfig `json:",inline"` + // Configure whether HTTP requests follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // TLS configuration applying to the target HTTP endpoint. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // Whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` +} + +// PuppetDBSDConfig configurations allow retrieving scrape targets from PuppetDB resources. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#puppetdb_sd_config +type PuppetDBSDConfig struct { + // The URL of the PuppetDB root query endpoint. + // +kubebuilder:validation:MinLength:=1 + // +kubebuilder:validation:Pattern:="^http(s)?://.+$" + // +required + URL string `json:"url"` + // Puppet Query Language (PQL) query. Only resources are supported. + // https://puppet.com/docs/puppetdb/latest/api/query/v4/pql.html + // +kubebuilder:validation:MinLength=1 + // +required + Query string `json:"query"` + // Whether to include the parameters as meta labels. + // Note: Enabling this exposes parameters in the Prometheus UI and API. Make sure + // that you don't have secrets exposed as parameters if you enable this. + // +optional + IncludeParameters *bool `json:"includeParameters,omitempty"` + // Refresh interval to re-read the list of resources. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // Port to scrape the metrics from. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=65535 + Port *int32 `json:"port,omitempty"` + // Optional HTTP basic authentication information. + // Cannot be set at the same time as `authorization`, or `oauth2`. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Optional `authorization` HTTP header configuration. + // Cannot be set at the same time as `basicAuth`, or `oauth2`. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth2.0 configuration. + // Cannot be set at the same time as `basicAuth`, or `authorization`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + v1.ProxyConfig `json:",inline"` + // TLS configuration to connect to the Puppet DB. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // Configure whether the HTTP requests should follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Configure whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` +} + +// LightSailSDConfig configurations allow retrieving scrape targets from AWS Lightsail instances. +// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#lightsail_sd_config +// TODO: Need to document that we will not be supporting the `_file` fields. +type LightSailSDConfig struct { + // The AWS region. + // +kubebuilder:validation:MinLength=1 + // +optional + Region *string `json:"region,omitempty"` + // AccessKey is the AWS API key. + // +optional + AccessKey *corev1.SecretKeySelector `json:"accessKey,omitempty"` + // SecretKey is the AWS API secret. + // +optional + SecretKey *corev1.SecretKeySelector `json:"secretKey,omitempty"` + // AWS Role ARN, an alternative to using AWS API keys. + // +optional + RoleARN *string `json:"roleARN,omitempty"` + // Custom endpoint to be used. + // +kubebuilder:validation:MinLength=1 + // +optional + Endpoint *string `json:"endpoint,omitempty"` + // Refresh interval to re-read the list of instances. + // +optional + RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"` + // Port to scrape the metrics from. + // If using the public IP address, this must instead be specified in the relabeling rule. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=65535 + Port *int32 `json:"port,omitempty"` + // Optional HTTP basic authentication information. + // Cannot be set at the same time as `authorization`, or `oauth2`. + // +optional + BasicAuth *v1.BasicAuth `json:"basicAuth,omitempty"` + // Optional `authorization` HTTP header configuration. + // Cannot be set at the same time as `basicAuth`, or `oauth2`. + // +optional + Authorization *v1.SafeAuthorization `json:"authorization,omitempty"` + // Optional OAuth2.0 configuration. + // Cannot be set at the same time as `basicAuth`, or `authorization`. + // +optional + OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"` + v1.ProxyConfig `json:",inline"` + // TLS configuration to connect to the Puppet DB. + // +optional + TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // Configure whether the HTTP requests should follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` + // Configure whether to enable HTTP2. + // +optional + EnableHTTP2 *bool `json:"enableHTTP2,omitempty"` +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/validation.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/validation.go new file mode 100644 index 000000000..995f4675f --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/validation.go @@ -0,0 +1,350 @@ +// Copyright 2021 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1alpha1 + +import ( + "errors" + "fmt" + "regexp" + "strconv" + "strings" +) + +func (hc *HTTPConfig) Validate() error { + if hc == nil { + return nil + } + + if (hc.BasicAuth != nil || hc.OAuth2 != nil) && (hc.BearerTokenSecret != nil) { + return fmt.Errorf("at most one of basicAuth, oauth2, bearerTokenSecret must be configured") + } + + if hc.Authorization != nil { + if hc.BearerTokenSecret != nil { + return fmt.Errorf("authorization is not compatible with bearerTokenSecret") + } + + if hc.BasicAuth != nil || hc.OAuth2 != nil { + return fmt.Errorf("at most one of basicAuth, oauth2 & authorization must be configured") + } + + if err := hc.Authorization.Validate(); err != nil { + return err + } + } + + if hc.OAuth2 != nil { + if hc.BasicAuth != nil { + return fmt.Errorf("at most one of basicAuth, oauth2 & authorization must be configured") + } + + if err := hc.OAuth2.Validate(); err != nil { + return err + } + } + + if hc.TLSConfig != nil { + if err := hc.TLSConfig.Validate(); err != nil { + return err + } + } + + return nil +} + +// Validate the MuteTimeInterval +func (mti MuteTimeInterval) Validate() error { + if mti.Name == "" { + return errors.New("empty name field for mute time interval") + } + + for i, ti := range mti.TimeIntervals { + for _, time := range ti.Times { + if err := time.Validate(); err != nil { + return fmt.Errorf("time range at %d is invalid: %w", i, err) + } + } + for _, weekday := range ti.Weekdays { + if err := weekday.Validate(); err != nil { + return fmt.Errorf("weekday range at %d is invalid: %w", i, err) + } + } + for _, dom := range ti.DaysOfMonth { + if err := dom.Validate(); err != nil { + return fmt.Errorf("mute time interval is invalid - day of month range at %d is invalid: %w", i, err) + } + } + for _, month := range ti.Months { + if err := month.Validate(); err != nil { + return fmt.Errorf("month range at %d is invalid: %w", i, err) + } + } + for _, year := range ti.Years { + if err := year.Validate(); err != nil { + return fmt.Errorf("year range at %d is invalid: %w", i, err) + } + } + } + return nil +} + +// Validate the TimeRange +func (tr TimeRange) Validate() error { + _, err := tr.Parse() + return err +} + +// Parse returns a ParsedRange on valid input or an error if the fields cannot be parsed +// End of the day is represented as 1440. +func (tr TimeRange) Parse() (*ParsedRange, error) { + if tr.StartTime == "" || tr.EndTime == "" { + return nil, fmt.Errorf("start and end are required") + } + + start, err := parseTime(string(tr.StartTime)) + if err != nil { + return nil, fmt.Errorf("start time invalid: %w", err) + } + + end, err := parseTime(string(tr.EndTime)) + if err != nil { + return nil, fmt.Errorf("end time invalid: %w", err) + } + + if start >= end { + return nil, fmt.Errorf("start time %d cannot be equal or greater than end time %d", start, end) + } + return &ParsedRange{ + Start: start, + End: end, + }, nil +} + +// Validate the WeekdayRange +func (wr WeekdayRange) Validate() error { + _, err := wr.Parse() + return err +} + +// Parse returns a ParsedRange on valid input or an error if the fields cannot be parsed +// The week starts on Sunday -> 0 +func (wr WeekdayRange) Parse() (*ParsedRange, error) { + startStr, endStr, err := parseRange(string(wr)) + if err != nil { + return nil, err + } + + start, err := Weekday(startStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse start day from weekday range: %w", err) + } + + end, err := Weekday(endStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse end day from weekday range: %w", err) + } + + if start > end { + return nil, errors.New("start day cannot be before end day") + } + if start < 0 || start > 6 { + return nil, fmt.Errorf("%s is not a valid day of the week: out of range", startStr) + } + if end < 0 || end > 6 { + return nil, fmt.Errorf("%s is not a valid day of the week: out of range", endStr) + } + return &ParsedRange{Start: start, End: end}, nil +} + +// Validate the YearRange +func (yr YearRange) Validate() error { + _, err := yr.Parse() + return err +} + +// Parse returns a ParsedRange on valid input or an error if the fields cannot be parsed +func (yr YearRange) Parse() (*ParsedRange, error) { + startStr, endStr, err := parseRange(string(yr)) + if err != nil { + return nil, err + } + + start, err := strconv.Atoi(startStr) + if err != nil { + return nil, fmt.Errorf("start year cannot be %s parsed: %w", startStr, err) + } + + end, err := strconv.Atoi(endStr) + if err != nil { + return nil, fmt.Errorf("end year cannot be %s parsed: %w", endStr, err) + } + + if start > end { + return nil, fmt.Errorf("end year %d is before start year %d", end, start) + } + return &ParsedRange{Start: start, End: end}, nil +} + +// Int returns an integer, which is the canonical representation +// of the Weekday in upstream types. +// Returns an error if the Weekday is invalid +func (w Weekday) Int() (int, error) { + normaliseWeekday := Weekday(strings.ToLower(string(w))) + + day, found := daysOfWeek[normaliseWeekday] + if !found { + i, err := strconv.Atoi(string(normaliseWeekday)) + if err != nil { + return day, fmt.Errorf("%s is an invalid weekday", w) + } + day = i + } + + return day, nil +} + +// Int validates the Month and returns an integer, which is the canonical representation +// of the Month in upstream types. +// Returns an error if the Month is invalid +func (m Month) Int() (int, error) { + normaliseMonth := Month(strings.ToLower(string(m))) + + month, found := months[normaliseMonth] + if !found { + i, err := strconv.Atoi(string(normaliseMonth)) + if err != nil || i < 1 || i > 12 { + return month, fmt.Errorf("%s is an invalid month", m) + } + month = i + } + + return month, nil +} + +// Validate the DayOfMonthRange +func (r DayOfMonthRange) Validate() error { + // Note: Validation is copied from UnmarshalYAML for DayOfMonthRange in alertmanager repo + + // Check beginning <= end accounting for negatives day of month indices as well. + // Months != 31 days can't be addressed here and are clamped, but at least we can catch blatant errors. + if r.Start == 0 || r.Start < -31 || r.Start > 31 { + return fmt.Errorf("%d is not a valid day of the month: out of range", r.Start) + } + if r.End == 0 || r.End < -31 || r.End > 31 { + return fmt.Errorf("%d is not a valid day of the month: out of range", r.End) + } + // Restricting here prevents errors where begin > end in longer months but not shorter months. + if r.Start < 0 && r.End > 0 { + return fmt.Errorf("end day must be negative if start day is negative") + } + // Check begin <= end. We can't know this for sure when using negative indices, + // but we can prevent cases where its always invalid (using 28 day minimum length). + checkBegin := r.Start + checkEnd := r.End + if r.Start < 0 { + checkBegin = 28 + r.Start + } + if r.End < 0 { + checkEnd = 28 + r.End + } + if checkBegin > checkEnd { + return fmt.Errorf("end day %d is always before start day %d", r.End, r.Start) + } + return nil +} + +// Validate the month range +func (mr MonthRange) Validate() error { + _, err := mr.Parse() + return err +} + +// Parse returns a ParsedMonthRange or error on invalid input +func (mr MonthRange) Parse() (*ParsedRange, error) { + startStr, endStr, err := parseRange(string(mr)) + if err != nil { + return nil, err + } + + start, err := Month(startStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse start month from month range: %w", err) + } + + end, err := Month(endStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse start month from month range: %w", err) + } + + if start > end { + return nil, fmt.Errorf("end month %s is before start month %s", endStr, startStr) + } + return &ParsedRange{ + Start: start, + End: end, + }, nil +} + +// ParsedRange is an integer representation of a range +// +kubebuilder:object:generate:=false +type ParsedRange struct { + // Start is the beginning of the range + Start int `json:"start,omitempty"` + // End of the range + End int `json:"end,omitempty"` +} + +var ( + validTime = "^((([01][0-9])|(2[0-3])):[0-5][0-9])$|(^24:00$)" + validTimeRE = regexp.MustCompile(validTime) +) + +// Converts a string of the form "HH:MM" into the number of minutes elapsed in the day. +func parseTime(in string) (mins int, err error) { + if !validTimeRE.MatchString(in) { + return 0, fmt.Errorf("couldn't parse timestamp %s, invalid format", in) + } + timestampComponents := strings.Split(in, ":") + if len(timestampComponents) != 2 { + return 0, fmt.Errorf("invalid timestamp format: %s", in) + } + timeStampHours, err := strconv.Atoi(timestampComponents[0]) + if err != nil { + return 0, err + } + timeStampMinutes, err := strconv.Atoi(timestampComponents[1]) + if err != nil { + return 0, err + } + if timeStampHours < 0 || timeStampHours > 24 || timeStampMinutes < 0 || timeStampMinutes > 60 { + return 0, fmt.Errorf("timestamp %s out of range", in) + } + // Timestamps are stored as minutes elapsed in the day, so multiply hours by 60. + mins = timeStampHours*60 + timeStampMinutes + return mins, nil +} + +// parseRange parses a valid range string into parts +func parseRange(in string) (start, end string, err error) { + if !strings.ContainsRune(in, ':') { + return in, in, nil + } + + parts := strings.Split(string(in), ":") + if len(parts) != 2 { + return start, end, fmt.Errorf("invalid range provided %s", in) + } + return parts[0], parts[1], nil +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..586b27abe --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,2820 @@ +//go:build !ignore_autogenerated + +// Copyright The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerConfig) DeepCopyInto(out *AlertmanagerConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfig. +func (in *AlertmanagerConfig) DeepCopy() *AlertmanagerConfig { + if in == nil { + return nil + } + out := new(AlertmanagerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerConfigList) DeepCopyInto(out *AlertmanagerConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*AlertmanagerConfig, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(AlertmanagerConfig) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfigList. +func (in *AlertmanagerConfigList) DeepCopy() *AlertmanagerConfigList { + if in == nil { + return nil + } + out := new(AlertmanagerConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerConfigSpec) DeepCopyInto(out *AlertmanagerConfigSpec) { + *out = *in + if in.Route != nil { + in, out := &in.Route, &out.Route + *out = new(Route) + (*in).DeepCopyInto(*out) + } + if in.Receivers != nil { + in, out := &in.Receivers, &out.Receivers + *out = make([]Receiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.InhibitRules != nil { + in, out := &in.InhibitRules, &out.InhibitRules + *out = make([]InhibitRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MuteTimeIntervals != nil { + in, out := &in.MuteTimeIntervals, &out.MuteTimeIntervals + *out = make([]MuteTimeInterval, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfigSpec. +func (in *AlertmanagerConfigSpec) DeepCopy() *AlertmanagerConfigSpec { + if in == nil { + return nil + } + out := new(AlertmanagerConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AttachMetadata) DeepCopyInto(out *AttachMetadata) { + *out = *in + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AttachMetadata. +func (in *AttachMetadata) DeepCopy() *AttachMetadata { + if in == nil { + return nil + } + out := new(AttachMetadata) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureSDConfig) DeepCopyInto(out *AzureSDConfig) { + *out = *in + if in.Environment != nil { + in, out := &in.Environment, &out.Environment + *out = new(string) + **out = **in + } + if in.AuthenticationMethod != nil { + in, out := &in.AuthenticationMethod, &out.AuthenticationMethod + *out = new(string) + **out = **in + } + if in.TenantID != nil { + in, out := &in.TenantID, &out.TenantID + *out = new(string) + **out = **in + } + if in.ClientID != nil { + in, out := &in.ClientID, &out.ClientID + *out = new(string) + **out = **in + } + if in.ClientSecret != nil { + in, out := &in.ClientSecret, &out.ClientSecret + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.ResourceGroup != nil { + in, out := &in.ResourceGroup, &out.ResourceGroup + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSDConfig. +func (in *AzureSDConfig) DeepCopy() *AzureSDConfig { + if in == nil { + return nil + } + out := new(AzureSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConsulSDConfig) DeepCopyInto(out *ConsulSDConfig) { + *out = *in + if in.TokenRef != nil { + in, out := &in.TokenRef, &out.TokenRef + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.Datacenter != nil { + in, out := &in.Datacenter, &out.Datacenter + *out = new(string) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.Partition != nil { + in, out := &in.Partition, &out.Partition + *out = new(string) + **out = **in + } + if in.Scheme != nil { + in, out := &in.Scheme, &out.Scheme + *out = new(string) + **out = **in + } + if in.Services != nil { + in, out := &in.Services, &out.Services + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.TagSeparator != nil { + in, out := &in.TagSeparator, &out.TagSeparator + *out = new(string) + **out = **in + } + if in.NodeMeta != nil { + in, out := &in.NodeMeta, &out.NodeMeta + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.AllowStale != nil { + in, out := &in.AllowStale, &out.AllowStale + *out = new(bool) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.Oauth2 != nil { + in, out := &in.Oauth2, &out.Oauth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHttp2 != nil { + in, out := &in.EnableHttp2, &out.EnableHttp2 + *out = new(bool) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsulSDConfig. +func (in *ConsulSDConfig) DeepCopy() *ConsulSDConfig { + if in == nil { + return nil + } + out := new(ConsulSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DNSSDConfig) DeepCopyInto(out *DNSSDConfig) { + *out = *in + if in.Names != nil { + in, out := &in.Names, &out.Names + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNSSDConfig. +func (in *DNSSDConfig) DeepCopy() *DNSSDConfig { + if in == nil { + return nil + } + out := new(DNSSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DayOfMonthRange) DeepCopyInto(out *DayOfMonthRange) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DayOfMonthRange. +func (in *DayOfMonthRange) DeepCopy() *DayOfMonthRange { + if in == nil { + return nil + } + out := new(DayOfMonthRange) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DigitalOceanSDConfig) DeepCopyInto(out *DigitalOceanSDConfig) { + *out = *in + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanSDConfig. +func (in *DigitalOceanSDConfig) DeepCopy() *DigitalOceanSDConfig { + if in == nil { + return nil + } + out := new(DigitalOceanSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscordConfig) DeepCopyInto(out *DiscordConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + in.APIURL.DeepCopyInto(&out.APIURL) + if in.Title != nil { + in, out := &in.Title, &out.Title + *out = new(string) + **out = **in + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscordConfig. +func (in *DiscordConfig) DeepCopy() *DiscordConfig { + if in == nil { + return nil + } + out := new(DiscordConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerFilter) DeepCopyInto(out *DockerFilter) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerFilter. +func (in *DockerFilter) DeepCopy() *DockerFilter { + if in == nil { + return nil + } + out := new(DockerFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerSDConfig) DeepCopyInto(out *DockerSDConfig) { + *out = *in + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } + if in.HostNetworkingHost != nil { + in, out := &in.HostNetworkingHost, &out.HostNetworkingHost + *out = new(string) + **out = **in + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = new([]DockerFilter) + if **in != nil { + in, out := *in, *out + *out = make([]DockerFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerSDConfig. +func (in *DockerSDConfig) DeepCopy() *DockerSDConfig { + if in == nil { + return nil + } + out := new(DockerSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerSwarmFilter) DeepCopyInto(out *DockerSwarmFilter) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerSwarmFilter. +func (in *DockerSwarmFilter) DeepCopy() *DockerSwarmFilter { + if in == nil { + return nil + } + out := new(DockerSwarmFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerSwarmSDConfig) DeepCopyInto(out *DockerSwarmSDConfig) { + *out = *in + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]DockerSwarmFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerSwarmSDConfig. +func (in *DockerSwarmSDConfig) DeepCopy() *DockerSwarmSDConfig { + if in == nil { + return nil + } + out := new(DockerSwarmSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EC2Filter) DeepCopyInto(out *EC2Filter) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EC2Filter. +func (in *EC2Filter) DeepCopy() *EC2Filter { + if in == nil { + return nil + } + out := new(EC2Filter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EC2SDConfig) DeepCopyInto(out *EC2SDConfig) { + *out = *in + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.AccessKey != nil { + in, out := &in.AccessKey, &out.AccessKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.SecretKey != nil { + in, out := &in.SecretKey, &out.SecretKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.RoleARN != nil { + in, out := &in.RoleARN, &out.RoleARN + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]*EC2Filter, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(EC2Filter) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EC2SDConfig. +func (in *EC2SDConfig) DeepCopy() *EC2SDConfig { + if in == nil { + return nil + } + out := new(EC2SDConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.AuthPassword != nil { + in, out := &in.AuthPassword, &out.AuthPassword + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.AuthSecret != nil { + in, out := &in.AuthSecret, &out.AuthSecret + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.HTML != nil { + in, out := &in.HTML, &out.HTML + *out = new(string) + **out = **in + } + if in.Text != nil { + in, out := &in.Text, &out.Text + *out = new(string) + **out = **in + } + if in.RequireTLS != nil { + in, out := &in.RequireTLS, &out.RequireTLS + *out = new(bool) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*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 *EurekaSDConfig) DeepCopyInto(out *EurekaSDConfig) { + *out = *in + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EurekaSDConfig. +func (in *EurekaSDConfig) DeepCopy() *EurekaSDConfig { + if in == nil { + return nil + } + out := new(EurekaSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileSDConfig) DeepCopyInto(out *FileSDConfig) { + *out = *in + if in.Files != nil { + in, out := &in.Files, &out.Files + *out = make([]SDFile, len(*in)) + copy(*out, *in) + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileSDConfig. +func (in *FileSDConfig) DeepCopy() *FileSDConfig { + if in == nil { + return nil + } + out := new(FileSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCESDConfig) DeepCopyInto(out *GCESDConfig) { + *out = *in + if in.Filter != nil { + in, out := &in.Filter, &out.Filter + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } + if in.TagSeparator != nil { + in, out := &in.TagSeparator, &out.TagSeparator + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCESDConfig. +func (in *GCESDConfig) DeepCopy() *GCESDConfig { + if in == nil { + return nil + } + out := new(GCESDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPConfig) DeepCopyInto(out *HTTPConfig) { + *out = *in + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + if in.BearerTokenSecret != nil { + in, out := &in.BearerTokenSecret, &out.BearerTokenSecret + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPConfig. +func (in *HTTPConfig) DeepCopy() *HTTPConfig { + if in == nil { + return nil + } + out := new(HTTPConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPSDConfig) DeepCopyInto(out *HTTPSDConfig) { + *out = *in + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPSDConfig. +func (in *HTTPSDConfig) DeepCopy() *HTTPSDConfig { + if in == nil { + return nil + } + out := new(HTTPSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HetznerSDConfig) DeepCopyInto(out *HetznerSDConfig) { + *out = *in + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HetznerSDConfig. +func (in *HetznerSDConfig) DeepCopy() *HetznerSDConfig { + if in == nil { + return nil + } + out := new(HetznerSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InhibitRule) DeepCopyInto(out *InhibitRule) { + *out = *in + if in.TargetMatch != nil { + in, out := &in.TargetMatch, &out.TargetMatch + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.SourceMatch != nil { + in, out := &in.SourceMatch, &out.SourceMatch + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.Equal != nil { + in, out := &in.Equal, &out.Equal + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InhibitRule. +func (in *InhibitRule) DeepCopy() *InhibitRule { + if in == nil { + return nil + } + out := new(InhibitRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *K8SSelectorConfig) DeepCopyInto(out *K8SSelectorConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K8SSelectorConfig. +func (in *K8SSelectorConfig) DeepCopy() *K8SSelectorConfig { + if in == nil { + return nil + } + out := new(K8SSelectorConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyValue) DeepCopyInto(out *KeyValue) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyValue. +func (in *KeyValue) DeepCopy() *KeyValue { + if in == nil { + return nil + } + out := new(KeyValue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubernetesSDConfig) DeepCopyInto(out *KubernetesSDConfig) { + *out = *in + if in.APIServer != nil { + in, out := &in.APIServer, &out.APIServer + *out = new(string) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.Namespaces != nil { + in, out := &in.Namespaces, &out.Namespaces + *out = new(NamespaceDiscovery) + (*in).DeepCopyInto(*out) + } + if in.AttachMetadata != nil { + in, out := &in.AttachMetadata, &out.AttachMetadata + *out = new(AttachMetadata) + (*in).DeepCopyInto(*out) + } + if in.Selectors != nil { + in, out := &in.Selectors, &out.Selectors + *out = make([]K8SSelectorConfig, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesSDConfig. +func (in *KubernetesSDConfig) DeepCopy() *KubernetesSDConfig { + if in == nil { + return nil + } + out := new(KubernetesSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KumaSDConfig) DeepCopyInto(out *KumaSDConfig) { + *out = *in + if in.ClientID != nil { + in, out := &in.ClientID, &out.ClientID + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.FetchTimeout != nil { + in, out := &in.FetchTimeout, &out.FetchTimeout + *out = new(monitoringv1.Duration) + **out = **in + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KumaSDConfig. +func (in *KumaSDConfig) DeepCopy() *KumaSDConfig { + if in == nil { + return nil + } + out := new(KumaSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LightSailSDConfig) DeepCopyInto(out *LightSailSDConfig) { + *out = *in + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.AccessKey != nil { + in, out := &in.AccessKey, &out.AccessKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.SecretKey != nil { + in, out := &in.SecretKey, &out.SecretKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.RoleARN != nil { + in, out := &in.RoleARN, &out.RoleARN + *out = new(string) + **out = **in + } + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LightSailSDConfig. +func (in *LightSailSDConfig) DeepCopy() *LightSailSDConfig { + if in == nil { + return nil + } + out := new(LightSailSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinodeSDConfig) DeepCopyInto(out *LinodeSDConfig) { + *out = *in + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.TagSeparator != nil { + in, out := &in.TagSeparator, &out.TagSeparator + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinodeSDConfig. +func (in *LinodeSDConfig) DeepCopy() *LinodeSDConfig { + if in == nil { + return nil + } + out := new(LinodeSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MSTeamsConfig) DeepCopyInto(out *MSTeamsConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + in.WebhookURL.DeepCopyInto(&out.WebhookURL) + if in.Title != nil { + in, out := &in.Title, &out.Title + *out = new(string) + **out = **in + } + if in.Summary != nil { + in, out := &in.Summary, &out.Summary + *out = new(string) + **out = **in + } + if in.Text != nil { + in, out := &in.Text, &out.Text + *out = new(string) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MSTeamsConfig. +func (in *MSTeamsConfig) DeepCopy() *MSTeamsConfig { + if in == nil { + return nil + } + out := new(MSTeamsConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Matcher) DeepCopyInto(out *Matcher) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Matcher. +func (in *Matcher) DeepCopy() *Matcher { + if in == nil { + return nil + } + out := new(Matcher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MuteTimeInterval) DeepCopyInto(out *MuteTimeInterval) { + *out = *in + if in.TimeIntervals != nil { + in, out := &in.TimeIntervals, &out.TimeIntervals + *out = make([]TimeInterval, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MuteTimeInterval. +func (in *MuteTimeInterval) DeepCopy() *MuteTimeInterval { + if in == nil { + return nil + } + out := new(MuteTimeInterval) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamespaceDiscovery) DeepCopyInto(out *NamespaceDiscovery) { + *out = *in + if in.IncludeOwnNamespace != nil { + in, out := &in.IncludeOwnNamespace, &out.IncludeOwnNamespace + *out = new(bool) + **out = **in + } + if in.Names != nil { + in, out := &in.Names, &out.Names + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceDiscovery. +func (in *NamespaceDiscovery) DeepCopy() *NamespaceDiscovery { + if in == nil { + return nil + } + out := new(NamespaceDiscovery) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NomadSDConfig) DeepCopyInto(out *NomadSDConfig) { + *out = *in + if in.AllowStale != nil { + in, out := &in.AllowStale, &out.AllowStale + *out = new(bool) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.TagSeparator != nil { + in, out := &in.TagSeparator, &out.TagSeparator + *out = new(string) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NomadSDConfig. +func (in *NomadSDConfig) DeepCopy() *NomadSDConfig { + if in == nil { + return nil + } + out := new(NomadSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OVHCloudSDConfig) DeepCopyInto(out *OVHCloudSDConfig) { + *out = *in + in.ApplicationSecret.DeepCopyInto(&out.ApplicationSecret) + in.ConsumerKey.DeepCopyInto(&out.ConsumerKey) + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + *out = new(string) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OVHCloudSDConfig. +func (in *OVHCloudSDConfig) DeepCopy() *OVHCloudSDConfig { + if in == nil { + return nil + } + out := new(OVHCloudSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenStackSDConfig) DeepCopyInto(out *OpenStackSDConfig) { + *out = *in + if in.IdentityEndpoint != nil { + in, out := &in.IdentityEndpoint, &out.IdentityEndpoint + *out = new(string) + **out = **in + } + if in.Username != nil { + in, out := &in.Username, &out.Username + *out = new(string) + **out = **in + } + if in.UserID != nil { + in, out := &in.UserID, &out.UserID + *out = new(string) + **out = **in + } + if in.Password != nil { + in, out := &in.Password, &out.Password + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.DomainName != nil { + in, out := &in.DomainName, &out.DomainName + *out = new(string) + **out = **in + } + if in.DomainID != nil { + in, out := &in.DomainID, &out.DomainID + *out = new(string) + **out = **in + } + if in.ProjectName != nil { + in, out := &in.ProjectName, &out.ProjectName + *out = new(string) + **out = **in + } + if in.ProjectID != nil { + in, out := &in.ProjectID, &out.ProjectID + *out = new(string) + **out = **in + } + if in.ApplicationCredentialName != nil { + in, out := &in.ApplicationCredentialName, &out.ApplicationCredentialName + *out = new(string) + **out = **in + } + if in.ApplicationCredentialID != nil { + in, out := &in.ApplicationCredentialID, &out.ApplicationCredentialID + *out = new(string) + **out = **in + } + if in.ApplicationCredentialSecret != nil { + in, out := &in.ApplicationCredentialSecret, &out.ApplicationCredentialSecret + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.AllTenants != nil { + in, out := &in.AllTenants, &out.AllTenants + *out = new(bool) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int) + **out = **in + } + if in.Availability != nil { + in, out := &in.Availability, &out.Availability + *out = new(string) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackSDConfig. +func (in *OpenStackSDConfig) DeepCopy() *OpenStackSDConfig { + if in == nil { + return nil + } + out := new(OpenStackSDConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpsGenieConfig) DeepCopyInto(out *OpsGenieConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIKey != nil { + in, out := &in.APIKey, &out.APIKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.UpdateAlerts != nil { + in, out := &in.UpdateAlerts, &out.UpdateAlerts + *out = new(bool) + **out = **in + } + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.Responders != nil { + in, out := &in.Responders, &out.Responders + *out = make([]OpsGenieConfigResponder, len(*in)) + copy(*out, *in) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpsGenieConfig. +func (in *OpsGenieConfig) DeepCopy() *OpsGenieConfig { + if in == nil { + return nil + } + out := new(OpsGenieConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpsGenieConfigResponder) DeepCopyInto(out *OpsGenieConfigResponder) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpsGenieConfigResponder. +func (in *OpsGenieConfigResponder) DeepCopy() *OpsGenieConfigResponder { + if in == nil { + return nil + } + out := new(OpsGenieConfigResponder) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PagerDutyConfig) DeepCopyInto(out *PagerDutyConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.RoutingKey != nil { + in, out := &in.RoutingKey, &out.RoutingKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.ServiceKey != nil { + in, out := &in.ServiceKey, &out.ServiceKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.PagerDutyImageConfigs != nil { + in, out := &in.PagerDutyImageConfigs, &out.PagerDutyImageConfigs + *out = make([]PagerDutyImageConfig, len(*in)) + copy(*out, *in) + } + if in.PagerDutyLinkConfigs != nil { + in, out := &in.PagerDutyLinkConfigs, &out.PagerDutyLinkConfigs + *out = make([]PagerDutyLinkConfig, len(*in)) + copy(*out, *in) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } + if in.Source != nil { + in, out := &in.Source, &out.Source + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyConfig. +func (in *PagerDutyConfig) DeepCopy() *PagerDutyConfig { + if in == nil { + return nil + } + out := new(PagerDutyConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PagerDutyImageConfig) DeepCopyInto(out *PagerDutyImageConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyImageConfig. +func (in *PagerDutyImageConfig) DeepCopy() *PagerDutyImageConfig { + if in == nil { + return nil + } + out := new(PagerDutyImageConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PagerDutyLinkConfig) DeepCopyInto(out *PagerDutyLinkConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyLinkConfig. +func (in *PagerDutyLinkConfig) DeepCopy() *PagerDutyLinkConfig { + if in == nil { + return nil + } + out := new(PagerDutyLinkConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusAgent) DeepCopyInto(out *PrometheusAgent) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusAgent. +func (in *PrometheusAgent) DeepCopy() *PrometheusAgent { + if in == nil { + return nil + } + out := new(PrometheusAgent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusAgentList) DeepCopyInto(out *PrometheusAgentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*PrometheusAgent, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(PrometheusAgent) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusAgentList. +func (in *PrometheusAgentList) DeepCopy() *PrometheusAgentList { + if in == nil { + return nil + } + out := new(PrometheusAgentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusAgentSpec) DeepCopyInto(out *PrometheusAgentSpec) { + *out = *in + if in.Mode != nil { + in, out := &in.Mode, &out.Mode + *out = new(string) + **out = **in + } + in.CommonPrometheusFields.DeepCopyInto(&out.CommonPrometheusFields) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusAgentSpec. +func (in *PrometheusAgentSpec) DeepCopy() *PrometheusAgentSpec { + if in == nil { + return nil + } + out := new(PrometheusAgentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PuppetDBSDConfig) DeepCopyInto(out *PuppetDBSDConfig) { + *out = *in + if in.IncludeParameters != nil { + in, out := &in.IncludeParameters, &out.IncludeParameters + *out = new(bool) + **out = **in + } + if in.RefreshInterval != nil { + in, out := &in.RefreshInterval, &out.RefreshInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } + if in.EnableHTTP2 != nil { + in, out := &in.EnableHTTP2, &out.EnableHTTP2 + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PuppetDBSDConfig. +func (in *PuppetDBSDConfig) DeepCopy() *PuppetDBSDConfig { + if in == nil { + return nil + } + out := new(PuppetDBSDConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.UserKey != nil { + in, out := &in.UserKey, &out.UserKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.UserKeyFile != nil { + in, out := &in.UserKeyFile, &out.UserKeyFile + *out = new(string) + **out = **in + } + if in.Token != nil { + in, out := &in.Token, &out.Token + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.TokenFile != nil { + in, out := &in.TokenFile, &out.TokenFile + *out = new(string) + **out = **in + } + if in.TTL != nil { + in, out := &in.TTL, &out.TTL + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*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 *Receiver) DeepCopyInto(out *Receiver) { + *out = *in + if in.OpsGenieConfigs != nil { + in, out := &in.OpsGenieConfigs, &out.OpsGenieConfigs + *out = make([]OpsGenieConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PagerDutyConfigs != nil { + in, out := &in.PagerDutyConfigs, &out.PagerDutyConfigs + *out = make([]PagerDutyConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DiscordConfigs != nil { + in, out := &in.DiscordConfigs, &out.DiscordConfigs + *out = make([]DiscordConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SlackConfigs != nil { + in, out := &in.SlackConfigs, &out.SlackConfigs + *out = make([]SlackConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.WebhookConfigs != nil { + in, out := &in.WebhookConfigs, &out.WebhookConfigs + *out = make([]WebhookConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.WeChatConfigs != nil { + in, out := &in.WeChatConfigs, &out.WeChatConfigs + *out = make([]WeChatConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EmailConfigs != nil { + in, out := &in.EmailConfigs, &out.EmailConfigs + *out = make([]EmailConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.VictorOpsConfigs != nil { + in, out := &in.VictorOpsConfigs, &out.VictorOpsConfigs + *out = make([]VictorOpsConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PushoverConfigs != nil { + in, out := &in.PushoverConfigs, &out.PushoverConfigs + *out = make([]PushoverConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SNSConfigs != nil { + in, out := &in.SNSConfigs, &out.SNSConfigs + *out = make([]SNSConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.TelegramConfigs != nil { + in, out := &in.TelegramConfigs, &out.TelegramConfigs + *out = make([]TelegramConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.WebexConfigs != nil { + in, out := &in.WebexConfigs, &out.WebexConfigs + *out = make([]WebexConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MSTeamsConfigs != nil { + in, out := &in.MSTeamsConfigs, &out.MSTeamsConfigs + *out = make([]MSTeamsConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// 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 +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route) DeepCopyInto(out *Route) { + *out = *in + if in.GroupBy != nil { + in, out := &in.GroupBy, &out.GroupBy + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Matchers != nil { + in, out := &in.Matchers, &out.Matchers + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]v1.JSON, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MuteTimeIntervals != nil { + in, out := &in.MuteTimeIntervals, &out.MuteTimeIntervals + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ActiveTimeIntervals != nil { + in, out := &in.ActiveTimeIntervals, &out.ActiveTimeIntervals + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. +func (in *Route) DeepCopy() *Route { + if in == nil { + return nil + } + out := new(Route) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SNSConfig) DeepCopyInto(out *SNSConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.Sigv4 != nil { + in, out := &in.Sigv4, &out.Sigv4 + *out = new(monitoringv1.Sigv4) + (*in).DeepCopyInto(*out) + } + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SNSConfig. +func (in *SNSConfig) DeepCopy() *SNSConfig { + if in == nil { + return nil + } + out := new(SNSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScrapeConfig) DeepCopyInto(out *ScrapeConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScrapeConfig. +func (in *ScrapeConfig) DeepCopy() *ScrapeConfig { + if in == nil { + return nil + } + out := new(ScrapeConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScrapeConfigList) DeepCopyInto(out *ScrapeConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*ScrapeConfig, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ScrapeConfig) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScrapeConfigList. +func (in *ScrapeConfigList) DeepCopy() *ScrapeConfigList { + if in == nil { + return nil + } + out := new(ScrapeConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScrapeConfigSpec) DeepCopyInto(out *ScrapeConfigSpec) { + *out = *in + if in.JobName != nil { + in, out := &in.JobName, &out.JobName + *out = new(string) + **out = **in + } + if in.StaticConfigs != nil { + in, out := &in.StaticConfigs, &out.StaticConfigs + *out = make([]StaticConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FileSDConfigs != nil { + in, out := &in.FileSDConfigs, &out.FileSDConfigs + *out = make([]FileSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.HTTPSDConfigs != nil { + in, out := &in.HTTPSDConfigs, &out.HTTPSDConfigs + *out = make([]HTTPSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.KubernetesSDConfigs != nil { + in, out := &in.KubernetesSDConfigs, &out.KubernetesSDConfigs + *out = make([]KubernetesSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ConsulSDConfigs != nil { + in, out := &in.ConsulSDConfigs, &out.ConsulSDConfigs + *out = make([]ConsulSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DNSSDConfigs != nil { + in, out := &in.DNSSDConfigs, &out.DNSSDConfigs + *out = make([]DNSSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EC2SDConfigs != nil { + in, out := &in.EC2SDConfigs, &out.EC2SDConfigs + *out = make([]EC2SDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AzureSDConfigs != nil { + in, out := &in.AzureSDConfigs, &out.AzureSDConfigs + *out = make([]AzureSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.GCESDConfigs != nil { + in, out := &in.GCESDConfigs, &out.GCESDConfigs + *out = make([]GCESDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OpenStackSDConfigs != nil { + in, out := &in.OpenStackSDConfigs, &out.OpenStackSDConfigs + *out = make([]OpenStackSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DigitalOceanSDConfigs != nil { + in, out := &in.DigitalOceanSDConfigs, &out.DigitalOceanSDConfigs + *out = make([]DigitalOceanSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.KumaSDConfigs != nil { + in, out := &in.KumaSDConfigs, &out.KumaSDConfigs + *out = make([]KumaSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EurekaSDConfigs != nil { + in, out := &in.EurekaSDConfigs, &out.EurekaSDConfigs + *out = make([]EurekaSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DockerSDConfigs != nil { + in, out := &in.DockerSDConfigs, &out.DockerSDConfigs + *out = make([]DockerSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LinodeSDConfigs != nil { + in, out := &in.LinodeSDConfigs, &out.LinodeSDConfigs + *out = make([]LinodeSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.HetznerSDConfigs != nil { + in, out := &in.HetznerSDConfigs, &out.HetznerSDConfigs + *out = make([]HetznerSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.NomadSDConfigs != nil { + in, out := &in.NomadSDConfigs, &out.NomadSDConfigs + *out = make([]NomadSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DockerSwarmSDConfigs != nil { + in, out := &in.DockerSwarmSDConfigs, &out.DockerSwarmSDConfigs + *out = make([]DockerSwarmSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PuppetDBSDConfigs != nil { + in, out := &in.PuppetDBSDConfigs, &out.PuppetDBSDConfigs + *out = make([]PuppetDBSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LightSailSDConfigs != nil { + in, out := &in.LightSailSDConfigs, &out.LightSailSDConfigs + *out = make([]LightSailSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OVHCloudSDConfigs != nil { + in, out := &in.OVHCloudSDConfigs, &out.OVHCloudSDConfigs + *out = make([]OVHCloudSDConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RelabelConfigs != nil { + in, out := &in.RelabelConfigs, &out.RelabelConfigs + *out = make([]monitoringv1.RelabelConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MetricsPath != nil { + in, out := &in.MetricsPath, &out.MetricsPath + *out = new(string) + **out = **in + } + if in.ScrapeInterval != nil { + in, out := &in.ScrapeInterval, &out.ScrapeInterval + *out = new(monitoringv1.Duration) + **out = **in + } + if in.ScrapeTimeout != nil { + in, out := &in.ScrapeTimeout, &out.ScrapeTimeout + *out = new(monitoringv1.Duration) + **out = **in + } + if in.ScrapeProtocols != nil { + in, out := &in.ScrapeProtocols, &out.ScrapeProtocols + *out = make([]monitoringv1.ScrapeProtocol, len(*in)) + copy(*out, *in) + } + if in.HonorTimestamps != nil { + in, out := &in.HonorTimestamps, &out.HonorTimestamps + *out = new(bool) + **out = **in + } + if in.TrackTimestampsStaleness != nil { + in, out := &in.TrackTimestampsStaleness, &out.TrackTimestampsStaleness + *out = new(bool) + **out = **in + } + if in.HonorLabels != nil { + in, out := &in.HonorLabels, &out.HonorLabels + *out = new(bool) + **out = **in + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make(map[string][]string, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } + if in.Scheme != nil { + in, out := &in.Scheme, &out.Scheme + *out = new(string) + **out = **in + } + if in.EnableCompression != nil { + in, out := &in.EnableCompression, &out.EnableCompression + *out = new(bool) + **out = **in + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.SampleLimit != nil { + in, out := &in.SampleLimit, &out.SampleLimit + *out = new(uint64) + **out = **in + } + if in.TargetLimit != nil { + in, out := &in.TargetLimit, &out.TargetLimit + *out = new(uint64) + **out = **in + } + if in.LabelLimit != nil { + in, out := &in.LabelLimit, &out.LabelLimit + *out = new(uint64) + **out = **in + } + if in.LabelNameLengthLimit != nil { + in, out := &in.LabelNameLengthLimit, &out.LabelNameLengthLimit + *out = new(uint64) + **out = **in + } + if in.LabelValueLengthLimit != nil { + in, out := &in.LabelValueLengthLimit, &out.LabelValueLengthLimit + *out = new(uint64) + **out = **in + } + if in.KeepDroppedTargets != nil { + in, out := &in.KeepDroppedTargets, &out.KeepDroppedTargets + *out = new(uint64) + **out = **in + } + if in.MetricRelabelConfigs != nil { + in, out := &in.MetricRelabelConfigs, &out.MetricRelabelConfigs + *out = make([]monitoringv1.RelabelConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.ScrapeClassName != nil { + in, out := &in.ScrapeClassName, &out.ScrapeClassName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScrapeConfigSpec. +func (in *ScrapeConfigSpec) DeepCopy() *ScrapeConfigSpec { + if in == nil { + return nil + } + out := new(ScrapeConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackAction) DeepCopyInto(out *SlackAction) { + *out = *in + if in.ConfirmField != nil { + in, out := &in.ConfirmField, &out.ConfirmField + *out = new(SlackConfirmationField) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackAction. +func (in *SlackAction) DeepCopy() *SlackAction { + if in == nil { + return nil + } + out := new(SlackAction) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIURL != nil { + in, out := &in.APIURL, &out.APIURL + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.Fields != nil { + in, out := &in.Fields, &out.Fields + *out = make([]SlackField, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MrkdwnIn != nil { + in, out := &in.MrkdwnIn, &out.MrkdwnIn + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = make([]SlackAction, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*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 *SlackConfirmationField) DeepCopyInto(out *SlackConfirmationField) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfirmationField. +func (in *SlackConfirmationField) DeepCopy() *SlackConfirmationField { + if in == nil { + return nil + } + out := new(SlackConfirmationField) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackField) DeepCopyInto(out *SlackField) { + *out = *in + if in.Short != nil { + in, out := &in.Short, &out.Short + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackField. +func (in *SlackField) DeepCopy() *SlackField { + if in == nil { + return nil + } + out := new(SlackField) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StaticConfig) DeepCopyInto(out *StaticConfig) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]Target, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[monitoringv1.LabelName]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StaticConfig. +func (in *StaticConfig) DeepCopy() *StaticConfig { + if in == nil { + return nil + } + out := new(StaticConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TelegramConfig) DeepCopyInto(out *TelegramConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.BotToken != nil { + in, out := &in.BotToken, &out.BotToken + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.BotTokenFile != nil { + in, out := &in.BotTokenFile, &out.BotTokenFile + *out = new(string) + **out = **in + } + if in.DisableNotifications != nil { + in, out := &in.DisableNotifications, &out.DisableNotifications + *out = new(bool) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TelegramConfig. +func (in *TelegramConfig) DeepCopy() *TelegramConfig { + if in == nil { + return nil + } + out := new(TelegramConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimeInterval) DeepCopyInto(out *TimeInterval) { + *out = *in + if in.Times != nil { + in, out := &in.Times, &out.Times + *out = make([]TimeRange, len(*in)) + copy(*out, *in) + } + if in.Weekdays != nil { + in, out := &in.Weekdays, &out.Weekdays + *out = make([]WeekdayRange, len(*in)) + copy(*out, *in) + } + if in.DaysOfMonth != nil { + in, out := &in.DaysOfMonth, &out.DaysOfMonth + *out = make([]DayOfMonthRange, len(*in)) + copy(*out, *in) + } + if in.Months != nil { + in, out := &in.Months, &out.Months + *out = make([]MonthRange, len(*in)) + copy(*out, *in) + } + if in.Years != nil { + in, out := &in.Years, &out.Years + *out = make([]YearRange, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeInterval. +func (in *TimeInterval) DeepCopy() *TimeInterval { + if in == nil { + return nil + } + out := new(TimeInterval) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimeRange) DeepCopyInto(out *TimeRange) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeRange. +func (in *TimeRange) DeepCopy() *TimeRange { + if in == nil { + return nil + } + out := new(TimeRange) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VictorOpsConfig) DeepCopyInto(out *VictorOpsConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIKey != nil { + in, out := &in.APIKey, &out.APIKey + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.CustomFields != nil { + in, out := &in.CustomFields, &out.CustomFields + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VictorOpsConfig. +func (in *VictorOpsConfig) DeepCopy() *VictorOpsConfig { + if in == nil { + return nil + } + out := new(VictorOpsConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APISecret != nil { + in, out := &in.APISecret, &out.APISecret + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*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 *WebexConfig) DeepCopyInto(out *WebexConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIURL != nil { + in, out := &in.APIURL, &out.APIURL + *out = new(URL) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebexConfig. +func (in *WebexConfig) DeepCopy() *WebexConfig { + if in == nil { + return nil + } + out := new(WebexConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.URL != nil { + in, out := &in.URL, &out.URL + *out = new(string) + **out = **in + } + if in.URLSecret != nil { + in, out := &in.URLSecret, &out.URLSecret + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// 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 +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/alertmanager_config_types.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/alertmanager_config_types.go new file mode 100644 index 000000000..7fd26eac4 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/alertmanager_config_types.go @@ -0,0 +1,1216 @@ +// Copyright 2020 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1beta1 + +import ( + "encoding/json" + "errors" + "fmt" + "html/template" + "regexp" + "strings" + + monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + + v1 "k8s.io/api/core/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +const ( + Version = "v1beta1" + + AlertmanagerConfigKind = "AlertmanagerConfig" + AlertmanagerConfigName = "alertmanagerconfigs" + AlertmanagerConfigKindKey = "alertmanagerconfig" +) + +// +genclient +// +k8s:openapi-gen=true +// +kubebuilder:resource:categories="prometheus-operator",shortName="amcfg" + +// AlertmanagerConfig configures the Prometheus Alertmanager, +// specifying how alerts should be grouped, inhibited and notified to external systems. +type AlertmanagerConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AlertmanagerConfigSpec `json:"spec"` +} + +// AlertmanagerConfigList is a list of AlertmanagerConfig. +// +k8s:openapi-gen=true +type AlertmanagerConfigList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of AlertmanagerConfig + Items []*AlertmanagerConfig `json:"items"` +} + +// AlertmanagerConfigSpec is a specification of the desired behavior of the Alertmanager configuration. +// By definition, the Alertmanager configuration only applies to alerts for which +// the `namespace` label is equal to the namespace of the AlertmanagerConfig resource. +type AlertmanagerConfigSpec struct { + // The Alertmanager route definition for alerts matching the resource's + // namespace. If present, it will be added to the generated Alertmanager + // configuration as a first-level route. + // +optional + Route *Route `json:"route"` + // List of receivers. + // +optional + Receivers []Receiver `json:"receivers"` + // List of inhibition rules. The rules will only apply to alerts matching + // the resource's namespace. + // +optional + InhibitRules []InhibitRule `json:"inhibitRules,omitempty"` + // List of TimeInterval specifying when the routes should be muted or active. + // +optional + TimeIntervals []TimeInterval `json:"timeIntervals,omitempty"` +} + +// Route defines a node in the routing tree. +type Route struct { + // Name of the receiver for this route. If not empty, it should be listed in + // the `receivers` field. + // +optional + Receiver string `json:"receiver"` + // List of labels to group by. + // Labels must not be repeated (unique list). + // Special label "..." (aggregate by all possible labels), if provided, must be the only element in the list. + // +optional + GroupBy []string `json:"groupBy,omitempty"` + // How long to wait before sending the initial notification. + // Must match the regular expression`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // Example: "30s" + // +optional + GroupWait string `json:"groupWait,omitempty"` + // How long to wait before sending an updated notification. + // Must match the regular expression`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // Example: "5m" + // +optional + GroupInterval string `json:"groupInterval,omitempty"` + // How long to wait before repeating the last notification. + // Must match the regular expression`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // Example: "4h" + // +optional + RepeatInterval string `json:"repeatInterval,omitempty"` + // List of matchers that the alert's labels should match. For the first + // level route, the operator removes any existing equality and regexp + // matcher on the `namespace` label and adds a `namespace: ` matcher. + // +optional + Matchers []Matcher `json:"matchers,omitempty"` + // Boolean indicating whether an alert should continue matching subsequent + // sibling nodes. It will always be overridden to true for the first-level + // route by the Prometheus operator. + // +optional + Continue bool `json:"continue,omitempty"` + // Child routes. + Routes []apiextensionsv1.JSON `json:"routes,omitempty"` + // Note: this comment applies to the field definition above but appears + // below otherwise it gets included in the generated manifest. + // CRD schema doesn't support self-referential types for now (see + // https://github.com/kubernetes/kubernetes/issues/62872). We have to use + // an alternative type to circumvent the limitation. The downside is that + // the Kube API can't validate the data beyond the fact that it is a valid + // JSON representation. + // MuteTimeIntervals is a list of TimeInterval names that will mute this route when matched. + // +optional + MuteTimeIntervals []string `json:"muteTimeIntervals,omitempty"` + // ActiveTimeIntervals is a list of TimeInterval names when this route should be active. + // +optional + ActiveTimeIntervals []string `json:"activeTimeIntervals,omitempty"` +} + +// ChildRoutes extracts the child routes. +func (r *Route) ChildRoutes() ([]Route, error) { + out := make([]Route, len(r.Routes)) + + for i, v := range r.Routes { + if err := json.Unmarshal(v.Raw, &out[i]); err != nil { + return nil, fmt.Errorf("route[%d]: %w", i, err) + } + } + + return out, nil +} + +// Receiver defines one or more notification integrations. +type Receiver struct { + // Name of the receiver. Must be unique across all items from the list. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + // List of OpsGenie configurations. + OpsGenieConfigs []OpsGenieConfig `json:"opsgenieConfigs,omitempty"` + // List of PagerDuty configurations. + PagerDutyConfigs []PagerDutyConfig `json:"pagerdutyConfigs,omitempty"` + // List of Slack configurations. + DiscordConfigs []DiscordConfig `json:"discordConfigs,omitempty"` + // List of Slack configurations. + SlackConfigs []SlackConfig `json:"slackConfigs,omitempty"` + // List of webhook configurations. + WebhookConfigs []WebhookConfig `json:"webhookConfigs,omitempty"` + // List of WeChat configurations. + WeChatConfigs []WeChatConfig `json:"wechatConfigs,omitempty"` + // List of Email configurations. + EmailConfigs []EmailConfig `json:"emailConfigs,omitempty"` + // List of VictorOps configurations. + VictorOpsConfigs []VictorOpsConfig `json:"victoropsConfigs,omitempty"` + // List of Pushover configurations. + PushoverConfigs []PushoverConfig `json:"pushoverConfigs,omitempty"` + // List of SNS configurations + SNSConfigs []SNSConfig `json:"snsConfigs,omitempty"` + // List of Telegram configurations. + TelegramConfigs []TelegramConfig `json:"telegramConfigs,omitempty"` + // List of Webex configurations. + WebexConfigs []WebexConfig `json:"webexConfigs,omitempty"` + // List of MSTeams configurations. + // It requires Alertmanager >= 0.26.0. + MSTeamsConfigs []MSTeamsConfig `json:"msteamsConfigs,omitempty"` +} + +// PagerDutyConfig configures notifications via PagerDuty. +// See https://prometheus.io/docs/alerting/latest/configuration/#pagerduty_config +type PagerDutyConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the PagerDuty integration key (when using + // Events API v2). Either this field or `serviceKey` needs to be defined. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + RoutingKey *SecretKeySelector `json:"routingKey,omitempty"` + // The secret's key that contains the PagerDuty service key (when using + // integration type "Prometheus"). Either this field or `routingKey` needs to + // be defined. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + ServiceKey *SecretKeySelector `json:"serviceKey,omitempty"` + // The URL to send requests to. + // +optional + URL string `json:"url,omitempty"` + // Client identification. + // +optional + Client string `json:"client,omitempty"` + // Backlink to the sender of notification. + // +optional + ClientURL string `json:"clientURL,omitempty"` + // Description of the incident. + // +optional + Description string `json:"description,omitempty"` + // Severity of the incident. + // +optional + Severity string `json:"severity,omitempty"` + // The class/type of the event. + // +optional + Class string `json:"class,omitempty"` + // A cluster or grouping of sources. + // +optional + Group string `json:"group,omitempty"` + // The part or component of the affected system that is broken. + // +optional + Component string `json:"component,omitempty"` + // Arbitrary key/value pairs that provide further detail about the incident. + // +optional + Details []KeyValue `json:"details,omitempty"` + // A list of image details to attach that provide further detail about an incident. + // +optional + PagerDutyImageConfigs []PagerDutyImageConfig `json:"pagerDutyImageConfigs,omitempty"` + // A list of link details to attach that provide further detail about an incident. + // +optional + PagerDutyLinkConfigs []PagerDutyLinkConfig `json:"pagerDutyLinkConfigs,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + // Unique location of the affected system. + // +optional + Source *string `yaml:"source,omitempty" json:"source,omitempty"` +} + +// PagerDutyImageConfig attaches images to an incident +type PagerDutyImageConfig struct { + // Src of the image being attached to the incident + // +optional + Src string `json:"src,omitempty"` + // Optional URL; makes the image a clickable link. + // +optional + Href string `json:"href,omitempty"` + // Alt is the optional alternative text for the image. + // +optional + Alt string `json:"alt,omitempty"` +} + +// PagerDutyLinkConfig attaches text links to an incident +type PagerDutyLinkConfig struct { + // Href is the URL of the link to be attached + // +optional + Href string `json:"href,omitempty"` + // Text that describes the purpose of the link, and can be used as the link's text. + // +optional + Text string `json:"alt,omitempty"` +} + +// DiscordConfig configures notifications via Discord. +// See https://prometheus.io/docs/alerting/latest/configuration/#discord_config +type DiscordConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + + // The secret's key that contains the Discord webhook URL. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +required + APIURL v1.SecretKeySelector `json:"apiURL,omitempty"` + + // The template of the message's title. + // +optional + Title *string `json:"title,omitempty"` + + // The template of the message's body. + // +optional + Message *string `json:"message,omitempty"` + + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// SlackConfig configures notifications via Slack. +// See https://prometheus.io/docs/alerting/latest/configuration/#slack_config +type SlackConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the Slack webhook URL. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APIURL *SecretKeySelector `json:"apiURL,omitempty"` + // The channel or user to send notifications to. + // +optional + Channel string `json:"channel,omitempty"` + // +optional + Username string `json:"username,omitempty"` + // +optional + Color string `json:"color,omitempty"` + // +optional + Title string `json:"title,omitempty"` + // +optional + TitleLink string `json:"titleLink,omitempty"` + // +optional + Pretext string `json:"pretext,omitempty"` + // +optional + Text string `json:"text,omitempty"` + // A list of Slack fields that are sent with each notification. + // +optional + Fields []SlackField `json:"fields,omitempty"` + // +optional + ShortFields bool `json:"shortFields,omitempty"` + // +optional + Footer string `json:"footer,omitempty"` + // +optional + Fallback string `json:"fallback,omitempty"` + // +optional + CallbackID string `json:"callbackId,omitempty"` + // +optional + IconEmoji string `json:"iconEmoji,omitempty"` + // +optional + IconURL string `json:"iconURL,omitempty"` + // +optional + ImageURL string `json:"imageURL,omitempty"` + // +optional + ThumbURL string `json:"thumbURL,omitempty"` + // +optional + LinkNames bool `json:"linkNames,omitempty"` + // +optional + MrkdwnIn []string `json:"mrkdwnIn,omitempty"` + // A list of Slack actions that are sent with each notification. + // +optional + Actions []SlackAction `json:"actions,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// Validate ensures SlackConfig is valid. +func (sc *SlackConfig) Validate() error { + for _, action := range sc.Actions { + if err := action.Validate(); err != nil { + return err + } + } + + for _, field := range sc.Fields { + if err := field.Validate(); err != nil { + return err + } + } + + return nil +} + +// SlackAction configures a single Slack action that is sent with each +// notification. +// See https://api.slack.com/docs/message-attachments#action_fields and +// https://api.slack.com/docs/message-buttons for more information. +type SlackAction struct { + // +kubebuilder:validation:MinLength=1 + Type string `json:"type"` + // +kubebuilder:validation:MinLength=1 + Text string `json:"text"` + // +optional + URL string `json:"url,omitempty"` + // +optional + Style string `json:"style,omitempty"` + // +optional + Name string `json:"name,omitempty"` + // +optional + Value string `json:"value,omitempty"` + // +optional + ConfirmField *SlackConfirmationField `json:"confirm,omitempty"` +} + +// Validate ensures SlackAction is valid. +func (sa *SlackAction) Validate() error { + if sa.Type == "" { + return errors.New("missing type in Slack action configuration") + } + + if sa.Text == "" { + return errors.New("missing text in Slack action configuration") + } + + if sa.URL == "" && sa.Name == "" { + return errors.New("missing name or url in Slack action configuration") + } + + if sa.ConfirmField != nil { + if err := sa.ConfirmField.Validate(); err != nil { + return err + } + } + + return nil +} + +// SlackConfirmationField protect users from destructive actions or +// particularly distinguished decisions by asking them to confirm their button +// click one more time. +// See https://api.slack.com/docs/interactive-message-field-guide#confirmation_fields +// for more information. +type SlackConfirmationField struct { + // +kubebuilder:validation:MinLength=1 + Text string `json:"text"` + // +optional + Title string `json:"title,omitempty"` + // +optional + OkText string `json:"okText,omitempty"` + // +optional + DismissText string `json:"dismissText,omitempty"` +} + +// Validate ensures SlackConfirmationField is valid. +func (scf *SlackConfirmationField) Validate() error { + if scf.Text == "" { + return errors.New("missing text in Slack confirmation configuration") + } + return nil +} + +// SlackField configures a single Slack field that is sent with each notification. +// Each field must contain a title, value, and optionally, a boolean value to indicate if the field +// is short enough to be displayed next to other fields designated as short. +// See https://api.slack.com/docs/message-attachments#fields for more information. +type SlackField struct { + // +kubebuilder:validation:MinLength=1 + Title string `json:"title"` + // +kubebuilder:validation:MinLength=1 + Value string `json:"value"` + // +optional + Short *bool `json:"short,omitempty"` +} + +// Validate ensures SlackField is valid +func (sf *SlackField) Validate() error { + if sf.Title == "" { + return errors.New("missing title in Slack field configuration") + } + + if sf.Value == "" { + return errors.New("missing value in Slack field configuration") + } + + return nil +} + +// WebhookConfig configures notifications via a generic receiver supporting the webhook payload. +// See https://prometheus.io/docs/alerting/latest/configuration/#webhook_config +type WebhookConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The URL to send HTTP POST requests to. `urlSecret` takes precedence over + // `url`. One of `urlSecret` and `url` should be defined. + // +optional + URL *string `json:"url,omitempty"` + // The secret's key that contains the webhook URL to send HTTP requests to. + // `urlSecret` takes precedence over `url`. One of `urlSecret` and `url` + // should be defined. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + URLSecret *SecretKeySelector `json:"urlSecret,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + // Maximum number of alerts to be sent per webhook message. When 0, all alerts are included. + // +optional + // +kubebuilder:validation:Minimum=0 + MaxAlerts int32 `json:"maxAlerts,omitempty"` +} + +// OpsGenieConfig configures notifications via OpsGenie. +// See https://prometheus.io/docs/alerting/latest/configuration/#opsgenie_config +type OpsGenieConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the OpsGenie API key. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APIKey *SecretKeySelector `json:"apiKey,omitempty"` + // The URL to send OpsGenie API requests to. + // +optional + APIURL string `json:"apiURL,omitempty"` + // Alert text limited to 130 characters. + // +optional + Message string `json:"message,omitempty"` + // Description of the incident. + // +optional + Description string `json:"description,omitempty"` + // Backlink to the sender of the notification. + // +optional + Source string `json:"source,omitempty"` + // Comma separated list of tags attached to the notifications. + // +optional + Tags string `json:"tags,omitempty"` + // Additional alert note. + // +optional + Note string `json:"note,omitempty"` + // Priority level of alert. Possible values are P1, P2, P3, P4, and P5. + // +optional + Priority string `json:"priority,omitempty"` + // A set of arbitrary key/value pairs that provide further detail about the incident. + // +optional + Details []KeyValue `json:"details,omitempty"` + // List of responders responsible for notifications. + // +optional + Responders []OpsGenieConfigResponder `json:"responders,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + // Optional field that can be used to specify which domain alert is related to. + // +optional + Entity string `json:"entity,omitempty"` + // Comma separated list of actions that will be available for the alert. + // +optional + Actions string `json:"actions,omitempty"` +} + +// Validate ensures OpsGenieConfig is valid +func (o *OpsGenieConfig) Validate() error { + for _, responder := range o.Responders { + if err := responder.Validate(); err != nil { + return err + } + } + return nil +} + +// OpsGenieConfigResponder defines a responder to an incident. +// One of `id`, `name` or `username` has to be defined. +type OpsGenieConfigResponder struct { + // ID of the responder. + // +optional + ID string `json:"id,omitempty"` + // Name of the responder. + // +optional + Name string `json:"name,omitempty"` + // Username of the responder. + // +optional + Username string `json:"username,omitempty"` + // Type of responder. + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:Enum=team;teams;user;escalation;schedule + Type string `json:"type"` +} + +const opsgenieValidTypesRe = `^(team|teams|user|escalation|schedule)$` + +var opsgenieTypeMatcher = regexp.MustCompile(opsgenieValidTypesRe) + +// Validate ensures OpsGenieConfigResponder is valid. +func (r *OpsGenieConfigResponder) Validate() error { + if r.ID == "" && r.Name == "" && r.Username == "" { + return errors.New("responder must have at least an ID, a Name or an Username defined") + } + + if strings.Contains(r.Type, "{{") { + _, err := template.New("").Parse(r.Type) + if err != nil { + return fmt.Errorf("responder %v type is not a valid template: %w", r, err) + } + return nil + } + + if opsgenieTypeMatcher.MatchString(strings.ToLower(r.Type)) { + return nil + } + return fmt.Errorf("opsGenieConfig responder %v type does not match valid options %s", r, opsgenieValidTypesRe) +} + +// HTTPConfig defines a client HTTP configuration. +// See https://prometheus.io/docs/alerting/latest/configuration/#http_config +type HTTPConfig struct { + // Authorization header configuration for the client. + // This is mutually exclusive with BasicAuth and is only available starting from Alertmanager v0.22+. + // +optional + Authorization *monitoringv1.SafeAuthorization `json:"authorization,omitempty"` + // BasicAuth for the client. + // This is mutually exclusive with Authorization. If both are defined, BasicAuth takes precedence. + // +optional + BasicAuth *monitoringv1.BasicAuth `json:"basicAuth,omitempty"` + // OAuth2 client credentials used to fetch a token for the targets. + // +optional + OAuth2 *monitoringv1.OAuth2 `json:"oauth2,omitempty"` + // The secret's key that contains the bearer token to be used by the client + // for authentication. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + BearerTokenSecret *SecretKeySelector `json:"bearerTokenSecret,omitempty"` + // TLS configuration for the client. + // +optional + TLSConfig *monitoringv1.SafeTLSConfig `json:"tlsConfig,omitempty"` + // Optional proxy URL. + // +optional + ProxyURL string `json:"proxyURL,omitempty"` + // FollowRedirects specifies whether the client should follow HTTP 3xx redirects. + // +optional + FollowRedirects *bool `json:"followRedirects,omitempty"` +} + +// WebexConfig configures notification via Cisco Webex +// See https://prometheus.io/docs/alerting/latest/configuration/#webex_config +type WebexConfig struct { + // Whether to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + + // The Webex Teams API URL i.e. https://webexapis.com/v1/messages + // +optional + APIURL *URL `json:"apiURL,omitempty"` + + // The HTTP client's configuration. + // You must use this configuration to supply the bot token as part of the HTTP `Authorization` header. + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` + + // Message template + // +optional + Message *string `json:"message,omitempty"` + + // ID of the Webex Teams room where to send the messages. + // +kubebuilder:validation:MinLength=1 + // +required + RoomID string `json:"roomID"` +} + +// WeChatConfig configures notifications via WeChat. +// See https://prometheus.io/docs/alerting/latest/configuration/#wechat_config +type WeChatConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the WeChat API key. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APISecret *SecretKeySelector `json:"apiSecret,omitempty"` + // The WeChat API URL. + // +optional + APIURL string `json:"apiURL,omitempty"` + // The corp id for authentication. + // +optional + CorpID string `json:"corpID,omitempty"` + // +optional + AgentID string `json:"agentID,omitempty"` + // +optional + ToUser string `json:"toUser,omitempty"` + // +optional + ToParty string `json:"toParty,omitempty"` + // +optional + ToTag string `json:"toTag,omitempty"` + // API request data as defined by the WeChat API. + Message string `json:"message,omitempty"` + // +optional + MessageType string `json:"messageType,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// EmailConfig configures notifications via Email. +type EmailConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The email address to send notifications to. + // +optional + To string `json:"to,omitempty"` + // The sender address. + // +optional + From string `json:"from,omitempty"` + // The hostname to identify to the SMTP server. + // +optional + Hello string `json:"hello,omitempty"` + // The SMTP host and port through which emails are sent. E.g. example.com:25 + // +optional + Smarthost string `json:"smarthost,omitempty"` + // The username to use for authentication. + // +optional + AuthUsername string `json:"authUsername,omitempty"` + // The secret's key that contains the password to use for authentication. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + AuthPassword *SecretKeySelector `json:"authPassword,omitempty"` + // The secret's key that contains the CRAM-MD5 secret. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + AuthSecret *SecretKeySelector `json:"authSecret,omitempty"` + // The identity to use for authentication. + // +optional + AuthIdentity string `json:"authIdentity,omitempty"` + // Further headers email header key/value pairs. Overrides any headers + // previously set by the notification implementation. + Headers []KeyValue `json:"headers,omitempty"` + // The HTML body of the email notification. + // +optional + HTML *string `json:"html,omitempty"` + // The text body of the email notification. + // +optional + Text *string `json:"text,omitempty"` + // The SMTP TLS requirement. + // Note that Go does not support unencrypted connections to remote SMTP endpoints. + // +optional + RequireTLS *bool `json:"requireTLS,omitempty"` + // TLS configuration + // +optional + TLSConfig *monitoringv1.SafeTLSConfig `json:"tlsConfig,omitempty"` +} + +// VictorOpsConfig configures notifications via VictorOps. +// See https://prometheus.io/docs/alerting/latest/configuration/#victorops_config +type VictorOpsConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the API key to use when talking to the VictorOps API. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // +optional + APIKey *SecretKeySelector `json:"apiKey,omitempty"` + // The VictorOps API URL. + // +optional + APIURL string `json:"apiUrl,omitempty"` + // A key used to map the alert to a team. + // +optional + RoutingKey string `json:"routingKey"` + // Describes the behavior of the alert (CRITICAL, WARNING, INFO). + // +optional + MessageType string `json:"messageType,omitempty"` + // Contains summary of the alerted problem. + // +optional + EntityDisplayName string `json:"entityDisplayName,omitempty"` + // Contains long explanation of the alerted problem. + // +optional + StateMessage string `json:"stateMessage,omitempty"` + // The monitoring tool the state message is from. + // +optional + MonitoringTool string `json:"monitoringTool,omitempty"` + // Additional custom fields for notification. + // +optional + CustomFields []KeyValue `json:"customFields,omitempty"` + // The HTTP client's configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// PushoverConfig configures notifications via Pushover. +// See https://prometheus.io/docs/alerting/latest/configuration/#pushover_config +type PushoverConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The secret's key that contains the recipient user's user key. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // Either `userKey` or `userKeyFile` is required. + // +optional + UserKey *SecretKeySelector `json:"userKey,omitempty"` + // The user key file that contains the recipient user's user key. + // Either `userKey` or `userKeyFile` is required. + // It requires Alertmanager >= v0.26.0. + // +optional + UserKeyFile *string `json:"userKeyFile,omitempty"` + // The secret's key that contains the registered application's API token, see https://pushover.net/apps. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // Either `token` or `tokenFile` is required. + // +optional + Token *SecretKeySelector `json:"token,omitempty"` + // The token file that contains the registered application's API token, see https://pushover.net/apps. + // Either `token` or `tokenFile` is required. + // It requires Alertmanager >= v0.26.0. + // +optional + TokenFile *string `json:"tokenFile,omitempty"` + // Notification title. + // +optional + Title string `json:"title,omitempty"` + // Notification message. + // +optional + Message string `json:"message,omitempty"` + // A supplementary URL shown alongside the message. + // +optional + URL string `json:"url,omitempty"` + // A title for supplementary URL, otherwise just the URL is shown + // +optional + URLTitle string `json:"urlTitle,omitempty"` + // The time to live definition for the alert notification + // +optional + TTL *monitoringv1.Duration `json:"ttl,omitempty"` + // The name of a device to send the notification to + // +optional + Device *string `json:"device,omitempty"` + // The name of one of the sounds supported by device clients to override the user's default sound choice + // +optional + Sound string `json:"sound,omitempty"` + // Priority, see https://pushover.net/api#priority + // +optional + Priority string `json:"priority,omitempty"` + // How often the Pushover servers will send the same notification to the user. + // Must be at least 30 seconds. + // +kubebuilder:validation:Pattern=`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // +optional + Retry string `json:"retry,omitempty"` + // How long your notification will continue to be retried for, unless the user + // acknowledges the notification. + // +kubebuilder:validation:Pattern=`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$` + // +optional + Expire string `json:"expire,omitempty"` + // Whether notification message is HTML or plain text. + // +optional + HTML bool `json:"html,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// SNSConfig configures notifications via AWS SNS. +// See https://prometheus.io/docs/alerting/latest/configuration/#sns_configs +type SNSConfig struct { + // Whether or not to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The SNS API URL i.e. https://sns.us-east-2.amazonaws.com. + // If not specified, the SNS API URL from the SNS SDK will be used. + // +optional + ApiURL string `json:"apiURL,omitempty"` + // Configures AWS's Signature Verification 4 signing process to sign requests. + // +optional + Sigv4 *monitoringv1.Sigv4 `json:"sigv4,omitempty"` + // SNS topic ARN, i.e. arn:aws:sns:us-east-2:698519295917:My-Topic + // If you don't specify this value, you must specify a value for the PhoneNumber or TargetARN. + // +optional + TopicARN string `json:"topicARN,omitempty"` + // Subject line when the message is delivered to email endpoints. + // +optional + Subject string `json:"subject,omitempty"` + // Phone number if message is delivered via SMS in E.164 format. + // If you don't specify this value, you must specify a value for the TopicARN or TargetARN. + // +optional + PhoneNumber string `json:"phoneNumber,omitempty"` + // The mobile platform endpoint ARN if message is delivered via mobile notifications. + // If you don't specify this value, you must specify a value for the topic_arn or PhoneNumber. + // +optional + TargetARN string `json:"targetARN,omitempty"` + // The message content of the SNS notification. + // +optional + Message string `json:"message,omitempty"` + // SNS message attributes. + // +optional + Attributes map[string]string `json:"attributes,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// TelegramConfig configures notifications via Telegram. +// See https://prometheus.io/docs/alerting/latest/configuration/#telegram_config +type TelegramConfig struct { + // Whether to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // The Telegram API URL i.e. https://api.telegram.org. + // If not specified, default API URL will be used. + // +optional + APIURL string `json:"apiURL,omitempty"` + // Telegram bot token. It is mutually exclusive with `botTokenFile`. + // The secret needs to be in the same namespace as the AlertmanagerConfig + // object and accessible by the Prometheus Operator. + // + // Either `botToken` or `botTokenFile` is required. + // + //+optional + BotToken *SecretKeySelector `json:"botToken,omitempty"` + // File to read the Telegram bot token from. It is mutually exclusive with `botToken`. + // Either `botToken` or `botTokenFile` is required. + // + // It requires Alertmanager >= v0.26.0. + // + // +optional + BotTokenFile *string `json:"botTokenFile,omitempty"` + // The Telegram chat ID. + // +required + ChatID int64 `json:"chatID,omitempty"` + // Message template + // +optional + Message string `json:"message,omitempty"` + // Disable telegram notifications + // +optional + DisableNotifications *bool `json:"disableNotifications,omitempty"` + // Parse mode for telegram message + //+kubebuilder:validation:Enum=MarkdownV2;Markdown;HTML + // +optional + ParseMode string `json:"parseMode,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// MSTeamsConfig configures notifications via Microsoft Teams. +// It requires Alertmanager >= 0.26.0. +type MSTeamsConfig struct { + // Whether to notify about resolved alerts. + // +optional + SendResolved *bool `json:"sendResolved,omitempty"` + // MSTeams webhook URL. + // +kubebuilder:validation:Required + WebhookURL v1.SecretKeySelector `json:"webhookUrl"` + // Message title template. + // +optional + Title *string `json:"title,omitempty"` + // Message summary template. + // It requires Alertmanager >= 0.27.0. + // +optional + Summary *string `json:"summary,omitempty"` + // Message body template. + // +optional + Text *string `json:"text,omitempty"` + // HTTP client configuration. + // +optional + HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` +} + +// InhibitRule defines an inhibition rule that allows to mute alerts when other +// alerts are already firing. +// See https://prometheus.io/docs/alerting/latest/configuration/#inhibit_rule +type InhibitRule struct { + // Matchers that have to be fulfilled in the alerts to be muted. The + // operator enforces that the alert matches the resource's namespace. + TargetMatch []Matcher `json:"targetMatch,omitempty"` + // Matchers for which one or more alerts have to exist for the inhibition + // to take effect. The operator enforces that the alert matches the + // resource's namespace. + SourceMatch []Matcher `json:"sourceMatch,omitempty"` + // Labels that must have an equal value in the source and target alert for + // the inhibition to take effect. + Equal []string `json:"equal,omitempty"` +} + +// KeyValue defines a (key, value) tuple. +type KeyValue struct { + // Key of the tuple. + // +kubebuilder:validation:MinLength=1 + Key string `json:"key"` + // Value of the tuple. + Value string `json:"value"` +} + +// Matcher defines how to match on alert's labels. +type Matcher struct { + // Label to match. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + // Label value to match. + // +optional + Value string `json:"value"` + // Match operator, one of `=` (equal to), `!=` (not equal to), `=~` (regex + // match) or `!~` (not regex match). + // Negative operators (`!=` and `!~`) require Alertmanager >= v0.22.0. + // +kubebuilder:validation:Enum=!=;=;=~;!~ + MatchType MatchType `json:"matchType,omitempty"` +} + +// String returns Matcher as a string +// Use only for MatchType Matcher +func (in Matcher) String() string { + return fmt.Sprintf(`%s%s"%s"`, in.Name, in.MatchType, openMetricsEscape(in.Value)) +} + +// Validate the Matcher returns an error if the matcher is invalid +// Validates only non-deprecated matching fields +func (in Matcher) Validate() error { + // nothing to do + if in.MatchType == "" { + return nil + } + + if !in.MatchType.Valid() { + return fmt.Errorf("invalid 'matchType' '%s' provided'", in.MatchType) + } + + if strings.TrimSpace(in.Name) == "" { + return errors.New("matcher 'name' is required") + } + + return nil +} + +// MatchType is a comparison operator on a Matcher +type MatchType string + +// Valid MatchType returns true if the operator is acceptable +func (mt MatchType) Valid() bool { + _, ok := validMatchTypes[mt] + return ok +} + +// SecretKeySelector selects a key of a Secret. +type SecretKeySelector struct { + // The name of the secret in the object's namespace to select from. + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:Required + Name string `json:"name"` + // The key of the secret to select from. Must be a valid secret key. + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:Required + Key string `json:"key"` +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *AlertmanagerConfig) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *AlertmanagerConfigList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +const ( + MatchEqual MatchType = "=" + MatchNotEqual MatchType = "!=" + MatchRegexp MatchType = "=~" + MatchNotRegexp MatchType = "!~" +) + +var validMatchTypes = map[MatchType]bool{ + MatchEqual: true, + MatchNotEqual: true, + MatchRegexp: true, + MatchNotRegexp: true, +} + +// openMetricsEscape is similar to the usual string escaping, but more +// restricted. It merely replaces a new-line character with '\n', a double-quote +// character with '\"', and a backslash with '\\', which is the escaping used by +// OpenMetrics. +// * Copied from alertmanager codebase pkg/labels * +func openMetricsEscape(s string) string { + r := strings.NewReplacer( + `\`, `\\`, + "\n", `\n`, + `"`, `\"`, + ) + return r.Replace(s) +} + +// TimeInterval specifies the periods in time when notifications will be muted or active. +type TimeInterval struct { + // Name of the time interval. + // +kubebuilder:validation:Required + Name string `json:"name,omitempty"` + // TimeIntervals is a list of TimePeriod. + TimeIntervals []TimePeriod `json:"timeIntervals,omitempty"` +} + +// TimePeriod describes periods of time. +type TimePeriod struct { + // Times is a list of TimeRange + // +optional + Times []TimeRange `json:"times,omitempty"` + // Weekdays is a list of WeekdayRange + // +optional + Weekdays []WeekdayRange `json:"weekdays,omitempty"` + // DaysOfMonth is a list of DayOfMonthRange + // +optional + DaysOfMonth []DayOfMonthRange `json:"daysOfMonth,omitempty"` + // Months is a list of MonthRange + // +optional + Months []MonthRange `json:"months,omitempty"` + // Years is a list of YearRange + // +optional + Years []YearRange `json:"years,omitempty"` +} + +// Time defines a time in 24hr format +// +kubebuilder:validation:Pattern=`^((([01][0-9])|(2[0-3])):[0-5][0-9])$|(^24:00$)` +type Time string + +// TimeRange defines a start and end time in 24hr format +type TimeRange struct { + // StartTime is the start time in 24hr format. + StartTime Time `json:"startTime,omitempty"` + // EndTime is the end time in 24hr format. + EndTime Time `json:"endTime,omitempty"` +} + +// WeekdayRange is an inclusive range of days of the week beginning on Sunday +// Days can be specified by name (e.g 'Sunday') or as an inclusive range (e.g 'Monday:Friday') +// +kubebuilder:validation:Pattern=`^((?i)sun|mon|tues|wednes|thurs|fri|satur)day(?:((:(sun|mon|tues|wednes|thurs|fri|satur)day)$)|$)` +type WeekdayRange string + +// DayOfMonthRange is an inclusive range of days of the month beginning at 1 +type DayOfMonthRange struct { + // Start of the inclusive range + // +kubebuilder:validation:Minimum=-31 + // +kubebuilder:validation:Maximum=31 + Start int `json:"start,omitempty"` + // End of the inclusive range + // +kubebuilder:validation:Minimum=-31 + // +kubebuilder:validation:Maximum=31 + End int `json:"end,omitempty"` +} + +// MonthRange is an inclusive range of months of the year beginning in January +// Months can be specified by name (e.g 'January') by numerical month (e.g '1') or as an inclusive range (e.g 'January:March', '1:3', '1:March') +// +kubebuilder:validation:Pattern=`^((?i)january|february|march|april|may|june|july|august|september|october|november|december|1[0-2]|[1-9])(?:((:((?i)january|february|march|april|may|june|july|august|september|october|november|december|1[0-2]|[1-9]))$)|$)` +type MonthRange string + +// YearRange is an inclusive range of years +// +kubebuilder:validation:Pattern=`^2\d{3}(?::2\d{3}|$)` +type YearRange string + +// Weekday is day of the week +type Weekday string + +const ( + Sunday Weekday = "sunday" + Monday Weekday = "monday" + Tuesday Weekday = "tuesday" + Wednesday Weekday = "wednesday" + Thursday Weekday = "thursday" + Friday Weekday = "friday" + Saturday Weekday = "saturday" +) + +var daysOfWeek = map[Weekday]int{ + Sunday: 0, + Monday: 1, + Tuesday: 2, + Wednesday: 3, + Thursday: 4, + Friday: 5, + Saturday: 6, +} + +var daysOfWeekInv = map[int]Weekday{ + 0: Sunday, + 1: Monday, + 2: Tuesday, + 3: Wednesday, + 4: Thursday, + 5: Friday, + 6: Saturday, +} + +// Month of the year +type Month string + +const ( + January Month = "january" + February Month = "february" + March Month = "march" + April Month = "april" + May Month = "may" + June Month = "june" + July Month = "july" + August Month = "august" + September Month = "september" + October Month = "october" + November Month = "november" + December Month = "december" +) + +var months = map[Month]int{ + January: 1, + February: 2, + March: 3, + April: 4, + May: 5, + June: 6, + July: 7, + August: 8, + September: 9, + October: 10, + November: 11, + December: 12, +} + +var monthsInv = map[int]Month{ + 1: January, + 2: February, + 3: March, + 4: April, + 5: May, + 6: June, + 7: July, + 8: August, + 9: September, + 10: October, + 11: November, + 12: December, +} + +// URL represents a valid URL +// +kubebuilder:validation:Pattern=`^https?://.+$` +type URL string diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/conversion_from.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/conversion_from.go new file mode 100644 index 000000000..3b78bb66b --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/conversion_from.go @@ -0,0 +1,602 @@ +// Copyright 2022 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1beta1 + +import ( + "encoding/json" + "fmt" + + v1 "k8s.io/api/core/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "sigs.k8s.io/controller-runtime/pkg/conversion" + + "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1" +) + +func convertRouteFrom(in *v1alpha1.Route) (*Route, error) { + if in == nil { + return nil, nil + } + + out := &Route{ + Receiver: in.Receiver, + Continue: in.Continue, + GroupBy: in.GroupBy, + GroupWait: in.GroupWait, + GroupInterval: in.GroupInterval, + RepeatInterval: in.RepeatInterval, + Matchers: convertMatchersFrom(in.Matchers), + MuteTimeIntervals: in.MuteTimeIntervals, + ActiveTimeIntervals: in.ActiveTimeIntervals, + } + + // Deserialize child routes to convert them to v1alpha1 and serialize back. + crs, err := in.ChildRoutes() + if err != nil { + return nil, err + } + + out.Routes = make([]apiextensionsv1.JSON, 0, len(in.Routes)) + for i := range crs { + cr, err := convertRouteFrom(&crs[i]) + if err != nil { + return nil, fmt.Errorf("route[%d]: %w", i, err) + } + + b, err := json.Marshal(cr) + if err != nil { + return nil, fmt.Errorf("route[%d]: %w", i, err) + } + + out.Routes = append(out.Routes, apiextensionsv1.JSON{Raw: b}) + } + + return out, nil +} + +func convertMatchersFrom(in []v1alpha1.Matcher) []Matcher { + out := make([]Matcher, 0, len(in)) + + for _, m := range in { + mt := m.MatchType + if mt == "" { + mt = "=" + if m.Regex { + mt = "=~" + } + } + out = append( + out, + Matcher{ + Name: m.Name, + Value: m.Value, + MatchType: MatchType(mt), + }, + ) + } + + return out +} + +func convertTimeIntervalsFrom(in []v1alpha1.TimeInterval) []TimePeriod { + out := make([]TimePeriod, 0, len(in)) + + for _, ti := range in { + var ( + trs = make([]TimeRange, 0, len(ti.Times)) + wds = make([]WeekdayRange, 0, len(ti.Weekdays)) + doms = make([]DayOfMonthRange, 0, len(ti.DaysOfMonth)) + mrs = make([]MonthRange, 0, len(ti.Months)) + yrs = make([]YearRange, 0, len(ti.Years)) + ) + + for _, tr := range ti.Times { + trs = append(trs, TimeRange{StartTime: Time(tr.StartTime), EndTime: Time(tr.EndTime)}) + } + + for _, wd := range ti.Weekdays { + wds = append(wds, WeekdayRange(wd)) + } + + for _, dm := range ti.DaysOfMonth { + doms = append(doms, DayOfMonthRange{Start: dm.Start, End: dm.End}) + } + + for _, mr := range ti.Months { + mrs = append(mrs, MonthRange(mr)) + } + + for _, yr := range ti.Years { + yrs = append(yrs, YearRange(yr)) + } + + out = append( + out, + TimePeriod{ + Times: trs, + Weekdays: wds, + DaysOfMonth: doms, + Months: mrs, + Years: yrs, + }, + ) + } + + return out +} + +func convertHTTPConfigFrom(in *v1alpha1.HTTPConfig) *HTTPConfig { + if in == nil { + return nil + } + + return &HTTPConfig{ + Authorization: in.Authorization, + BasicAuth: in.BasicAuth, + OAuth2: in.OAuth2, + BearerTokenSecret: convertSecretKeySelectorFrom(in.BearerTokenSecret), + TLSConfig: in.TLSConfig, + ProxyURL: in.ProxyURL, + FollowRedirects: in.FollowRedirects, + } +} + +func convertKeyValuesFrom(in []v1alpha1.KeyValue) []KeyValue { + out := make([]KeyValue, len(in)) + + for i := range in { + out[i] = KeyValue{ + Key: in[i].Key, + Value: in[i].Value, + } + } + + return out +} + +func convertSecretKeySelectorFrom(in *v1.SecretKeySelector) *SecretKeySelector { + if in == nil { + return nil + } + + return &SecretKeySelector{ + Name: in.Name, + Key: in.Key, + } +} + +func convertOpsGenieConfigRespondersFrom(in []v1alpha1.OpsGenieConfigResponder) []OpsGenieConfigResponder { + out := make([]OpsGenieConfigResponder, len(in)) + + for i := range in { + out[i] = OpsGenieConfigResponder{ + ID: in[i].ID, + Name: in[i].Name, + Username: in[i].Username, + Type: in[i].Type, + } + } + + return out +} + +func convertOpsGenieConfigFrom(in v1alpha1.OpsGenieConfig) OpsGenieConfig { + return OpsGenieConfig{ + SendResolved: in.SendResolved, + APIKey: convertSecretKeySelectorFrom(in.APIKey), + APIURL: in.APIURL, + Message: in.Message, + Description: in.Description, + Source: in.Source, + Tags: in.Tags, + Note: in.Note, + Priority: in.Priority, + Details: convertKeyValuesFrom(in.Details), + Responders: convertOpsGenieConfigRespondersFrom(in.Responders), + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + Entity: in.Entity, + Actions: in.Actions, + } +} + +func convertPagerDutyImageConfigsFrom(in []v1alpha1.PagerDutyImageConfig) []PagerDutyImageConfig { + out := make([]PagerDutyImageConfig, len(in)) + + for i := range in { + out[i] = PagerDutyImageConfig{ + Src: in[i].Src, + Href: in[i].Href, + Alt: in[i].Alt, + } + } + + return out +} + +func convertPagerDutyLinkConfigsFrom(in []v1alpha1.PagerDutyLinkConfig) []PagerDutyLinkConfig { + out := make([]PagerDutyLinkConfig, len(in)) + + for i := range in { + out[i] = PagerDutyLinkConfig{ + Href: in[i].Href, + Text: in[i].Text, + } + } + + return out +} + +func convertPagerDutyConfigFrom(in v1alpha1.PagerDutyConfig) PagerDutyConfig { + return PagerDutyConfig{ + SendResolved: in.SendResolved, + RoutingKey: convertSecretKeySelectorFrom(in.RoutingKey), + ServiceKey: convertSecretKeySelectorFrom(in.ServiceKey), + URL: in.URL, + Client: in.Client, + ClientURL: in.ClientURL, + Description: in.Description, + Severity: in.Severity, + Class: in.Class, + Group: in.Group, + Component: in.Component, + Details: convertKeyValuesFrom(in.Details), + PagerDutyImageConfigs: convertPagerDutyImageConfigsFrom(in.PagerDutyImageConfigs), + PagerDutyLinkConfigs: convertPagerDutyLinkConfigsFrom(in.PagerDutyLinkConfigs), + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + Source: in.Source, + } +} + +func convertDiscordConfigFrom(in v1alpha1.DiscordConfig) DiscordConfig { + return DiscordConfig{ + APIURL: in.APIURL, + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + Title: in.Title, + Message: in.Message, + SendResolved: in.SendResolved, + } +} + +func convertSlackFieldsFrom(in []v1alpha1.SlackField) []SlackField { + out := make([]SlackField, len(in)) + + for i := range in { + out[i] = SlackField{ + Title: in[i].Title, + Value: in[i].Value, + Short: in[i].Short, + } + } + + return out +} + +func convertSlackActionsFrom(in []v1alpha1.SlackAction) []SlackAction { + out := make([]SlackAction, len(in)) + + for i := range in { + out[i] = SlackAction{ + Type: in[i].Type, + Text: in[i].Text, + URL: in[i].URL, + Style: in[i].Style, + Name: in[i].Name, + Value: in[i].Value, + } + if in[i].ConfirmField != nil { + out[i].ConfirmField = &SlackConfirmationField{ + Text: in[i].ConfirmField.Text, + Title: in[i].ConfirmField.Title, + OkText: in[i].ConfirmField.OkText, + DismissText: in[i].ConfirmField.DismissText, + } + } + } + + return out +} + +func convertSlackConfigFrom(in v1alpha1.SlackConfig) SlackConfig { + return SlackConfig{ + SendResolved: in.SendResolved, + APIURL: convertSecretKeySelectorFrom(in.APIURL), + Channel: in.Channel, + Username: in.Username, + Color: in.Color, + Title: in.Title, + TitleLink: in.TitleLink, + Pretext: in.Pretext, + Text: in.Text, + Fields: convertSlackFieldsFrom(in.Fields), + ShortFields: in.ShortFields, + Footer: in.Footer, + Fallback: in.Fallback, + CallbackID: in.CallbackID, + IconEmoji: in.IconEmoji, + IconURL: in.IconURL, + ImageURL: in.ImageURL, + ThumbURL: in.ThumbURL, + LinkNames: in.LinkNames, + MrkdwnIn: in.MrkdwnIn, + Actions: convertSlackActionsFrom(in.Actions), + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + } +} + +func convertWebexConfigFrom(in v1alpha1.WebexConfig) WebexConfig { + return WebexConfig{ + APIURL: (*URL)(in.APIURL), + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + Message: in.Message, + RoomID: in.RoomID, + SendResolved: in.SendResolved, + } +} + +func convertWebhookConfigFrom(in v1alpha1.WebhookConfig) WebhookConfig { + return WebhookConfig{ + SendResolved: in.SendResolved, + URL: in.URL, + URLSecret: convertSecretKeySelectorFrom(in.URLSecret), + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + MaxAlerts: in.MaxAlerts, + } +} + +func convertWeChatConfigFrom(in v1alpha1.WeChatConfig) WeChatConfig { + return WeChatConfig{ + SendResolved: in.SendResolved, + APISecret: convertSecretKeySelectorFrom(in.APISecret), + APIURL: in.APIURL, + CorpID: in.CorpID, + AgentID: in.AgentID, + ToUser: in.ToUser, + ToParty: in.ToParty, + ToTag: in.ToTag, + Message: in.Message, + MessageType: in.MessageType, + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + } +} + +func convertEmailConfigFrom(in v1alpha1.EmailConfig) EmailConfig { + return EmailConfig{ + SendResolved: in.SendResolved, + To: in.To, + From: in.From, + Hello: in.Hello, + Smarthost: in.Smarthost, + AuthUsername: in.AuthUsername, + AuthPassword: convertSecretKeySelectorFrom(in.AuthPassword), + AuthSecret: convertSecretKeySelectorFrom(in.AuthSecret), + AuthIdentity: in.AuthIdentity, + Headers: convertKeyValuesFrom(in.Headers), + HTML: in.HTML, + Text: in.Text, + RequireTLS: in.RequireTLS, + TLSConfig: in.TLSConfig, + } +} + +func convertVictorOpsConfigFrom(in v1alpha1.VictorOpsConfig) VictorOpsConfig { + return VictorOpsConfig{ + SendResolved: in.SendResolved, + APIKey: convertSecretKeySelectorFrom(in.APIKey), + APIURL: in.APIURL, + RoutingKey: in.RoutingKey, + MessageType: in.MessageType, + EntityDisplayName: in.EntityDisplayName, + StateMessage: in.StateMessage, + MonitoringTool: in.MonitoringTool, + CustomFields: convertKeyValuesFrom(in.CustomFields), + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + } +} + +func convertPushoverConfigFrom(in v1alpha1.PushoverConfig) PushoverConfig { + return PushoverConfig{ + SendResolved: in.SendResolved, + UserKey: convertSecretKeySelectorFrom(in.UserKey), + UserKeyFile: in.UserKeyFile, + Token: convertSecretKeySelectorFrom(in.Token), + TokenFile: in.TokenFile, + Title: in.Title, + Message: in.Message, + URL: in.URL, + URLTitle: in.URLTitle, + Device: in.Device, + Sound: in.Sound, + Priority: in.Priority, + Retry: in.Retry, + Expire: in.Expire, + HTML: in.HTML, + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + } +} + +func convertSNSConfigFrom(in v1alpha1.SNSConfig) SNSConfig { + return SNSConfig{ + SendResolved: in.SendResolved, + ApiURL: in.ApiURL, + Sigv4: in.Sigv4, + TopicARN: in.TopicARN, + Subject: in.Subject, + PhoneNumber: in.PhoneNumber, + TargetARN: in.TargetARN, + Message: in.Message, + Attributes: in.Attributes, + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + } +} + +func convertTelegramConfigFrom(in v1alpha1.TelegramConfig) TelegramConfig { + return TelegramConfig{ + SendResolved: in.SendResolved, + APIURL: in.APIURL, + BotToken: convertSecretKeySelectorFrom(in.BotToken), + BotTokenFile: in.BotTokenFile, + ChatID: in.ChatID, + Message: in.Message, + DisableNotifications: in.DisableNotifications, + ParseMode: in.ParseMode, + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + } +} + +func convertMSTeamsConfigFrom(in v1alpha1.MSTeamsConfig) MSTeamsConfig { + return MSTeamsConfig{ + SendResolved: in.SendResolved, + WebhookURL: in.WebhookURL, + Title: in.Title, + Summary: in.Summary, + Text: in.Text, + HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig), + } +} + +// ConvertFrom converts from the Hub version (v1alpha1) to this version (v1beta1). +func (dst *AlertmanagerConfig) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha1.AlertmanagerConfig) + + dst.ObjectMeta = src.ObjectMeta + + for _, in := range src.Spec.Receivers { + out := Receiver{ + Name: in.Name, + } + + for _, in := range in.OpsGenieConfigs { + out.OpsGenieConfigs = append( + out.OpsGenieConfigs, + convertOpsGenieConfigFrom(in), + ) + } + + for _, in := range in.PagerDutyConfigs { + out.PagerDutyConfigs = append( + out.PagerDutyConfigs, + convertPagerDutyConfigFrom(in), + ) + } + + for _, in := range in.DiscordConfigs { + out.DiscordConfigs = append( + out.DiscordConfigs, + convertDiscordConfigFrom(in), + ) + } + + for _, in := range in.SlackConfigs { + out.SlackConfigs = append( + out.SlackConfigs, + convertSlackConfigFrom(in), + ) + } + + for _, in := range in.WebexConfigs { + out.WebexConfigs = append( + out.WebexConfigs, + convertWebexConfigFrom(in), + ) + } + + for _, in := range in.WebhookConfigs { + out.WebhookConfigs = append( + out.WebhookConfigs, + convertWebhookConfigFrom(in), + ) + } + + for _, in := range in.WeChatConfigs { + out.WeChatConfigs = append( + out.WeChatConfigs, + convertWeChatConfigFrom(in), + ) + } + + for _, in := range in.EmailConfigs { + out.EmailConfigs = append( + out.EmailConfigs, + convertEmailConfigFrom(in), + ) + } + + for _, in := range in.VictorOpsConfigs { + out.VictorOpsConfigs = append( + out.VictorOpsConfigs, + convertVictorOpsConfigFrom(in), + ) + } + + for _, in := range in.PushoverConfigs { + out.PushoverConfigs = append( + out.PushoverConfigs, + convertPushoverConfigFrom(in), + ) + } + + for _, in := range in.SNSConfigs { + out.SNSConfigs = append( + out.SNSConfigs, + convertSNSConfigFrom(in), + ) + } + + for _, in := range in.TelegramConfigs { + out.TelegramConfigs = append( + out.TelegramConfigs, + convertTelegramConfigFrom(in), + ) + } + + for _, in := range in.MSTeamsConfigs { + out.MSTeamsConfigs = append( + out.MSTeamsConfigs, + convertMSTeamsConfigFrom(in), + ) + } + + dst.Spec.Receivers = append(dst.Spec.Receivers, out) + } + + for _, in := range src.Spec.InhibitRules { + dst.Spec.InhibitRules = append( + dst.Spec.InhibitRules, + InhibitRule{ + TargetMatch: convertMatchersFrom(in.TargetMatch), + SourceMatch: convertMatchersFrom(in.SourceMatch), + Equal: in.Equal, + }, + ) + } + + for _, in := range src.Spec.MuteTimeIntervals { + dst.Spec.TimeIntervals = append( + dst.Spec.TimeIntervals, + TimeInterval{ + Name: in.Name, + TimeIntervals: convertTimeIntervalsFrom(in.TimeIntervals), + }, + ) + } + + r, err := convertRouteFrom(src.Spec.Route) + if err != nil { + return err + } + dst.Spec.Route = r + + return nil +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/conversion_to.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/conversion_to.go new file mode 100644 index 000000000..7c8e9088c --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/conversion_to.go @@ -0,0 +1,599 @@ +// Copyright 2022 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1beta1 + +import ( + "encoding/json" + "fmt" + + v1 "k8s.io/api/core/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "sigs.k8s.io/controller-runtime/pkg/conversion" + + "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1" +) + +func convertRouteTo(in *Route) (*v1alpha1.Route, error) { + if in == nil { + return nil, nil + } + + out := &v1alpha1.Route{ + Receiver: in.Receiver, + Continue: in.Continue, + GroupBy: in.GroupBy, + GroupWait: in.GroupWait, + GroupInterval: in.GroupInterval, + RepeatInterval: in.RepeatInterval, + Matchers: convertMatchersTo(in.Matchers), + MuteTimeIntervals: in.MuteTimeIntervals, + ActiveTimeIntervals: in.ActiveTimeIntervals, + } + + // Deserialize child routes to convert them to v1alpha1 and serialize back. + crs, err := in.ChildRoutes() + if err != nil { + return nil, err + } + + out.Routes = make([]apiextensionsv1.JSON, 0, len(in.Routes)) + for i := range crs { + cr, err := convertRouteTo(&crs[i]) + if err != nil { + return nil, fmt.Errorf("route[%d]: %w", i, err) + } + + b, err := json.Marshal(cr) + if err != nil { + return nil, fmt.Errorf("route[%d]: %w", i, err) + } + + out.Routes = append(out.Routes, apiextensionsv1.JSON{Raw: b}) + } + + return out, nil +} + +func convertMatchersTo(in []Matcher) []v1alpha1.Matcher { + out := make([]v1alpha1.Matcher, 0, len(in)) + + for _, m := range in { + out = append( + out, + v1alpha1.Matcher{ + Name: m.Name, + Value: m.Value, + MatchType: v1alpha1.MatchType(m.MatchType), + }, + ) + } + + return out +} + +func convertTimeIntervalsTo(in []TimePeriod) []v1alpha1.TimeInterval { + out := make([]v1alpha1.TimeInterval, 0, len(in)) + + for _, ti := range in { + var ( + trs = make([]v1alpha1.TimeRange, 0, len(ti.Times)) + wds = make([]v1alpha1.WeekdayRange, 0, len(ti.Weekdays)) + doms = make([]v1alpha1.DayOfMonthRange, 0, len(ti.DaysOfMonth)) + mrs = make([]v1alpha1.MonthRange, 0, len(ti.Months)) + yrs = make([]v1alpha1.YearRange, 0, len(ti.Years)) + ) + + for _, tr := range ti.Times { + trs = append(trs, v1alpha1.TimeRange{StartTime: v1alpha1.Time(tr.StartTime), EndTime: v1alpha1.Time(tr.EndTime)}) + } + + for _, wd := range ti.Weekdays { + wds = append(wds, v1alpha1.WeekdayRange(wd)) + } + + for _, dm := range ti.DaysOfMonth { + doms = append(doms, v1alpha1.DayOfMonthRange{Start: dm.Start, End: dm.End}) + } + + for _, mr := range ti.Months { + mrs = append(mrs, v1alpha1.MonthRange(mr)) + } + + for _, yr := range ti.Years { + yrs = append(yrs, v1alpha1.YearRange(yr)) + } + + out = append( + out, + v1alpha1.TimeInterval{ + Times: trs, + Weekdays: wds, + DaysOfMonth: doms, + Months: mrs, + Years: yrs, + }, + ) + } + + return out +} + +func convertHTTPConfigTo(in *HTTPConfig) *v1alpha1.HTTPConfig { + if in == nil { + return nil + } + + return &v1alpha1.HTTPConfig{ + Authorization: in.Authorization, + BasicAuth: in.BasicAuth, + OAuth2: in.OAuth2, + BearerTokenSecret: convertSecretKeySelectorTo(in.BearerTokenSecret), + TLSConfig: in.TLSConfig, + ProxyURL: in.ProxyURL, + FollowRedirects: in.FollowRedirects, + } +} + +func convertKeyValuesTo(in []KeyValue) []v1alpha1.KeyValue { + out := make([]v1alpha1.KeyValue, len(in)) + + for i := range in { + out[i] = v1alpha1.KeyValue{ + Key: in[i].Key, + Value: in[i].Value, + } + } + + return out + +} + +func convertSecretKeySelectorTo(in *SecretKeySelector) *v1.SecretKeySelector { + if in == nil { + return nil + } + + return &v1.SecretKeySelector{ + LocalObjectReference: v1.LocalObjectReference{ + Name: in.Name, + }, + Key: in.Key, + } +} + +func convertOpsGenieConfigRespondersTo(in []OpsGenieConfigResponder) []v1alpha1.OpsGenieConfigResponder { + out := make([]v1alpha1.OpsGenieConfigResponder, len(in)) + + for i := range in { + out[i] = v1alpha1.OpsGenieConfigResponder{ + ID: in[i].ID, + Name: in[i].Name, + Username: in[i].Username, + Type: in[i].Type, + } + } + + return out +} + +func convertOpsGenieConfigTo(in OpsGenieConfig) v1alpha1.OpsGenieConfig { + return v1alpha1.OpsGenieConfig{ + SendResolved: in.SendResolved, + APIKey: convertSecretKeySelectorTo(in.APIKey), + APIURL: in.APIURL, + Message: in.Message, + Description: in.Description, + Source: in.Source, + Tags: in.Tags, + Note: in.Note, + Priority: in.Priority, + Details: convertKeyValuesTo(in.Details), + Responders: convertOpsGenieConfigRespondersTo(in.Responders), + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + Entity: in.Entity, + Actions: in.Actions, + } +} + +func convertPagerDutyImageConfigsTo(in []PagerDutyImageConfig) []v1alpha1.PagerDutyImageConfig { + out := make([]v1alpha1.PagerDutyImageConfig, len(in)) + + for i := range in { + out[i] = v1alpha1.PagerDutyImageConfig{ + Src: in[i].Src, + Href: in[i].Href, + Alt: in[i].Alt, + } + } + + return out +} + +func convertPagerDutyLinkConfigsTo(in []PagerDutyLinkConfig) []v1alpha1.PagerDutyLinkConfig { + out := make([]v1alpha1.PagerDutyLinkConfig, len(in)) + + for i := range in { + out[i] = v1alpha1.PagerDutyLinkConfig{ + Href: in[i].Href, + Text: in[i].Text, + } + } + + return out +} + +func convertPagerDutyConfigTo(in PagerDutyConfig) v1alpha1.PagerDutyConfig { + return v1alpha1.PagerDutyConfig{ + SendResolved: in.SendResolved, + RoutingKey: convertSecretKeySelectorTo(in.RoutingKey), + ServiceKey: convertSecretKeySelectorTo(in.ServiceKey), + URL: in.URL, + Client: in.Client, + ClientURL: in.ClientURL, + Description: in.Description, + Severity: in.Severity, + Class: in.Class, + Group: in.Group, + Component: in.Component, + Details: convertKeyValuesTo(in.Details), + PagerDutyImageConfigs: convertPagerDutyImageConfigsTo(in.PagerDutyImageConfigs), + PagerDutyLinkConfigs: convertPagerDutyLinkConfigsTo(in.PagerDutyLinkConfigs), + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + Source: in.Source, + } +} + +func convertDiscordConfigTo(in DiscordConfig) v1alpha1.DiscordConfig { + return v1alpha1.DiscordConfig{ + APIURL: in.APIURL, + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + Title: in.Title, + Message: in.Message, + SendResolved: in.SendResolved, + } +} + +func convertSlackFieldsTo(in []SlackField) []v1alpha1.SlackField { + out := make([]v1alpha1.SlackField, len(in)) + + for i := range in { + out[i] = v1alpha1.SlackField{ + Title: in[i].Title, + Value: in[i].Value, + Short: in[i].Short, + } + } + + return out +} + +func convertSlackActionsTo(in []SlackAction) []v1alpha1.SlackAction { + out := make([]v1alpha1.SlackAction, len(in)) + + for i := range in { + out[i] = v1alpha1.SlackAction{ + Type: in[i].Type, + Text: in[i].Text, + URL: in[i].URL, + Style: in[i].Style, + Name: in[i].Name, + Value: in[i].Value, + } + if in[i].ConfirmField != nil { + out[i].ConfirmField = &v1alpha1.SlackConfirmationField{ + Text: in[i].ConfirmField.Text, + Title: in[i].ConfirmField.Title, + OkText: in[i].ConfirmField.OkText, + DismissText: in[i].ConfirmField.DismissText, + } + } + } + + return out +} + +func convertSlackConfigTo(in SlackConfig) v1alpha1.SlackConfig { + return v1alpha1.SlackConfig{ + SendResolved: in.SendResolved, + APIURL: convertSecretKeySelectorTo(in.APIURL), + Channel: in.Channel, + Username: in.Username, + Color: in.Color, + Title: in.Title, + TitleLink: in.TitleLink, + Pretext: in.Pretext, + Text: in.Text, + Fields: convertSlackFieldsTo(in.Fields), + ShortFields: in.ShortFields, + Footer: in.Footer, + Fallback: in.Fallback, + CallbackID: in.CallbackID, + IconEmoji: in.IconEmoji, + IconURL: in.IconURL, + ImageURL: in.ImageURL, + ThumbURL: in.ThumbURL, + LinkNames: in.LinkNames, + MrkdwnIn: in.MrkdwnIn, + Actions: convertSlackActionsTo(in.Actions), + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + } +} + +func convertWebexConfigTo(in WebexConfig) v1alpha1.WebexConfig { + return v1alpha1.WebexConfig{ + APIURL: (*v1alpha1.URL)(in.APIURL), + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + Message: in.Message, + RoomID: in.RoomID, + SendResolved: in.SendResolved, + } +} + +func convertWebhookConfigTo(in WebhookConfig) v1alpha1.WebhookConfig { + return v1alpha1.WebhookConfig{ + SendResolved: in.SendResolved, + URL: in.URL, + URLSecret: convertSecretKeySelectorTo(in.URLSecret), + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + MaxAlerts: in.MaxAlerts, + } +} + +func convertWeChatConfigTo(in WeChatConfig) v1alpha1.WeChatConfig { + return v1alpha1.WeChatConfig{ + SendResolved: in.SendResolved, + APISecret: convertSecretKeySelectorTo(in.APISecret), + APIURL: in.APIURL, + CorpID: in.CorpID, + AgentID: in.AgentID, + ToUser: in.ToUser, + ToParty: in.ToParty, + ToTag: in.ToTag, + Message: in.Message, + MessageType: in.MessageType, + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + } +} + +func convertEmailConfigTo(in EmailConfig) v1alpha1.EmailConfig { + return v1alpha1.EmailConfig{ + SendResolved: in.SendResolved, + To: in.To, + From: in.From, + Hello: in.Hello, + Smarthost: in.Smarthost, + AuthUsername: in.AuthUsername, + AuthPassword: convertSecretKeySelectorTo(in.AuthPassword), + AuthSecret: convertSecretKeySelectorTo(in.AuthSecret), + AuthIdentity: in.AuthIdentity, + Headers: convertKeyValuesTo(in.Headers), + HTML: in.HTML, + Text: in.Text, + RequireTLS: in.RequireTLS, + TLSConfig: in.TLSConfig, + } +} + +func convertVictorOpsConfigTo(in VictorOpsConfig) v1alpha1.VictorOpsConfig { + return v1alpha1.VictorOpsConfig{ + SendResolved: in.SendResolved, + APIKey: convertSecretKeySelectorTo(in.APIKey), + APIURL: in.APIURL, + RoutingKey: in.RoutingKey, + MessageType: in.MessageType, + EntityDisplayName: in.EntityDisplayName, + StateMessage: in.StateMessage, + MonitoringTool: in.MonitoringTool, + CustomFields: convertKeyValuesTo(in.CustomFields), + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + } +} + +func convertPushoverConfigTo(in PushoverConfig) v1alpha1.PushoverConfig { + return v1alpha1.PushoverConfig{ + SendResolved: in.SendResolved, + UserKey: convertSecretKeySelectorTo(in.UserKey), + UserKeyFile: in.UserKeyFile, + Token: convertSecretKeySelectorTo(in.Token), + TokenFile: in.TokenFile, + Title: in.Title, + Message: in.Message, + URL: in.URL, + URLTitle: in.URLTitle, + Device: in.Device, + Sound: in.Sound, + Priority: in.Priority, + Retry: in.Retry, + Expire: in.Expire, + HTML: in.HTML, + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + } +} + +func convertSNSConfigTo(in SNSConfig) v1alpha1.SNSConfig { + return v1alpha1.SNSConfig{ + SendResolved: in.SendResolved, + ApiURL: in.ApiURL, + Sigv4: in.Sigv4, + TopicARN: in.TopicARN, + Subject: in.Subject, + PhoneNumber: in.PhoneNumber, + TargetARN: in.TargetARN, + Message: in.Message, + Attributes: in.Attributes, + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + } +} + +func convertTelegramConfigTo(in TelegramConfig) v1alpha1.TelegramConfig { + return v1alpha1.TelegramConfig{ + SendResolved: in.SendResolved, + APIURL: in.APIURL, + BotToken: convertSecretKeySelectorTo(in.BotToken), + BotTokenFile: in.BotTokenFile, + ChatID: in.ChatID, + Message: in.Message, + DisableNotifications: in.DisableNotifications, + ParseMode: in.ParseMode, + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + } +} + +func convertMSTeamsConfigTo(in MSTeamsConfig) v1alpha1.MSTeamsConfig { + return v1alpha1.MSTeamsConfig{ + SendResolved: in.SendResolved, + WebhookURL: in.WebhookURL, + Title: in.Title, + Text: in.Text, + Summary: in.Summary, + HTTPConfig: convertHTTPConfigTo(in.HTTPConfig), + } +} + +// ConvertTo converts from this version (v1beta1) to the Hub version (v1alpha1). +func (src *AlertmanagerConfig) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha1.AlertmanagerConfig) + + dst.ObjectMeta = src.ObjectMeta + + for _, in := range src.Spec.Receivers { + out := v1alpha1.Receiver{ + Name: in.Name, + } + + for _, in := range in.OpsGenieConfigs { + out.OpsGenieConfigs = append( + out.OpsGenieConfigs, + convertOpsGenieConfigTo(in), + ) + } + + for _, in := range in.PagerDutyConfigs { + out.PagerDutyConfigs = append( + out.PagerDutyConfigs, + convertPagerDutyConfigTo(in), + ) + } + + for _, in := range in.DiscordConfigs { + out.DiscordConfigs = append( + out.DiscordConfigs, + convertDiscordConfigTo(in), + ) + } + + for _, in := range in.SlackConfigs { + out.SlackConfigs = append( + out.SlackConfigs, + convertSlackConfigTo(in), + ) + } + + for _, in := range in.WebexConfigs { + out.WebexConfigs = append( + out.WebexConfigs, + convertWebexConfigTo(in), + ) + } + + for _, in := range in.WebhookConfigs { + out.WebhookConfigs = append( + out.WebhookConfigs, + convertWebhookConfigTo(in), + ) + } + + for _, in := range in.WeChatConfigs { + out.WeChatConfigs = append( + out.WeChatConfigs, + convertWeChatConfigTo(in), + ) + } + + for _, in := range in.EmailConfigs { + out.EmailConfigs = append( + out.EmailConfigs, + convertEmailConfigTo(in), + ) + } + + for _, in := range in.VictorOpsConfigs { + out.VictorOpsConfigs = append( + out.VictorOpsConfigs, + convertVictorOpsConfigTo(in), + ) + } + + for _, in := range in.PushoverConfigs { + out.PushoverConfigs = append( + out.PushoverConfigs, + convertPushoverConfigTo(in), + ) + } + + for _, in := range in.SNSConfigs { + out.SNSConfigs = append( + out.SNSConfigs, + convertSNSConfigTo(in), + ) + } + + for _, in := range in.TelegramConfigs { + out.TelegramConfigs = append( + out.TelegramConfigs, + convertTelegramConfigTo(in), + ) + } + + for _, in := range in.MSTeamsConfigs { + out.MSTeamsConfigs = append( + out.MSTeamsConfigs, + convertMSTeamsConfigTo(in), + ) + } + + dst.Spec.Receivers = append(dst.Spec.Receivers, out) + } + + for _, in := range src.Spec.InhibitRules { + dst.Spec.InhibitRules = append( + dst.Spec.InhibitRules, + v1alpha1.InhibitRule{ + TargetMatch: convertMatchersTo(in.TargetMatch), + SourceMatch: convertMatchersTo(in.SourceMatch), + Equal: in.Equal, + }, + ) + + } + + for _, in := range src.Spec.TimeIntervals { + dst.Spec.MuteTimeIntervals = append( + dst.Spec.MuteTimeIntervals, + v1alpha1.MuteTimeInterval{ + Name: in.Name, + TimeIntervals: convertTimeIntervalsTo(in.TimeIntervals), + }, + ) + } + + r, err := convertRouteTo(src.Spec.Route) + if err != nil { + return err + } + dst.Spec.Route = r + + return nil +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/doc.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/doc.go new file mode 100644 index 000000000..5b75b1421 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2020 The prometheus-operator 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:deepcopy-gen=package +// +groupName=monitoring.coreos.com + +package v1beta1 diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/register.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/register.go new file mode 100644 index 000000000..96e40e832 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/register.go @@ -0,0 +1,55 @@ +// Copyright 2020 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring" +) + +// SchemeGroupVersion is the group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: monitoring.GroupName, Version: Version} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &AlertmanagerConfig{}, + &AlertmanagerConfigList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/validation.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/validation.go new file mode 100644 index 000000000..01e0322f2 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/validation.go @@ -0,0 +1,348 @@ +// Copyright 2021 The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1beta1 + +import ( + "errors" + "fmt" + "regexp" + "strconv" + "strings" +) + +func (hc *HTTPConfig) Validate() error { + if hc == nil { + return nil + } + + if (hc.BasicAuth != nil || hc.OAuth2 != nil) && (hc.BearerTokenSecret != nil) { + return fmt.Errorf("at most one of basicAuth, oauth2, bearerTokenSecret must be configured") + } + + if hc.Authorization != nil { + if hc.BearerTokenSecret != nil { + return fmt.Errorf("authorization is not compatible with bearerTokenSecret") + } + + if hc.BasicAuth != nil || hc.OAuth2 != nil { + return fmt.Errorf("at most one of basicAuth, oauth2 & authorization must be configured") + } + + if err := hc.Authorization.Validate(); err != nil { + return err + } + } + + if hc.OAuth2 != nil { + if hc.BasicAuth != nil { + return fmt.Errorf("at most one of basicAuth, oauth2 & authorization must be configured") + } + + if err := hc.OAuth2.Validate(); err != nil { + return err + } + } + + if hc.TLSConfig != nil { + if err := hc.TLSConfig.Validate(); err != nil { + return err + } + } + + return nil +} + +// Validate the TimeInterval +func (ti TimeInterval) Validate() error { + if ti.Name == "" { + return errors.New("empty name field for time interval") + } + + for i, ti := range ti.TimeIntervals { + for _, time := range ti.Times { + if err := time.Validate(); err != nil { + return fmt.Errorf("time range at %d is invalid: %w", i, err) + } + } + for _, weekday := range ti.Weekdays { + if err := weekday.Validate(); err != nil { + return fmt.Errorf("weekday range at %d is invalid: %w", i, err) + } + } + for _, dom := range ti.DaysOfMonth { + if err := dom.Validate(); err != nil { + return fmt.Errorf("day of month range at %d is invalid: %w", i, err) + } + } + for _, month := range ti.Months { + if err := month.Validate(); err != nil { + return fmt.Errorf("month range at %d is invalid: %w", i, err) + } + } + for _, year := range ti.Years { + if err := year.Validate(); err != nil { + return fmt.Errorf("year range at %d is invalid: %w", i, err) + } + } + } + return nil +} + +// Validate the TimeRange +func (tr TimeRange) Validate() error { + _, err := tr.Parse() + return err +} + +// Parse returns a ParsedRange on valid input or an error if the fields cannot be parsed +// End of the day is represented as 1440. +func (tr TimeRange) Parse() (*ParsedRange, error) { + if tr.StartTime == "" || tr.EndTime == "" { + return nil, fmt.Errorf("start and end are required") + } + + start, err := parseTime(string(tr.StartTime)) + if err != nil { + return nil, fmt.Errorf("start time invalid: %w", err) + } + + end, err := parseTime(string(tr.EndTime)) + if err != nil { + return nil, fmt.Errorf("end time invalid: %w", err) + } + + if start >= end { + return nil, fmt.Errorf("start time %d cannot be equal or greater than end time %d", start, end) + } + return &ParsedRange{ + Start: start, + End: end, + }, nil +} + +// Validate the WeekdayRange +func (wr WeekdayRange) Validate() error { + _, err := wr.Parse() + return err +} + +// Parse returns a ParsedRange on valid input or an error if the fields cannot be parsed +// The week starts on Sunday -> 0 +func (wr WeekdayRange) Parse() (*ParsedRange, error) { + startStr, endStr, err := parseRange(string(wr)) + if err != nil { + return nil, err + } + + start, err := Weekday(startStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse start day from weekday range: %w", err) + } + + end, err := Weekday(endStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse end day from weekday range: %w", err) + } + + if start > end { + return nil, errors.New("start day cannot be before end day") + } + if start < 0 || start > 6 { + return nil, fmt.Errorf("%s is not a valid day of the week: out of range", startStr) + } + if end < 0 || end > 6 { + return nil, fmt.Errorf("%s is not a valid day of the week: out of range", endStr) + } + return &ParsedRange{Start: start, End: end}, nil +} + +// Validate the YearRange +func (yr YearRange) Validate() error { + _, err := yr.Parse() + return err +} + +// Parse returns a ParsedRange on valid input or an error if the fields cannot be parsed +func (yr YearRange) Parse() (*ParsedRange, error) { + startStr, endStr, err := parseRange(string(yr)) + if err != nil { + return nil, err + } + + start, err := strconv.Atoi(startStr) + if err != nil { + return nil, fmt.Errorf("start year cannot be %s parsed: %w", startStr, err) + } + + end, err := strconv.Atoi(endStr) + if err != nil { + return nil, fmt.Errorf("end year cannot be %s parsed: %w", endStr, err) + } + + if start > end { + return nil, fmt.Errorf("end year %d is before start year %d", end, start) + } + return &ParsedRange{Start: start, End: end}, nil +} + +// Int returns an integer, which is the canonical representation +// of the Weekday in upstream types. +// Returns an error if the Weekday is invalid +func (w Weekday) Int() (int, error) { + normaliseWeekday := Weekday(strings.ToLower(string(w))) + + day, found := daysOfWeek[normaliseWeekday] + if !found { + i, err := strconv.Atoi(string(normaliseWeekday)) + if err != nil { + return day, fmt.Errorf("%s is an invalid weekday", w) + } + day = i + } + + return day, nil +} + +// Int validates the Month and returns an integer, which is the canonical representation +// of the Month in upstream types. +// Returns an error if the Month is invalid +func (m Month) Int() (int, error) { + normaliseMonth := Month(strings.ToLower(string(m))) + + month, found := months[normaliseMonth] + if !found { + i, err := strconv.Atoi(string(normaliseMonth)) + if err != nil || i < 1 || i > 12 { + return month, fmt.Errorf("%s is an invalid month", m) + } + month = i + } + + return month, nil +} + +// Validate the DayOfMonthRange +func (r DayOfMonthRange) Validate() error { + // Note: Validation is copied from UnmarshalYAML for DayOfMonthRange in alertmanager repo + + // Check beginning <= end accounting for negatives day of month indices as well. + // Months != 31 days can't be addressed here and are clamped, but at least we can catch blatant errors. + if r.Start == 0 || r.Start < -31 || r.Start > 31 { + return fmt.Errorf("%d is not a valid day of the month: out of range", r.Start) + } + if r.End == 0 || r.End < -31 || r.End > 31 { + return fmt.Errorf("%d is not a valid day of the month: out of range", r.End) + } + // Restricting here prevents errors where begin > end in longer months but not shorter months. + if r.Start < 0 && r.End > 0 { + return fmt.Errorf("end day must be negative if start day is negative") + } + // Check begin <= end. We can't know this for sure when using negative indices, + // but we can prevent cases where its always invalid (using 28 day minimum length). + checkBegin := r.Start + checkEnd := r.End + if r.Start < 0 { + checkBegin = 28 + r.Start + } + if r.End < 0 { + checkEnd = 28 + r.End + } + if checkBegin > checkEnd { + return fmt.Errorf("end day %d is always before start day %d", r.End, r.Start) + } + return nil +} + +// Validate the month range +func (mr MonthRange) Validate() error { + _, err := mr.Parse() + return err +} + +// Parse returns a ParsedMonthRange or error on invalid input +func (mr MonthRange) Parse() (*ParsedRange, error) { + startStr, endStr, err := parseRange(string(mr)) + if err != nil { + return nil, err + } + + start, err := Month(startStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse start month from month range: %w", err) + } + + end, err := Month(endStr).Int() + if err != nil { + return nil, fmt.Errorf("failed to parse start month from month range: %w", err) + } + + if start > end { + return nil, fmt.Errorf("end month %s is before start month %s", endStr, startStr) + } + return &ParsedRange{ + Start: start, + End: end, + }, nil +} + +// ParsedRange is an integer representation of a range +// +kubebuilder:object:generate:=false +type ParsedRange struct { + // Start is the beginning of the range + Start int `json:"start,omitempty"` + // End of the range + End int `json:"end,omitempty"` +} + +var validTime = "^((([01][0-9])|(2[0-3])):[0-5][0-9])$|(^24:00$)" +var validTimeRE = regexp.MustCompile(validTime) + +// Converts a string of the form "HH:MM" into the number of minutes elapsed in the day. +func parseTime(in string) (mins int, err error) { + if !validTimeRE.MatchString(in) { + return 0, fmt.Errorf("couldn't parse timestamp %s, invalid format", in) + } + timestampComponents := strings.Split(in, ":") + if len(timestampComponents) != 2 { + return 0, fmt.Errorf("invalid timestamp format: %s", in) + } + timeStampHours, err := strconv.Atoi(timestampComponents[0]) + if err != nil { + return 0, err + } + timeStampMinutes, err := strconv.Atoi(timestampComponents[1]) + if err != nil { + return 0, err + } + if timeStampHours < 0 || timeStampHours > 24 || timeStampMinutes < 0 || timeStampMinutes > 60 { + return 0, fmt.Errorf("timestamp %s out of range", in) + } + // Timestamps are stored as minutes elapsed in the day, so multiply hours by 60. + mins = timeStampHours*60 + timeStampMinutes + return mins, nil +} + +// parseRange parses a valid range string into parts +func parseRange(in string) (start, end string, err error) { + if !strings.ContainsRune(in, ':') { + return in, in, nil + } + + parts := strings.Split(string(in), ":") + if len(parts) != 2 { + return start, end, fmt.Errorf("invalid range provided %s", in) + } + return parts[0], parts[1], nil +} diff --git a/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 000000000..7ed5e2bd8 --- /dev/null +++ b/vendor/github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,1114 @@ +//go:build !ignore_autogenerated + +// Copyright The prometheus-operator Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1beta1 + +import ( + monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerConfig) DeepCopyInto(out *AlertmanagerConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfig. +func (in *AlertmanagerConfig) DeepCopy() *AlertmanagerConfig { + if in == nil { + return nil + } + out := new(AlertmanagerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerConfigList) DeepCopyInto(out *AlertmanagerConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*AlertmanagerConfig, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(AlertmanagerConfig) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfigList. +func (in *AlertmanagerConfigList) DeepCopy() *AlertmanagerConfigList { + if in == nil { + return nil + } + out := new(AlertmanagerConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerConfigSpec) DeepCopyInto(out *AlertmanagerConfigSpec) { + *out = *in + if in.Route != nil { + in, out := &in.Route, &out.Route + *out = new(Route) + (*in).DeepCopyInto(*out) + } + if in.Receivers != nil { + in, out := &in.Receivers, &out.Receivers + *out = make([]Receiver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.InhibitRules != nil { + in, out := &in.InhibitRules, &out.InhibitRules + *out = make([]InhibitRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.TimeIntervals != nil { + in, out := &in.TimeIntervals, &out.TimeIntervals + *out = make([]TimeInterval, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfigSpec. +func (in *AlertmanagerConfigSpec) DeepCopy() *AlertmanagerConfigSpec { + if in == nil { + return nil + } + out := new(AlertmanagerConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DayOfMonthRange) DeepCopyInto(out *DayOfMonthRange) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DayOfMonthRange. +func (in *DayOfMonthRange) DeepCopy() *DayOfMonthRange { + if in == nil { + return nil + } + out := new(DayOfMonthRange) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscordConfig) DeepCopyInto(out *DiscordConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + in.APIURL.DeepCopyInto(&out.APIURL) + if in.Title != nil { + in, out := &in.Title, &out.Title + *out = new(string) + **out = **in + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscordConfig. +func (in *DiscordConfig) DeepCopy() *DiscordConfig { + if in == nil { + return nil + } + out := new(DiscordConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.AuthPassword != nil { + in, out := &in.AuthPassword, &out.AuthPassword + *out = new(SecretKeySelector) + **out = **in + } + if in.AuthSecret != nil { + in, out := &in.AuthSecret, &out.AuthSecret + *out = new(SecretKeySelector) + **out = **in + } + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.HTML != nil { + in, out := &in.HTML, &out.HTML + *out = new(string) + **out = **in + } + if in.Text != nil { + in, out := &in.Text, &out.Text + *out = new(string) + **out = **in + } + if in.RequireTLS != nil { + in, out := &in.RequireTLS, &out.RequireTLS + *out = new(bool) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*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 *HTTPConfig) DeepCopyInto(out *HTTPConfig) { + *out = *in + if in.Authorization != nil { + in, out := &in.Authorization, &out.Authorization + *out = new(monitoringv1.SafeAuthorization) + (*in).DeepCopyInto(*out) + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + *out = new(monitoringv1.BasicAuth) + (*in).DeepCopyInto(*out) + } + if in.OAuth2 != nil { + in, out := &in.OAuth2, &out.OAuth2 + *out = new(monitoringv1.OAuth2) + (*in).DeepCopyInto(*out) + } + if in.BearerTokenSecret != nil { + in, out := &in.BearerTokenSecret, &out.BearerTokenSecret + *out = new(SecretKeySelector) + **out = **in + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + *out = new(monitoringv1.SafeTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.FollowRedirects != nil { + in, out := &in.FollowRedirects, &out.FollowRedirects + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPConfig. +func (in *HTTPConfig) DeepCopy() *HTTPConfig { + if in == nil { + return nil + } + out := new(HTTPConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InhibitRule) DeepCopyInto(out *InhibitRule) { + *out = *in + if in.TargetMatch != nil { + in, out := &in.TargetMatch, &out.TargetMatch + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.SourceMatch != nil { + in, out := &in.SourceMatch, &out.SourceMatch + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.Equal != nil { + in, out := &in.Equal, &out.Equal + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InhibitRule. +func (in *InhibitRule) DeepCopy() *InhibitRule { + if in == nil { + return nil + } + out := new(InhibitRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyValue) DeepCopyInto(out *KeyValue) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyValue. +func (in *KeyValue) DeepCopy() *KeyValue { + if in == nil { + return nil + } + out := new(KeyValue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MSTeamsConfig) DeepCopyInto(out *MSTeamsConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + in.WebhookURL.DeepCopyInto(&out.WebhookURL) + if in.Title != nil { + in, out := &in.Title, &out.Title + *out = new(string) + **out = **in + } + if in.Summary != nil { + in, out := &in.Summary, &out.Summary + *out = new(string) + **out = **in + } + if in.Text != nil { + in, out := &in.Text, &out.Text + *out = new(string) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MSTeamsConfig. +func (in *MSTeamsConfig) DeepCopy() *MSTeamsConfig { + if in == nil { + return nil + } + out := new(MSTeamsConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Matcher) DeepCopyInto(out *Matcher) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Matcher. +func (in *Matcher) DeepCopy() *Matcher { + if in == nil { + return nil + } + out := new(Matcher) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpsGenieConfig) DeepCopyInto(out *OpsGenieConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIKey != nil { + in, out := &in.APIKey, &out.APIKey + *out = new(SecretKeySelector) + **out = **in + } + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.Responders != nil { + in, out := &in.Responders, &out.Responders + *out = make([]OpsGenieConfigResponder, len(*in)) + copy(*out, *in) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpsGenieConfig. +func (in *OpsGenieConfig) DeepCopy() *OpsGenieConfig { + if in == nil { + return nil + } + out := new(OpsGenieConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpsGenieConfigResponder) DeepCopyInto(out *OpsGenieConfigResponder) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpsGenieConfigResponder. +func (in *OpsGenieConfigResponder) DeepCopy() *OpsGenieConfigResponder { + if in == nil { + return nil + } + out := new(OpsGenieConfigResponder) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PagerDutyConfig) DeepCopyInto(out *PagerDutyConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.RoutingKey != nil { + in, out := &in.RoutingKey, &out.RoutingKey + *out = new(SecretKeySelector) + **out = **in + } + if in.ServiceKey != nil { + in, out := &in.ServiceKey, &out.ServiceKey + *out = new(SecretKeySelector) + **out = **in + } + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.PagerDutyImageConfigs != nil { + in, out := &in.PagerDutyImageConfigs, &out.PagerDutyImageConfigs + *out = make([]PagerDutyImageConfig, len(*in)) + copy(*out, *in) + } + if in.PagerDutyLinkConfigs != nil { + in, out := &in.PagerDutyLinkConfigs, &out.PagerDutyLinkConfigs + *out = make([]PagerDutyLinkConfig, len(*in)) + copy(*out, *in) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } + if in.Source != nil { + in, out := &in.Source, &out.Source + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyConfig. +func (in *PagerDutyConfig) DeepCopy() *PagerDutyConfig { + if in == nil { + return nil + } + out := new(PagerDutyConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PagerDutyImageConfig) DeepCopyInto(out *PagerDutyImageConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyImageConfig. +func (in *PagerDutyImageConfig) DeepCopy() *PagerDutyImageConfig { + if in == nil { + return nil + } + out := new(PagerDutyImageConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PagerDutyLinkConfig) DeepCopyInto(out *PagerDutyLinkConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyLinkConfig. +func (in *PagerDutyLinkConfig) DeepCopy() *PagerDutyLinkConfig { + if in == nil { + return nil + } + out := new(PagerDutyLinkConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.UserKey != nil { + in, out := &in.UserKey, &out.UserKey + *out = new(SecretKeySelector) + **out = **in + } + if in.UserKeyFile != nil { + in, out := &in.UserKeyFile, &out.UserKeyFile + *out = new(string) + **out = **in + } + if in.Token != nil { + in, out := &in.Token, &out.Token + *out = new(SecretKeySelector) + **out = **in + } + if in.TokenFile != nil { + in, out := &in.TokenFile, &out.TokenFile + *out = new(string) + **out = **in + } + if in.TTL != nil { + in, out := &in.TTL, &out.TTL + *out = new(monitoringv1.Duration) + **out = **in + } + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*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 *Receiver) DeepCopyInto(out *Receiver) { + *out = *in + if in.OpsGenieConfigs != nil { + in, out := &in.OpsGenieConfigs, &out.OpsGenieConfigs + *out = make([]OpsGenieConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PagerDutyConfigs != nil { + in, out := &in.PagerDutyConfigs, &out.PagerDutyConfigs + *out = make([]PagerDutyConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DiscordConfigs != nil { + in, out := &in.DiscordConfigs, &out.DiscordConfigs + *out = make([]DiscordConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SlackConfigs != nil { + in, out := &in.SlackConfigs, &out.SlackConfigs + *out = make([]SlackConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.WebhookConfigs != nil { + in, out := &in.WebhookConfigs, &out.WebhookConfigs + *out = make([]WebhookConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.WeChatConfigs != nil { + in, out := &in.WeChatConfigs, &out.WeChatConfigs + *out = make([]WeChatConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EmailConfigs != nil { + in, out := &in.EmailConfigs, &out.EmailConfigs + *out = make([]EmailConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.VictorOpsConfigs != nil { + in, out := &in.VictorOpsConfigs, &out.VictorOpsConfigs + *out = make([]VictorOpsConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PushoverConfigs != nil { + in, out := &in.PushoverConfigs, &out.PushoverConfigs + *out = make([]PushoverConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SNSConfigs != nil { + in, out := &in.SNSConfigs, &out.SNSConfigs + *out = make([]SNSConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.TelegramConfigs != nil { + in, out := &in.TelegramConfigs, &out.TelegramConfigs + *out = make([]TelegramConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.WebexConfigs != nil { + in, out := &in.WebexConfigs, &out.WebexConfigs + *out = make([]WebexConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MSTeamsConfigs != nil { + in, out := &in.MSTeamsConfigs, &out.MSTeamsConfigs + *out = make([]MSTeamsConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// 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 +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route) DeepCopyInto(out *Route) { + *out = *in + if in.GroupBy != nil { + in, out := &in.GroupBy, &out.GroupBy + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Matchers != nil { + in, out := &in.Matchers, &out.Matchers + *out = make([]Matcher, len(*in)) + copy(*out, *in) + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]v1.JSON, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MuteTimeIntervals != nil { + in, out := &in.MuteTimeIntervals, &out.MuteTimeIntervals + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ActiveTimeIntervals != nil { + in, out := &in.ActiveTimeIntervals, &out.ActiveTimeIntervals + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. +func (in *Route) DeepCopy() *Route { + if in == nil { + return nil + } + out := new(Route) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SNSConfig) DeepCopyInto(out *SNSConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.Sigv4 != nil { + in, out := &in.Sigv4, &out.Sigv4 + *out = new(monitoringv1.Sigv4) + (*in).DeepCopyInto(*out) + } + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SNSConfig. +func (in *SNSConfig) DeepCopy() *SNSConfig { + if in == nil { + return nil + } + out := new(SNSConfig) + 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 *SlackAction) DeepCopyInto(out *SlackAction) { + *out = *in + if in.ConfirmField != nil { + in, out := &in.ConfirmField, &out.ConfirmField + *out = new(SlackConfirmationField) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackAction. +func (in *SlackAction) DeepCopy() *SlackAction { + if in == nil { + return nil + } + out := new(SlackAction) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIURL != nil { + in, out := &in.APIURL, &out.APIURL + *out = new(SecretKeySelector) + **out = **in + } + if in.Fields != nil { + in, out := &in.Fields, &out.Fields + *out = make([]SlackField, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MrkdwnIn != nil { + in, out := &in.MrkdwnIn, &out.MrkdwnIn + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = make([]SlackAction, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*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 *SlackConfirmationField) DeepCopyInto(out *SlackConfirmationField) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackConfirmationField. +func (in *SlackConfirmationField) DeepCopy() *SlackConfirmationField { + if in == nil { + return nil + } + out := new(SlackConfirmationField) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SlackField) DeepCopyInto(out *SlackField) { + *out = *in + if in.Short != nil { + in, out := &in.Short, &out.Short + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SlackField. +func (in *SlackField) DeepCopy() *SlackField { + if in == nil { + return nil + } + out := new(SlackField) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TelegramConfig) DeepCopyInto(out *TelegramConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.BotToken != nil { + in, out := &in.BotToken, &out.BotToken + *out = new(SecretKeySelector) + **out = **in + } + if in.BotTokenFile != nil { + in, out := &in.BotTokenFile, &out.BotTokenFile + *out = new(string) + **out = **in + } + if in.DisableNotifications != nil { + in, out := &in.DisableNotifications, &out.DisableNotifications + *out = new(bool) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TelegramConfig. +func (in *TelegramConfig) DeepCopy() *TelegramConfig { + if in == nil { + return nil + } + out := new(TelegramConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimeInterval) DeepCopyInto(out *TimeInterval) { + *out = *in + if in.TimeIntervals != nil { + in, out := &in.TimeIntervals, &out.TimeIntervals + *out = make([]TimePeriod, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeInterval. +func (in *TimeInterval) DeepCopy() *TimeInterval { + if in == nil { + return nil + } + out := new(TimeInterval) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimePeriod) DeepCopyInto(out *TimePeriod) { + *out = *in + if in.Times != nil { + in, out := &in.Times, &out.Times + *out = make([]TimeRange, len(*in)) + copy(*out, *in) + } + if in.Weekdays != nil { + in, out := &in.Weekdays, &out.Weekdays + *out = make([]WeekdayRange, len(*in)) + copy(*out, *in) + } + if in.DaysOfMonth != nil { + in, out := &in.DaysOfMonth, &out.DaysOfMonth + *out = make([]DayOfMonthRange, len(*in)) + copy(*out, *in) + } + if in.Months != nil { + in, out := &in.Months, &out.Months + *out = make([]MonthRange, len(*in)) + copy(*out, *in) + } + if in.Years != nil { + in, out := &in.Years, &out.Years + *out = make([]YearRange, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimePeriod. +func (in *TimePeriod) DeepCopy() *TimePeriod { + if in == nil { + return nil + } + out := new(TimePeriod) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimeRange) DeepCopyInto(out *TimeRange) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeRange. +func (in *TimeRange) DeepCopy() *TimeRange { + if in == nil { + return nil + } + out := new(TimeRange) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VictorOpsConfig) DeepCopyInto(out *VictorOpsConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIKey != nil { + in, out := &in.APIKey, &out.APIKey + *out = new(SecretKeySelector) + **out = **in + } + if in.CustomFields != nil { + in, out := &in.CustomFields, &out.CustomFields + *out = make([]KeyValue, len(*in)) + copy(*out, *in) + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VictorOpsConfig. +func (in *VictorOpsConfig) DeepCopy() *VictorOpsConfig { + if in == nil { + return nil + } + out := new(VictorOpsConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APISecret != nil { + in, out := &in.APISecret, &out.APISecret + *out = new(SecretKeySelector) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*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 *WebexConfig) DeepCopyInto(out *WebexConfig) { + *out = *in + if in.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.APIURL != nil { + in, out := &in.APIURL, &out.APIURL + *out = new(URL) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebexConfig. +func (in *WebexConfig) DeepCopy() *WebexConfig { + if in == nil { + return nil + } + out := new(WebexConfig) + 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.SendResolved != nil { + in, out := &in.SendResolved, &out.SendResolved + *out = new(bool) + **out = **in + } + if in.URL != nil { + in, out := &in.URL, &out.URL + *out = new(string) + **out = **in + } + if in.URLSecret != nil { + in, out := &in.URLSecret, &out.URLSecret + *out = new(SecretKeySelector) + **out = **in + } + if in.HTTPConfig != nil { + in, out := &in.HTTPConfig, &out.HTTPConfig + *out = new(HTTPConfig) + (*in).DeepCopyInto(*out) + } +} + +// 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 +} diff --git a/vendor/k8s.io/kube-aggregator/LICENSE b/vendor/k8s.io/kube-aggregator/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/doc.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/doc.go new file mode 100644 index 000000000..394bcbc8e --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package +// +groupName=apiregistration.k8s.io + +// Package apiregistration is the internal version of the API. +package apiregistration // import "k8s.io/kube-aggregator/pkg/apis/apiregistration" diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/helpers.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/helpers.go new file mode 100644 index 000000000..dfa746008 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/helpers.go @@ -0,0 +1,128 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiregistration + +import ( + "sort" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/version" +) + +// SortedByGroupAndVersion sorts APIServices into their different groups, and then sorts them based on their versions. +// For example, the first element of the first array contains the APIService with the highest version number, in the +// group with the highest priority; while the last element of the last array contains the APIService with the lowest +// version number, in the group with the lowest priority. +func SortedByGroupAndVersion(servers []*APIService) [][]*APIService { + serversByGroupPriorityMinimum := ByGroupPriorityMinimum(servers) + sort.Sort(serversByGroupPriorityMinimum) + + ret := [][]*APIService{} + for _, curr := range serversByGroupPriorityMinimum { + // check to see if we already have an entry for this group + existingIndex := -1 + for j, groupInReturn := range ret { + if groupInReturn[0].Spec.Group == curr.Spec.Group { + existingIndex = j + break + } + } + + if existingIndex >= 0 { + ret[existingIndex] = append(ret[existingIndex], curr) + sort.Sort(ByVersionPriority(ret[existingIndex])) + continue + } + + ret = append(ret, []*APIService{curr}) + } + + return ret +} + +// ByGroupPriorityMinimum sorts with the highest group number first, then by name. +// This is not a simple reverse, because we want the name sorting to be alpha, not +// reverse alpha. +type ByGroupPriorityMinimum []*APIService + +func (s ByGroupPriorityMinimum) Len() int { return len(s) } +func (s ByGroupPriorityMinimum) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s ByGroupPriorityMinimum) Less(i, j int) bool { + if s[i].Spec.GroupPriorityMinimum != s[j].Spec.GroupPriorityMinimum { + return s[i].Spec.GroupPriorityMinimum > s[j].Spec.GroupPriorityMinimum + } + return s[i].Name < s[j].Name +} + +// ByVersionPriority sorts with the highest version number first, then by name. +// This is not a simple reverse, because we want the name sorting to be alpha, not +// reverse alpha. +type ByVersionPriority []*APIService + +func (s ByVersionPriority) Len() int { return len(s) } +func (s ByVersionPriority) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s ByVersionPriority) Less(i, j int) bool { + if s[i].Spec.VersionPriority != s[j].Spec.VersionPriority { + return s[i].Spec.VersionPriority > s[j].Spec.VersionPriority + } + return version.CompareKubeAwareVersionStrings(s[i].Spec.Version, s[j].Spec.Version) > 0 +} + +// NewLocalAvailableAPIServiceCondition returns a condition for an available local APIService. +func NewLocalAvailableAPIServiceCondition() APIServiceCondition { + return APIServiceCondition{ + Type: Available, + Status: ConditionTrue, + LastTransitionTime: metav1.Now(), + Reason: "Local", + Message: "Local APIServices are always available", + } +} + +// GetAPIServiceConditionByType gets an *APIServiceCondition by APIServiceConditionType if present +func GetAPIServiceConditionByType(apiService *APIService, conditionType APIServiceConditionType) *APIServiceCondition { + for i := range apiService.Status.Conditions { + if apiService.Status.Conditions[i].Type == conditionType { + return &apiService.Status.Conditions[i] + } + } + return nil +} + +// SetAPIServiceCondition sets the status condition. It either overwrites the existing one or +// creates a new one +func SetAPIServiceCondition(apiService *APIService, newCondition APIServiceCondition) { + existingCondition := GetAPIServiceConditionByType(apiService, newCondition.Type) + if existingCondition == nil { + apiService.Status.Conditions = append(apiService.Status.Conditions, newCondition) + return + } + + if existingCondition.Status != newCondition.Status { + existingCondition.Status = newCondition.Status + existingCondition.LastTransitionTime = newCondition.LastTransitionTime + } + + existingCondition.Reason = newCondition.Reason + existingCondition.Message = newCondition.Message +} + +// IsAPIServiceConditionTrue indicates if the condition is present and strictly true +func IsAPIServiceConditionTrue(apiService *APIService, conditionType APIServiceConditionType) bool { + condition := GetAPIServiceConditionByType(apiService, conditionType) + return condition != nil && condition.Status == ConditionTrue +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/register.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/register.go new file mode 100644 index 000000000..7b88df42f --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/register.go @@ -0,0 +1,54 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiregistration + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the API group for apiregistration +const GroupName = "apiregistration.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder is the scheme builder with scheme init functions to run for this API package + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &APIService{}, + &APIServiceList{}, + ) + return nil +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/types.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/types.go new file mode 100644 index 000000000..97411783f --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/types.go @@ -0,0 +1,146 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiregistration + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// APIServiceList is a list of APIService objects. +type APIServiceList struct { + metav1.TypeMeta + metav1.ListMeta + + Items []APIService +} + +// ServiceReference holds a reference to Service.legacy.k8s.io +type ServiceReference struct { + // Namespace is the namespace of the service + Namespace string + // Name is the name of the service + Name string + // If specified, the port on the service that hosting the service. + // Default to 443 for backward compatibility. + // `port` should be a valid port number (1-65535, inclusive). + // +optional + Port int32 +} + +// APIServiceSpec contains information for locating and communicating with a server. +// Only https is supported, though you are able to disable certificate verification. +type APIServiceSpec struct { + // Service is a reference to the service for this API server. It must communicate + // on port 443. + // If the Service is nil, that means the handling for the API groupversion is handled locally on this server. + // The call will simply delegate to the normal handler chain to be fulfilled. + // +optional + Service *ServiceReference + // Group is the API group name this server hosts + Group string + // Version is the API version this server hosts. For example, "v1" + Version string + + // InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. + // This is strongly discouraged. You should use the CABundle instead. + InsecureSkipTLSVerify bool + // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. + // If unspecified, system trust roots on the apiserver are used. + // +listType=atomic + // +optional + CABundle []byte + + // GroupPriorityMinimum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. + // Note that other versions of this group might specify even higher GroupPriorityMinimum values such that the whole group gets a higher priority. + // The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). + // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) + // We'd recommend something like: *.k8s.io (except extensions) at 18000 and + // PaaSes (OpenShift, Deis) are recommended to be in the 2000s + GroupPriorityMinimum int32 + + // VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. + // The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). + // Since it's inside of a group, the number can be small, probably in the 10s. + // In case of equal version priorities, the version string will be used to compute the order inside a group. + // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered + // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), + // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first + // by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major + // version, then minor version. An example sorted list of versions: + // v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. + VersionPriority int32 +} + +// ConditionStatus indicates the status of a condition (true, false, or unknown). +type ConditionStatus string + +// These are valid condition statuses. "ConditionTrue" means a resource is in the condition; +// "ConditionFalse" means a resource is not in the condition; "ConditionUnknown" means kubernetes +// can't decide if a resource is in the condition or not. In the future, we could add other +// intermediate conditions, e.g. ConditionDegraded. +const ( + ConditionTrue ConditionStatus = "True" + ConditionFalse ConditionStatus = "False" + ConditionUnknown ConditionStatus = "Unknown" +) + +// APIServiceConditionType is a valid value for APIServiceCondition.Type +type APIServiceConditionType string + +const ( + // Available indicates that the service exists and is reachable + Available APIServiceConditionType = "Available" +) + +// APIServiceCondition describes conditions for an APIService +type APIServiceCondition struct { + // Type is the type of the condition. + Type APIServiceConditionType + // Status is the status of the condition. + // Can be True, False, Unknown. + Status ConditionStatus + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time + // Unique, one-word, CamelCase reason for the condition's last transition. + Reason string + // Human-readable message indicating details about last transition. + Message string +} + +// APIServiceStatus contains derived information about an API server +type APIServiceStatus struct { + // Current service state of apiService. + // +listType=map + // +listMapKey=type + Conditions []APIServiceCondition +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// APIService represents a server for a particular GroupVersion. +// Name must be "version.group". +type APIService struct { + metav1.TypeMeta + metav1.ObjectMeta + + // Spec contains information for locating and communicating with a server + Spec APIServiceSpec + // Status contains derived information about an API server + Status APIServiceStatus +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/defaults.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/defaults.go new file mode 100644 index 000000000..2ae90d646 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/defaults.go @@ -0,0 +1,33 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + utilpointer "k8s.io/utils/pointer" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +// SetDefaults_ServiceReference sets defaults for AuditSync Webhook's ServiceReference +func SetDefaults_ServiceReference(obj *ServiceReference) { + if obj.Port == nil { + obj.Port = utilpointer.Int32Ptr(443) + } +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/doc.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/doc.go new file mode 100644 index 000000000..b9993f4ca --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/doc.go @@ -0,0 +1,37 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +k8s:conversion-gen=k8s.io/kube-aggregator/pkg/apis/apiregistration +// +k8s:openapi-gen=true +// +groupName=apiregistration.k8s.io +// +k8s:defaulter-gen=TypeMeta + +// Package v1 contains the API Registration API, which is responsible for +// registering an API `Group`/`Version` with another kubernetes like API server. +// The `APIService` holds information about the other API server in +// `APIServiceSpec` type as well as general `TypeMeta` and `ObjectMeta`. The +// `APIServiceSpec` type have the main configuration needed to do the +// aggregation. Any request coming for specified `Group`/`Version` will be +// directed to the service defined by `ServiceReference` (on port 443) after +// validating the target using provided `CABundle` or skipping validation +// if development flag `InsecureSkipTLSVerify` is set. `Priority` is controlling +// the order of this API group in the overall discovery document. +// The return status is a set of conditions for this aggregation. Currently +// there is only one condition named "Available", if true, it means the +// api/server requests will be redirected to specified API server. +package v1 // import "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.pb.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.pb.go new file mode 100644 index 000000000..690810e8b --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.pb.go @@ -0,0 +1,1813 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto + +package v1 + +import ( + fmt "fmt" + + io "io" + + proto "github.com/gogo/protobuf/proto" + + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func (m *APIService) Reset() { *m = APIService{} } +func (*APIService) ProtoMessage() {} +func (*APIService) Descriptor() ([]byte, []int) { + return fileDescriptor_93cf925561aed99f, []int{0} +} +func (m *APIService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *APIService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *APIService) XXX_Merge(src proto.Message) { + xxx_messageInfo_APIService.Merge(m, src) +} +func (m *APIService) XXX_Size() int { + return m.Size() +} +func (m *APIService) XXX_DiscardUnknown() { + xxx_messageInfo_APIService.DiscardUnknown(m) +} + +var xxx_messageInfo_APIService proto.InternalMessageInfo + +func (m *APIServiceCondition) Reset() { *m = APIServiceCondition{} } +func (*APIServiceCondition) ProtoMessage() {} +func (*APIServiceCondition) Descriptor() ([]byte, []int) { + return fileDescriptor_93cf925561aed99f, []int{1} +} +func (m *APIServiceCondition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *APIServiceCondition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *APIServiceCondition) XXX_Merge(src proto.Message) { + xxx_messageInfo_APIServiceCondition.Merge(m, src) +} +func (m *APIServiceCondition) XXX_Size() int { + return m.Size() +} +func (m *APIServiceCondition) XXX_DiscardUnknown() { + xxx_messageInfo_APIServiceCondition.DiscardUnknown(m) +} + +var xxx_messageInfo_APIServiceCondition proto.InternalMessageInfo + +func (m *APIServiceList) Reset() { *m = APIServiceList{} } +func (*APIServiceList) ProtoMessage() {} +func (*APIServiceList) Descriptor() ([]byte, []int) { + return fileDescriptor_93cf925561aed99f, []int{2} +} +func (m *APIServiceList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *APIServiceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *APIServiceList) XXX_Merge(src proto.Message) { + xxx_messageInfo_APIServiceList.Merge(m, src) +} +func (m *APIServiceList) XXX_Size() int { + return m.Size() +} +func (m *APIServiceList) XXX_DiscardUnknown() { + xxx_messageInfo_APIServiceList.DiscardUnknown(m) +} + +var xxx_messageInfo_APIServiceList proto.InternalMessageInfo + +func (m *APIServiceSpec) Reset() { *m = APIServiceSpec{} } +func (*APIServiceSpec) ProtoMessage() {} +func (*APIServiceSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_93cf925561aed99f, []int{3} +} +func (m *APIServiceSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *APIServiceSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *APIServiceSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_APIServiceSpec.Merge(m, src) +} +func (m *APIServiceSpec) XXX_Size() int { + return m.Size() +} +func (m *APIServiceSpec) XXX_DiscardUnknown() { + xxx_messageInfo_APIServiceSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_APIServiceSpec proto.InternalMessageInfo + +func (m *APIServiceStatus) Reset() { *m = APIServiceStatus{} } +func (*APIServiceStatus) ProtoMessage() {} +func (*APIServiceStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_93cf925561aed99f, []int{4} +} +func (m *APIServiceStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *APIServiceStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *APIServiceStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_APIServiceStatus.Merge(m, src) +} +func (m *APIServiceStatus) XXX_Size() int { + return m.Size() +} +func (m *APIServiceStatus) XXX_DiscardUnknown() { + xxx_messageInfo_APIServiceStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_APIServiceStatus proto.InternalMessageInfo + +func (m *ServiceReference) Reset() { *m = ServiceReference{} } +func (*ServiceReference) ProtoMessage() {} +func (*ServiceReference) Descriptor() ([]byte, []int) { + return fileDescriptor_93cf925561aed99f, []int{5} +} +func (m *ServiceReference) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ServiceReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ServiceReference) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceReference.Merge(m, src) +} +func (m *ServiceReference) XXX_Size() int { + return m.Size() +} +func (m *ServiceReference) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceReference.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceReference proto.InternalMessageInfo + +func init() { + proto.RegisterType((*APIService)(nil), "k8s.io.kube_aggregator.pkg.apis.apiregistration.v1.APIService") + proto.RegisterType((*APIServiceCondition)(nil), "k8s.io.kube_aggregator.pkg.apis.apiregistration.v1.APIServiceCondition") + proto.RegisterType((*APIServiceList)(nil), "k8s.io.kube_aggregator.pkg.apis.apiregistration.v1.APIServiceList") + proto.RegisterType((*APIServiceSpec)(nil), "k8s.io.kube_aggregator.pkg.apis.apiregistration.v1.APIServiceSpec") + proto.RegisterType((*APIServiceStatus)(nil), "k8s.io.kube_aggregator.pkg.apis.apiregistration.v1.APIServiceStatus") + proto.RegisterType((*ServiceReference)(nil), "k8s.io.kube_aggregator.pkg.apis.apiregistration.v1.ServiceReference") +} + +func init() { + proto.RegisterFile("k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto", fileDescriptor_93cf925561aed99f) +} + +var fileDescriptor_93cf925561aed99f = []byte{ + // 826 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x5d, 0x6b, 0x2b, 0x45, + 0x18, 0xce, 0xb6, 0x49, 0x9b, 0x4e, 0xeb, 0x69, 0x1d, 0xcf, 0xe1, 0x2c, 0xe5, 0xb8, 0xad, 0x11, + 0x34, 0x0a, 0x67, 0xd7, 0x06, 0x11, 0x45, 0x10, 0xba, 0x47, 0x28, 0x85, 0x56, 0xc3, 0xa4, 0x14, + 0x11, 0x41, 0x27, 0x9b, 0xb7, 0xdb, 0x31, 0xdd, 0x0f, 0x66, 0x66, 0x03, 0xc1, 0x1b, 0xc1, 0x1f, + 0xa0, 0xbf, 0xc9, 0xab, 0x5e, 0x1e, 0xf0, 0xa6, 0x57, 0xc1, 0xc4, 0x7f, 0x71, 0xae, 0x64, 0x66, + 0x67, 0x77, 0xd3, 0x34, 0xe2, 0xe9, 0xe9, 0x4d, 0xc8, 0xfb, 0xf1, 0x3c, 0xcf, 0x3b, 0xef, 0x3c, + 0x99, 0x20, 0x7f, 0xf8, 0xb9, 0x70, 0x59, 0xe2, 0x0d, 0xb3, 0x3e, 0x3c, 0xa7, 0x61, 0xc8, 0x21, + 0xa4, 0x32, 0xe1, 0x5e, 0x3a, 0x0c, 0x3d, 0x9a, 0x32, 0xa1, 0x3e, 0x38, 0x84, 0x4c, 0x48, 0x4e, + 0x25, 0x4b, 0x62, 0x6f, 0x74, 0xe0, 0x85, 0x10, 0x03, 0xa7, 0x12, 0x06, 0x6e, 0xca, 0x13, 0x99, + 0xe0, 0x4e, 0xce, 0xe1, 0x2a, 0x8e, 0x1f, 0x2b, 0x0e, 0x37, 0x1d, 0x86, 0xae, 0xe2, 0x70, 0x17, + 0x38, 0xdc, 0xd1, 0xc1, 0xee, 0xf3, 0x90, 0xc9, 0xcb, 0xac, 0xef, 0x06, 0x49, 0xe4, 0x85, 0x49, + 0x98, 0x78, 0x9a, 0xaa, 0x9f, 0x5d, 0xe8, 0x48, 0x07, 0xfa, 0x5b, 0x2e, 0xb1, 0xfb, 0xa9, 0x19, + 0x93, 0xa6, 0x2c, 0xa2, 0xc1, 0x25, 0x8b, 0x81, 0x8f, 0xab, 0x19, 0x23, 0x90, 0x74, 0xc9, 0x60, + 0xbb, 0xde, 0x7f, 0xa1, 0x78, 0x16, 0x4b, 0x16, 0xc1, 0x1d, 0xc0, 0x67, 0xff, 0x07, 0x10, 0xc1, + 0x25, 0x44, 0x74, 0x11, 0xd7, 0xfa, 0x73, 0x05, 0xa1, 0xc3, 0xee, 0x71, 0x0f, 0xf8, 0x88, 0x05, + 0x80, 0x7f, 0x42, 0x4d, 0x35, 0xd2, 0x80, 0x4a, 0x6a, 0x5b, 0xfb, 0x56, 0x7b, 0xb3, 0xf3, 0x89, + 0x6b, 0x76, 0x34, 0xcf, 0x5c, 0x2d, 0x48, 0x75, 0xbb, 0xa3, 0x03, 0xf7, 0xdb, 0xfe, 0xcf, 0x10, + 0xc8, 0x53, 0x90, 0xd4, 0xc7, 0xd7, 0x93, 0xbd, 0xda, 0x6c, 0xb2, 0x87, 0xaa, 0x1c, 0x29, 0x59, + 0xf1, 0x00, 0xd5, 0x45, 0x0a, 0x81, 0xbd, 0xa2, 0xd9, 0x7d, 0xf7, 0xfe, 0x37, 0xe0, 0x56, 0xf3, + 0xf6, 0x52, 0x08, 0xfc, 0x2d, 0xa3, 0x57, 0x57, 0x11, 0xd1, 0xec, 0xf8, 0x0a, 0xad, 0x09, 0x49, + 0x65, 0x26, 0xec, 0x55, 0xad, 0xf3, 0xf5, 0x03, 0x75, 0x34, 0x97, 0xff, 0xc8, 0x28, 0xad, 0xe5, + 0x31, 0x31, 0x1a, 0xad, 0x9b, 0x15, 0xf4, 0x4e, 0xd5, 0xfc, 0x22, 0x89, 0x07, 0x4c, 0x71, 0xe0, + 0x2f, 0x51, 0x5d, 0x8e, 0x53, 0xd0, 0x9b, 0xdc, 0xf0, 0x3f, 0x2c, 0xe6, 0x3c, 0x1b, 0xa7, 0xf0, + 0x6a, 0xb2, 0xf7, 0x74, 0x09, 0x44, 0x95, 0x88, 0x06, 0xe1, 0x2f, 0xca, 0x23, 0xac, 0x68, 0xf8, + 0x7b, 0xb7, 0xc5, 0x5f, 0x4d, 0xf6, 0xb6, 0x4b, 0xd8, 0xed, 0x79, 0xf0, 0x08, 0xe1, 0x2b, 0x2a, + 0xe4, 0x19, 0xa7, 0xb1, 0xc8, 0x69, 0x59, 0x04, 0x66, 0x13, 0x1f, 0xbf, 0xde, 0x7d, 0x2a, 0x84, + 0xbf, 0x6b, 0x24, 0xf1, 0xc9, 0x1d, 0x36, 0xb2, 0x44, 0x01, 0x7f, 0x80, 0xd6, 0x38, 0x50, 0x91, + 0xc4, 0x76, 0x5d, 0x8f, 0x5c, 0xee, 0x8b, 0xe8, 0x2c, 0x31, 0x55, 0xfc, 0x11, 0x5a, 0x8f, 0x40, + 0x08, 0x1a, 0x82, 0xdd, 0xd0, 0x8d, 0xdb, 0xa6, 0x71, 0xfd, 0x34, 0x4f, 0x93, 0xa2, 0xde, 0xfa, + 0xcb, 0x42, 0x8f, 0xaa, 0x3d, 0x9d, 0x30, 0x21, 0xf1, 0x0f, 0x77, 0x3c, 0xea, 0xbe, 0xde, 0x99, + 0x14, 0x5a, 0x3b, 0x74, 0xc7, 0xc8, 0x35, 0x8b, 0xcc, 0x9c, 0x3f, 0x03, 0xd4, 0x60, 0x12, 0x22, + 0xb5, 0xf5, 0xd5, 0xf6, 0x66, 0xe7, 0xab, 0x87, 0x19, 0xc7, 0x7f, 0xcb, 0x48, 0x35, 0x8e, 0x15, + 0x29, 0xc9, 0xb9, 0x5b, 0xd3, 0xd5, 0xf9, 0x53, 0x29, 0xdf, 0xe2, 0x21, 0x5a, 0x17, 0x79, 0x68, + 0x0e, 0xf5, 0x46, 0x96, 0x35, 0x8c, 0x04, 0x2e, 0x80, 0x43, 0x1c, 0x80, 0xbf, 0xa9, 0xb6, 0x5a, + 0x64, 0x0b, 0x05, 0xfc, 0x3e, 0x6a, 0x84, 0x3c, 0xc9, 0x52, 0x63, 0xad, 0x72, 0xc8, 0x23, 0x95, + 0x24, 0x79, 0x4d, 0xdd, 0xd2, 0x08, 0xb8, 0x60, 0x49, 0xac, 0xad, 0x33, 0x77, 0x4b, 0xe7, 0x79, + 0x9a, 0x14, 0x75, 0xdc, 0x43, 0x4f, 0x58, 0x2c, 0x20, 0xc8, 0x38, 0xf4, 0x86, 0x2c, 0x3d, 0x3b, + 0xe9, 0x9d, 0x03, 0x67, 0x17, 0x63, 0xed, 0x83, 0xa6, 0xff, 0xae, 0x01, 0x3e, 0x39, 0x5e, 0xd6, + 0x44, 0x96, 0x63, 0x71, 0x1b, 0x35, 0x03, 0xea, 0x67, 0xf1, 0xe0, 0x2a, 0xb7, 0xc9, 0x96, 0xbf, + 0xa5, 0xee, 0xec, 0xc5, 0x61, 0x9e, 0x23, 0x65, 0x15, 0x77, 0xd1, 0x63, 0x3d, 0x72, 0x97, 0xb3, + 0x84, 0x33, 0x39, 0x3e, 0x65, 0x31, 0x8b, 0xb2, 0xc8, 0x5e, 0xdf, 0xb7, 0xda, 0x0d, 0xff, 0x99, + 0x51, 0x7f, 0x7c, 0xb4, 0xa4, 0x87, 0x2c, 0x45, 0xe2, 0x43, 0xb4, 0x6d, 0xce, 0x56, 0x54, 0xec, + 0xa6, 0x26, 0x7b, 0x6a, 0xc8, 0xb6, 0xcf, 0x6f, 0x97, 0xc9, 0x62, 0x7f, 0xeb, 0x77, 0x0b, 0xed, + 0x2c, 0xbe, 0x20, 0xf8, 0x17, 0x84, 0x82, 0xe2, 0x47, 0x2b, 0x6c, 0x4b, 0x5b, 0xec, 0xe8, 0x61, + 0x16, 0x2b, 0x1f, 0x81, 0xea, 0xe1, 0x2d, 0x53, 0x82, 0xcc, 0xc9, 0xb5, 0x7e, 0xb3, 0xd0, 0xce, + 0xa2, 0x41, 0xb0, 0x87, 0x36, 0x62, 0x1a, 0x81, 0x48, 0x69, 0x50, 0x3c, 0x54, 0x6f, 0x1b, 0x9e, + 0x8d, 0x6f, 0x8a, 0x02, 0xa9, 0x7a, 0xf0, 0x3e, 0xaa, 0xab, 0xc0, 0x58, 0xa7, 0x7c, 0x7c, 0x55, + 0x2f, 0xd1, 0x15, 0xfc, 0x0c, 0xd5, 0xd3, 0x84, 0x4b, 0xed, 0x9a, 0x86, 0xdf, 0x54, 0xd5, 0x6e, + 0xc2, 0x25, 0xd1, 0x59, 0xff, 0xbb, 0xeb, 0xa9, 0x53, 0x7b, 0x39, 0x75, 0x6a, 0x37, 0x53, 0xa7, + 0xf6, 0xeb, 0xcc, 0xb1, 0xae, 0x67, 0x8e, 0xf5, 0x72, 0xe6, 0x58, 0x37, 0x33, 0xc7, 0xfa, 0x7b, + 0xe6, 0x58, 0x7f, 0xfc, 0xe3, 0xd4, 0xbe, 0xef, 0xdc, 0xff, 0xdf, 0xfd, 0xdf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x19, 0x6e, 0x3d, 0x66, 0x12, 0x08, 0x00, 0x00, +} + +func (m *APIService) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *APIService) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *APIService) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *APIServiceCondition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *APIServiceCondition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *APIServiceCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x2a + i -= len(m.Reason) + copy(dAtA[i:], m.Reason) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) + i-- + dAtA[i] = 0x22 + { + size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x12 + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *APIServiceList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *APIServiceList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *APIServiceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *APIServiceSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *APIServiceSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *APIServiceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.VersionPriority)) + i-- + dAtA[i] = 0x40 + i = encodeVarintGenerated(dAtA, i, uint64(m.GroupPriorityMinimum)) + i-- + dAtA[i] = 0x38 + if m.CABundle != nil { + i -= len(m.CABundle) + copy(dAtA[i:], m.CABundle) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.CABundle))) + i-- + dAtA[i] = 0x2a + } + i-- + if m.InsecureSkipTLSVerify { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x1a + i -= len(m.Group) + copy(dAtA[i:], m.Group) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Group))) + i-- + dAtA[i] = 0x12 + if m.Service != nil { + { + size, err := m.Service.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *APIServiceStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *APIServiceStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *APIServiceStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ServiceReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ServiceReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ServiceReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Port != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) + i-- + dAtA[i] = 0x18 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *APIService) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *APIServiceCondition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Status) + n += 1 + l + sovGenerated(uint64(l)) + l = m.LastTransitionTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *APIServiceList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *APIServiceSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Service != nil { + l = m.Service.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.Group) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Version) + n += 1 + l + sovGenerated(uint64(l)) + n += 2 + if m.CABundle != nil { + l = len(m.CABundle) + n += 1 + l + sovGenerated(uint64(l)) + } + n += 1 + sovGenerated(uint64(m.GroupPriorityMinimum)) + n += 1 + sovGenerated(uint64(m.VersionPriority)) + return n +} + +func (m *APIServiceStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ServiceReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Namespace) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.Port != nil { + n += 1 + sovGenerated(uint64(*m.Port)) + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *APIService) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&APIService{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "APIServiceSpec", "APIServiceSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "APIServiceStatus", "APIServiceStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *APIServiceCondition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&APIServiceCondition{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Status:` + fmt.Sprintf("%v", this.Status) + `,`, + `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `}`, + }, "") + return s +} +func (this *APIServiceList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]APIService{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "APIService", "APIService", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&APIServiceList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *APIServiceSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&APIServiceSpec{`, + `Service:` + strings.Replace(this.Service.String(), "ServiceReference", "ServiceReference", 1) + `,`, + `Group:` + fmt.Sprintf("%v", this.Group) + `,`, + `Version:` + fmt.Sprintf("%v", this.Version) + `,`, + `InsecureSkipTLSVerify:` + fmt.Sprintf("%v", this.InsecureSkipTLSVerify) + `,`, + `CABundle:` + valueToStringGenerated(this.CABundle) + `,`, + `GroupPriorityMinimum:` + fmt.Sprintf("%v", this.GroupPriorityMinimum) + `,`, + `VersionPriority:` + fmt.Sprintf("%v", this.VersionPriority) + `,`, + `}`, + }, "") + return s +} +func (this *APIServiceStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]APIServiceCondition{" + for _, f := range this.Conditions { + repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "APIServiceCondition", "APIServiceCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&APIServiceStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `}`, + }, "") + return s +} +func (this *ServiceReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ServiceReference{`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Port:` + valueToStringGenerated(this.Port) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *APIService) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: APIService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: APIService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *APIServiceCondition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: APIServiceCondition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: APIServiceCondition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = APIServiceConditionType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = ConditionStatus(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *APIServiceList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: APIServiceList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: APIServiceList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, APIService{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *APIServiceSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: APIServiceSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: APIServiceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Service == nil { + m.Service = &ServiceReference{} + } + if err := m.Service.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Group = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InsecureSkipTLSVerify", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.InsecureSkipTLSVerify = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CABundle", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CABundle = append(m.CABundle[:0], dAtA[iNdEx:postIndex]...) + if m.CABundle == nil { + m.CABundle = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupPriorityMinimum", wireType) + } + m.GroupPriorityMinimum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GroupPriorityMinimum |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionPriority", wireType) + } + m.VersionPriority = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VersionPriority |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *APIServiceStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: APIServiceStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: APIServiceStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, APIServiceCondition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ServiceReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ServiceReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServiceReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Port = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto new file mode 100644 index 000000000..8413a158b --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto @@ -0,0 +1,151 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = "proto2"; + +package k8s.io.kube_aggregator.pkg.apis.apiregistration.v1; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"; + +// APIService represents a server for a particular GroupVersion. +// Name must be "version.group". +message APIService { + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Spec contains information for locating and communicating with a server + optional APIServiceSpec spec = 2; + + // Status contains derived information about an API server + optional APIServiceStatus status = 3; +} + +// APIServiceCondition describes the state of an APIService at a particular point +message APIServiceCondition { + // Type is the type of the condition. + optional string type = 1; + + // Status is the status of the condition. + // Can be True, False, Unknown. + optional string status = 2; + + // Last time the condition transitioned from one status to another. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; + + // Unique, one-word, CamelCase reason for the condition's last transition. + // +optional + optional string reason = 4; + + // Human-readable message indicating details about last transition. + // +optional + optional string message = 5; +} + +// APIServiceList is a list of APIService objects. +message APIServiceList { + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of APIService + repeated APIService items = 2; +} + +// APIServiceSpec contains information for locating and communicating with a server. +// Only https is supported, though you are able to disable certificate verification. +message APIServiceSpec { + // Service is a reference to the service for this API server. It must communicate + // on port 443. + // If the Service is nil, that means the handling for the API groupversion is handled locally on this server. + // The call will simply delegate to the normal handler chain to be fulfilled. + // +optional + optional ServiceReference service = 1; + + // Group is the API group name this server hosts + optional string group = 2; + + // Version is the API version this server hosts. For example, "v1" + optional string version = 3; + + // InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. + // This is strongly discouraged. You should use the CABundle instead. + optional bool insecureSkipTLSVerify = 4; + + // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. + // If unspecified, system trust roots on the apiserver are used. + // +listType=atomic + // +optional + optional bytes caBundle = 5; + + // GroupPriorityMinimum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. + // Note that other versions of this group might specify even higher GroupPriorityMinimum values such that the whole group gets a higher priority. + // The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). + // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) + // We'd recommend something like: *.k8s.io (except extensions) at 18000 and + // PaaSes (OpenShift, Deis) are recommended to be in the 2000s + optional int32 groupPriorityMinimum = 7; + + // VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. + // The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). + // Since it's inside of a group, the number can be small, probably in the 10s. + // In case of equal version priorities, the version string will be used to compute the order inside a group. + // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered + // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), + // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first + // by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major + // version, then minor version. An example sorted list of versions: + // v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. + optional int32 versionPriority = 8; +} + +// APIServiceStatus contains derived information about an API server +message APIServiceStatus { + // Current service state of apiService. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + repeated APIServiceCondition conditions = 1; +} + +// ServiceReference holds a reference to Service.legacy.k8s.io +message ServiceReference { + // Namespace is the namespace of the service + optional string namespace = 1; + + // Name is the name of the service + optional string name = 2; + + // 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 + optional int32 port = 3; +} + diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/register.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/register.go new file mode 100644 index 000000000..07e65bf04 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/register.go @@ -0,0 +1,61 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the API group for apiregistration +const GroupName = "apiregistration.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// Resource takes an unqualified resource and returns back a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder is the scheme builder with scheme init functions to run for this API package + // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes, addDefaultingFuncs) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &APIService{}, + &APIServiceList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/types.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/types.go new file mode 100644 index 000000000..14f71c704 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/types.go @@ -0,0 +1,162 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// APIServiceList is a list of APIService objects. +type APIServiceList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of APIService + Items []APIService `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// ServiceReference holds a reference to Service.legacy.k8s.io +type ServiceReference struct { + // Namespace is the namespace of the service + Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` + // Name is the name of the service + Name string `json:"name,omitempty" protobuf:"bytes,2,opt,name=name"` + // 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" protobuf:"varint,3,opt,name=port"` +} + +// APIServiceSpec contains information for locating and communicating with a server. +// Only https is supported, though you are able to disable certificate verification. +type APIServiceSpec struct { + // Service is a reference to the service for this API server. It must communicate + // on port 443. + // If the Service is nil, that means the handling for the API groupversion is handled locally on this server. + // The call will simply delegate to the normal handler chain to be fulfilled. + // +optional + Service *ServiceReference `json:"service,omitempty" protobuf:"bytes,1,opt,name=service"` + // Group is the API group name this server hosts + Group string `json:"group,omitempty" protobuf:"bytes,2,opt,name=group"` + // Version is the API version this server hosts. For example, "v1" + Version string `json:"version,omitempty" protobuf:"bytes,3,opt,name=version"` + + // InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. + // This is strongly discouraged. You should use the CABundle instead. + InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify,omitempty" protobuf:"varint,4,opt,name=insecureSkipTLSVerify"` + // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. + // If unspecified, system trust roots on the apiserver are used. + // +listType=atomic + // +optional + CABundle []byte `json:"caBundle,omitempty" protobuf:"bytes,5,opt,name=caBundle"` + + // GroupPriorityMinimum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. + // Note that other versions of this group might specify even higher GroupPriorityMinimum values such that the whole group gets a higher priority. + // The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). + // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) + // We'd recommend something like: *.k8s.io (except extensions) at 18000 and + // PaaSes (OpenShift, Deis) are recommended to be in the 2000s + GroupPriorityMinimum int32 `json:"groupPriorityMinimum" protobuf:"varint,7,opt,name=groupPriorityMinimum"` + + // VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. + // The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). + // Since it's inside of a group, the number can be small, probably in the 10s. + // In case of equal version priorities, the version string will be used to compute the order inside a group. + // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered + // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), + // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first + // by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major + // version, then minor version. An example sorted list of versions: + // v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. + VersionPriority int32 `json:"versionPriority" protobuf:"varint,8,opt,name=versionPriority"` + + // leaving this here so everyone remembers why proto index 6 is skipped + // Priority int64 `json:"priority" protobuf:"varint,6,opt,name=priority"` +} + +// ConditionStatus indicates the status of a condition (true, false, or unknown). +type ConditionStatus string + +// These are valid condition statuses. "ConditionTrue" means a resource is in the condition; +// "ConditionFalse" means a resource is not in the condition; "ConditionUnknown" means kubernetes +// can't decide if a resource is in the condition or not. In the future, we could add other +// intermediate conditions, e.g. ConditionDegraded. +const ( + ConditionTrue ConditionStatus = "True" + ConditionFalse ConditionStatus = "False" + ConditionUnknown ConditionStatus = "Unknown" +) + +// APIServiceConditionType is a valid value for APIServiceCondition.Type +type APIServiceConditionType string + +const ( + // Available indicates that the service exists and is reachable + Available APIServiceConditionType = "Available" +) + +// APIServiceCondition describes the state of an APIService at a particular point +type APIServiceCondition struct { + // Type is the type of the condition. + Type APIServiceConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=APIServiceConditionType"` + // Status is the status of the condition. + // Can be True, False, Unknown. + Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` + // Last time the condition transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` + // Unique, one-word, CamelCase reason for the condition's last transition. + // +optional + Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` + // Human-readable message indicating details about last transition. + // +optional + Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` +} + +// APIServiceStatus contains derived information about an API server +type APIServiceStatus struct { + // Current service state of apiService. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + Conditions []APIServiceCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// APIService represents a server for a particular GroupVersion. +// Name must be "version.group". +type APIService struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec contains information for locating and communicating with a server + Spec APIServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + // Status contains derived information about an API server + Status APIServiceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.conversion.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.conversion.go new file mode 100644 index 000000000..208e23efd --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.conversion.go @@ -0,0 +1,299 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1 + +import ( + unsafe "unsafe" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiregistration "k8s.io/kube-aggregator/pkg/apis/apiregistration" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*APIService)(nil), (*apiregistration.APIService)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_APIService_To_apiregistration_APIService(a.(*APIService), b.(*apiregistration.APIService), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*apiregistration.APIService)(nil), (*APIService)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_apiregistration_APIService_To_v1_APIService(a.(*apiregistration.APIService), b.(*APIService), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*APIServiceCondition)(nil), (*apiregistration.APIServiceCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_APIServiceCondition_To_apiregistration_APIServiceCondition(a.(*APIServiceCondition), b.(*apiregistration.APIServiceCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*apiregistration.APIServiceCondition)(nil), (*APIServiceCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_apiregistration_APIServiceCondition_To_v1_APIServiceCondition(a.(*apiregistration.APIServiceCondition), b.(*APIServiceCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*APIServiceList)(nil), (*apiregistration.APIServiceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_APIServiceList_To_apiregistration_APIServiceList(a.(*APIServiceList), b.(*apiregistration.APIServiceList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*apiregistration.APIServiceList)(nil), (*APIServiceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_apiregistration_APIServiceList_To_v1_APIServiceList(a.(*apiregistration.APIServiceList), b.(*APIServiceList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*APIServiceSpec)(nil), (*apiregistration.APIServiceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_APIServiceSpec_To_apiregistration_APIServiceSpec(a.(*APIServiceSpec), b.(*apiregistration.APIServiceSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*apiregistration.APIServiceSpec)(nil), (*APIServiceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_apiregistration_APIServiceSpec_To_v1_APIServiceSpec(a.(*apiregistration.APIServiceSpec), b.(*APIServiceSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*APIServiceStatus)(nil), (*apiregistration.APIServiceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_APIServiceStatus_To_apiregistration_APIServiceStatus(a.(*APIServiceStatus), b.(*apiregistration.APIServiceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*apiregistration.APIServiceStatus)(nil), (*APIServiceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_apiregistration_APIServiceStatus_To_v1_APIServiceStatus(a.(*apiregistration.APIServiceStatus), b.(*APIServiceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ServiceReference)(nil), (*apiregistration.ServiceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ServiceReference_To_apiregistration_ServiceReference(a.(*ServiceReference), b.(*apiregistration.ServiceReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*apiregistration.ServiceReference)(nil), (*ServiceReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_apiregistration_ServiceReference_To_v1_ServiceReference(a.(*apiregistration.ServiceReference), b.(*ServiceReference), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1_APIService_To_apiregistration_APIService(in *APIService, out *apiregistration.APIService, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1_APIServiceSpec_To_apiregistration_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1_APIServiceStatus_To_apiregistration_APIServiceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1_APIService_To_apiregistration_APIService is an autogenerated conversion function. +func Convert_v1_APIService_To_apiregistration_APIService(in *APIService, out *apiregistration.APIService, s conversion.Scope) error { + return autoConvert_v1_APIService_To_apiregistration_APIService(in, out, s) +} + +func autoConvert_apiregistration_APIService_To_v1_APIService(in *apiregistration.APIService, out *APIService, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_apiregistration_APIServiceSpec_To_v1_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_apiregistration_APIServiceStatus_To_v1_APIServiceStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_apiregistration_APIService_To_v1_APIService is an autogenerated conversion function. +func Convert_apiregistration_APIService_To_v1_APIService(in *apiregistration.APIService, out *APIService, s conversion.Scope) error { + return autoConvert_apiregistration_APIService_To_v1_APIService(in, out, s) +} + +func autoConvert_v1_APIServiceCondition_To_apiregistration_APIServiceCondition(in *APIServiceCondition, out *apiregistration.APIServiceCondition, s conversion.Scope) error { + out.Type = apiregistration.APIServiceConditionType(in.Type) + out.Status = apiregistration.ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1_APIServiceCondition_To_apiregistration_APIServiceCondition is an autogenerated conversion function. +func Convert_v1_APIServiceCondition_To_apiregistration_APIServiceCondition(in *APIServiceCondition, out *apiregistration.APIServiceCondition, s conversion.Scope) error { + return autoConvert_v1_APIServiceCondition_To_apiregistration_APIServiceCondition(in, out, s) +} + +func autoConvert_apiregistration_APIServiceCondition_To_v1_APIServiceCondition(in *apiregistration.APIServiceCondition, out *APIServiceCondition, s conversion.Scope) error { + out.Type = APIServiceConditionType(in.Type) + out.Status = ConditionStatus(in.Status) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_apiregistration_APIServiceCondition_To_v1_APIServiceCondition is an autogenerated conversion function. +func Convert_apiregistration_APIServiceCondition_To_v1_APIServiceCondition(in *apiregistration.APIServiceCondition, out *APIServiceCondition, s conversion.Scope) error { + return autoConvert_apiregistration_APIServiceCondition_To_v1_APIServiceCondition(in, out, s) +} + +func autoConvert_v1_APIServiceList_To_apiregistration_APIServiceList(in *APIServiceList, out *apiregistration.APIServiceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]apiregistration.APIService, len(*in)) + for i := range *in { + if err := Convert_v1_APIService_To_apiregistration_APIService(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1_APIServiceList_To_apiregistration_APIServiceList is an autogenerated conversion function. +func Convert_v1_APIServiceList_To_apiregistration_APIServiceList(in *APIServiceList, out *apiregistration.APIServiceList, s conversion.Scope) error { + return autoConvert_v1_APIServiceList_To_apiregistration_APIServiceList(in, out, s) +} + +func autoConvert_apiregistration_APIServiceList_To_v1_APIServiceList(in *apiregistration.APIServiceList, out *APIServiceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]APIService, len(*in)) + for i := range *in { + if err := Convert_apiregistration_APIService_To_v1_APIService(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_apiregistration_APIServiceList_To_v1_APIServiceList is an autogenerated conversion function. +func Convert_apiregistration_APIServiceList_To_v1_APIServiceList(in *apiregistration.APIServiceList, out *APIServiceList, s conversion.Scope) error { + return autoConvert_apiregistration_APIServiceList_To_v1_APIServiceList(in, out, s) +} + +func autoConvert_v1_APIServiceSpec_To_apiregistration_APIServiceSpec(in *APIServiceSpec, out *apiregistration.APIServiceSpec, s conversion.Scope) error { + if in.Service != nil { + in, out := &in.Service, &out.Service + *out = new(apiregistration.ServiceReference) + if err := Convert_v1_ServiceReference_To_apiregistration_ServiceReference(*in, *out, s); err != nil { + return err + } + } else { + out.Service = nil + } + out.Group = in.Group + out.Version = in.Version + out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + out.GroupPriorityMinimum = in.GroupPriorityMinimum + out.VersionPriority = in.VersionPriority + return nil +} + +// Convert_v1_APIServiceSpec_To_apiregistration_APIServiceSpec is an autogenerated conversion function. +func Convert_v1_APIServiceSpec_To_apiregistration_APIServiceSpec(in *APIServiceSpec, out *apiregistration.APIServiceSpec, s conversion.Scope) error { + return autoConvert_v1_APIServiceSpec_To_apiregistration_APIServiceSpec(in, out, s) +} + +func autoConvert_apiregistration_APIServiceSpec_To_v1_APIServiceSpec(in *apiregistration.APIServiceSpec, out *APIServiceSpec, s conversion.Scope) error { + if in.Service != nil { + in, out := &in.Service, &out.Service + *out = new(ServiceReference) + if err := Convert_apiregistration_ServiceReference_To_v1_ServiceReference(*in, *out, s); err != nil { + return err + } + } else { + out.Service = nil + } + out.Group = in.Group + out.Version = in.Version + out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + out.GroupPriorityMinimum = in.GroupPriorityMinimum + out.VersionPriority = in.VersionPriority + return nil +} + +// Convert_apiregistration_APIServiceSpec_To_v1_APIServiceSpec is an autogenerated conversion function. +func Convert_apiregistration_APIServiceSpec_To_v1_APIServiceSpec(in *apiregistration.APIServiceSpec, out *APIServiceSpec, s conversion.Scope) error { + return autoConvert_apiregistration_APIServiceSpec_To_v1_APIServiceSpec(in, out, s) +} + +func autoConvert_v1_APIServiceStatus_To_apiregistration_APIServiceStatus(in *APIServiceStatus, out *apiregistration.APIServiceStatus, s conversion.Scope) error { + out.Conditions = *(*[]apiregistration.APIServiceCondition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1_APIServiceStatus_To_apiregistration_APIServiceStatus is an autogenerated conversion function. +func Convert_v1_APIServiceStatus_To_apiregistration_APIServiceStatus(in *APIServiceStatus, out *apiregistration.APIServiceStatus, s conversion.Scope) error { + return autoConvert_v1_APIServiceStatus_To_apiregistration_APIServiceStatus(in, out, s) +} + +func autoConvert_apiregistration_APIServiceStatus_To_v1_APIServiceStatus(in *apiregistration.APIServiceStatus, out *APIServiceStatus, s conversion.Scope) error { + out.Conditions = *(*[]APIServiceCondition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_apiregistration_APIServiceStatus_To_v1_APIServiceStatus is an autogenerated conversion function. +func Convert_apiregistration_APIServiceStatus_To_v1_APIServiceStatus(in *apiregistration.APIServiceStatus, out *APIServiceStatus, s conversion.Scope) error { + return autoConvert_apiregistration_APIServiceStatus_To_v1_APIServiceStatus(in, out, s) +} + +func autoConvert_v1_ServiceReference_To_apiregistration_ServiceReference(in *ServiceReference, out *apiregistration.ServiceReference, s conversion.Scope) error { + out.Namespace = in.Namespace + out.Name = in.Name + if err := metav1.Convert_Pointer_int32_To_int32(&in.Port, &out.Port, s); err != nil { + return err + } + return nil +} + +// Convert_v1_ServiceReference_To_apiregistration_ServiceReference is an autogenerated conversion function. +func Convert_v1_ServiceReference_To_apiregistration_ServiceReference(in *ServiceReference, out *apiregistration.ServiceReference, s conversion.Scope) error { + return autoConvert_v1_ServiceReference_To_apiregistration_ServiceReference(in, out, s) +} + +func autoConvert_apiregistration_ServiceReference_To_v1_ServiceReference(in *apiregistration.ServiceReference, out *ServiceReference, s conversion.Scope) error { + out.Namespace = in.Namespace + out.Name = in.Name + if err := metav1.Convert_int32_To_Pointer_int32(&in.Port, &out.Port, s); err != nil { + return err + } + return nil +} + +// Convert_apiregistration_ServiceReference_To_v1_ServiceReference is an autogenerated conversion function. +func Convert_apiregistration_ServiceReference_To_v1_ServiceReference(in *apiregistration.ServiceReference, out *ServiceReference, s conversion.Scope) error { + return autoConvert_apiregistration_ServiceReference_To_v1_ServiceReference(in, out, s) +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.deepcopy.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000..638877245 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.deepcopy.go @@ -0,0 +1,174 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIService) DeepCopyInto(out *APIService) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIService. +func (in *APIService) DeepCopy() *APIService { + if in == nil { + return nil + } + out := new(APIService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIService) 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 *APIServiceCondition) DeepCopyInto(out *APIServiceCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceCondition. +func (in *APIServiceCondition) DeepCopy() *APIServiceCondition { + if in == nil { + return nil + } + out := new(APIServiceCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceList) DeepCopyInto(out *APIServiceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]APIService, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceList. +func (in *APIServiceList) DeepCopy() *APIServiceList { + if in == nil { + return nil + } + out := new(APIServiceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIServiceList) 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 *APIServiceSpec) DeepCopyInto(out *APIServiceSpec) { + *out = *in + if in.Service != nil { + in, out := &in.Service, &out.Service + *out = new(ServiceReference) + (*in).DeepCopyInto(*out) + } + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceSpec. +func (in *APIServiceSpec) DeepCopy() *APIServiceSpec { + if in == nil { + return nil + } + out := new(APIServiceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceStatus) DeepCopyInto(out *APIServiceStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]APIServiceCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceStatus. +func (in *APIServiceStatus) DeepCopy() *APIServiceStatus { + if in == nil { + return nil + } + out := new(APIServiceStatus) + 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.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + return +} + +// 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 +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.defaults.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.defaults.go new file mode 100644 index 000000000..175637ca5 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.defaults.go @@ -0,0 +1,48 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&APIService{}, func(obj interface{}) { SetObjectDefaults_APIService(obj.(*APIService)) }) + scheme.AddTypeDefaultingFunc(&APIServiceList{}, func(obj interface{}) { SetObjectDefaults_APIServiceList(obj.(*APIServiceList)) }) + return nil +} + +func SetObjectDefaults_APIService(in *APIService) { + if in.Spec.Service != nil { + SetDefaults_ServiceReference(in.Spec.Service) + } +} + +func SetObjectDefaults_APIServiceList(in *APIServiceList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_APIService(a) + } +} diff --git a/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/zz_generated.deepcopy.go b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/zz_generated.deepcopy.go new file mode 100644 index 000000000..45d0347c0 --- /dev/null +++ b/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/zz_generated.deepcopy.go @@ -0,0 +1,221 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package apiregistration + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIService) DeepCopyInto(out *APIService) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIService. +func (in *APIService) DeepCopy() *APIService { + if in == nil { + return nil + } + out := new(APIService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIService) 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 *APIServiceCondition) DeepCopyInto(out *APIServiceCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceCondition. +func (in *APIServiceCondition) DeepCopy() *APIServiceCondition { + if in == nil { + return nil + } + out := new(APIServiceCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceList) DeepCopyInto(out *APIServiceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]APIService, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceList. +func (in *APIServiceList) DeepCopy() *APIServiceList { + if in == nil { + return nil + } + out := new(APIServiceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIServiceList) 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 *APIServiceSpec) DeepCopyInto(out *APIServiceSpec) { + *out = *in + if in.Service != nil { + in, out := &in.Service, &out.Service + *out = new(ServiceReference) + **out = **in + } + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceSpec. +func (in *APIServiceSpec) DeepCopy() *APIServiceSpec { + if in == nil { + return nil + } + out := new(APIServiceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceStatus) DeepCopyInto(out *APIServiceStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]APIServiceCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceStatus. +func (in *APIServiceStatus) DeepCopy() *APIServiceStatus { + if in == nil { + return nil + } + out := new(APIServiceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ByGroupPriorityMinimum) DeepCopyInto(out *ByGroupPriorityMinimum) { + { + in := &in + *out = make(ByGroupPriorityMinimum, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(APIService) + (*in).DeepCopyInto(*out) + } + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ByGroupPriorityMinimum. +func (in ByGroupPriorityMinimum) DeepCopy() ByGroupPriorityMinimum { + if in == nil { + return nil + } + out := new(ByGroupPriorityMinimum) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ByVersionPriority) DeepCopyInto(out *ByVersionPriority) { + { + in := &in + *out = make(ByVersionPriority, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(APIService) + (*in).DeepCopyInto(*out) + } + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ByVersionPriority. +func (in ByVersionPriority) DeepCopy() ByVersionPriority { + if in == nil { + return nil + } + out := new(ByVersionPriority) + 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 + return +} + +// 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 +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 9831d04d5..a2951879c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -284,6 +284,8 @@ github.com/pkg/errors ## explicit; go 1.22.0 github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1 +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1 +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1beta1 # github.com/prometheus/client_golang v1.18.0 ## explicit; go 1.19 github.com/prometheus/client_golang/prometheus @@ -1369,6 +1371,10 @@ k8s.io/kms/apis/v1beta1 k8s.io/kms/apis/v2 k8s.io/kms/pkg/service k8s.io/kms/pkg/util +# k8s.io/kube-aggregator v0.30.2 +## explicit; go 1.22.0 +k8s.io/kube-aggregator/pkg/apis/apiregistration +k8s.io/kube-aggregator/pkg/apis/apiregistration/v1 # k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b ## explicit; go 1.20 k8s.io/kube-openapi/pkg/builder