1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-16 09:16:38 +00:00
prometheus-operator/hack/controller-external.sh
Fabian Reinartz 4b4191d060 Initial commit.
Adds a basic controller that creates a client and connects to
a Kubernetes cluster from within or external.
2016-09-21 13:48:13 +02:00

13 lines
565 B
Bash
Executable file

#!/bin/sh
if [[ -z "$1" ]]; then
echo "missing cluster name"
exit 1
fi
apiserver=$(kubectl config view -o jsonpath="{.clusters[?(@.name == \"$1\")].cluster.server}")
cafile=$(kubectl config view -o jsonpath="{.clusters[?(@.name == \"$1\")].cluster.certificate-authority}")
certfile=$(kubectl config view -o jsonpath="{.users[?(@.name == \"$1\")].user.client-certificate}")
keyfile=$(kubectl config view -o jsonpath="{.users[?(@.name == \"$1\")].user.client-key}")
./controller --apiserver=$apiserver --ca-file=$cafile --cert-file=$certfile --key-file=$keyfile