custom alerting

Signed-off-by: junotx <junotx@126.com>
This commit is contained in:
junotx
2020-11-24 17:56:26 +08:00
parent 242193ddb0
commit 371c9b187d
342 changed files with 64021 additions and 1934 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package k8s
import (
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
snapshotclient "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned"
istioclient "istio.io/client-go/pkg/clientset/versioned"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
@@ -35,6 +36,7 @@ type Client interface {
Snapshot() snapshotclient.Interface
ApiExtensions() apiextensionsclient.Interface
Discovery() discovery.DiscoveryInterface
Prometheus() promresourcesclient.Interface
Master() string
Config() *rest.Config
}
@@ -55,6 +57,8 @@ type kubernetesClient struct {
apiextensions apiextensionsclient.Interface
prometheus promresourcesclient.Interface
master string
config *rest.Config
@@ -77,6 +81,7 @@ func NewKubernetesClientOrDie(options *KubernetesOptions) Client {
istio: istioclient.NewForConfigOrDie(config),
snapshot: snapshotclient.NewForConfigOrDie(config),
apiextensions: apiextensionsclient.NewForConfigOrDie(config),
prometheus: promresourcesclient.NewForConfigOrDie(config),
master: config.Host,
config: config,
}
@@ -135,6 +140,11 @@ func NewKubernetesClient(options *KubernetesOptions) (Client, error) {
return nil, err
}
k.prometheus, err = promresourcesclient.NewForConfig(config)
if err != nil {
return nil, err
}
k.master = options.Master
k.config = config
@@ -165,6 +175,10 @@ func (k *kubernetesClient) ApiExtensions() apiextensionsclient.Interface {
return k.apiextensions
}
func (k *kubernetesClient) Prometheus() promresourcesclient.Interface {
return k.prometheus
}
// master address used to generate kubeconfig for downloading
func (k *kubernetesClient) Master() string {
return k.master