-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58e91e6
commit 3cafd5f
Showing
18 changed files
with
2,278 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
||
ovn "github.com/alauda/kube-ovn/pkg/ovnmonitor" | ||
"github.com/prometheus/client_golang/prometheus/promhttp" | ||
"k8s.io/klog" | ||
) | ||
|
||
func main() { | ||
config, err := ovn.ParseFlags() | ||
if err != nil { | ||
klog.Fatalf("parse config failed %v", err) | ||
} | ||
|
||
exporter := ovn.NewExporter(config) | ||
if err = exporter.StartConnection(); err != nil { | ||
klog.Errorf("%s failed to connect db socket properly: %s", ovn.GetExporterName(), err) | ||
go exporter.TryClientConnection() | ||
} | ||
exporter.StartOvnMetrics() | ||
|
||
http.Handle(config.MetricsPath, promhttp.Handler()) | ||
klog.Infoln("Listening on", config.ListenAddress) | ||
klog.Fatal(http.ListenAndServe(config.ListenAddress, nil)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
ENABLE_SSL=${ENABLE_SSL:-false} | ||
|
||
if [[ "$ENABLE_SSL" == "false" ]]; then | ||
export OVN_NB_DAEMON=$(ovn-nbctl --db=tcp:["${OVN_NB_SERVICE_HOST}"]:"${OVN_NB_SERVICE_PORT}" --pidfile --detach --overwrite-pidfile) | ||
else | ||
export OVN_NB_DAEMON=$(ovn-nbctl -p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert --db=ssl:["${OVN_NB_SERVICE_HOST}"]:"${OVN_NB_SERVICE_PORT}" --pidfile --detach --overwrite-pidfile) | ||
fi | ||
|
||
exec ./kube-ovn-monitor $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: kube-ovn-monitor | ||
namespace: monitoring | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 15s | ||
port: metrics | ||
namespaceSelector: | ||
matchNames: | ||
- kube-system | ||
selector: | ||
matchLabels: | ||
app: kube-ovn-monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.