Merge pull request #27 from brancz/kubectl-apply

hack/*: use kubectl apply where possible
This commit is contained in:
Frederic Branczyk
2017-01-03 13:30:15 +01:00
committed by GitHub
5 changed files with 26 additions and 7 deletions

View File

@@ -14,14 +14,26 @@ kctl() {
kubectl --namespace "$NAMESPACE" "$@" kubectl --namespace "$NAMESPACE" "$@"
} }
kctl create -f manifests/prometheus-operator.yaml kctl apply -f manifests/prometheus-operator.yaml
# Wait for TPRs to be ready. # Wait for TPRs to be ready.
until kctl get servicemonitor; do sleep 1; done until kctl get servicemonitor; do sleep 1; done
until kctl get prometheus; do sleep 1; done until kctl get prometheus; do sleep 1; done
until kctl get alertmanager; do sleep 1; done until kctl get alertmanager; do sleep 1; done
kctl create -f manifests/exporters kctl apply -f manifests/exporters
kctl create -f manifests/grafana kctl apply -f manifests/grafana
kctl create -f manifests/prometheus
kctl create -f manifests/alertmanager kctl apply -f manifests/prometheus/prometheus-k8s-cm.yaml
kctl apply -f manifests/prometheus/prometheus-k8s-rules.yaml
kctl apply -f manifests/prometheus/prometheus-k8s-svc.yaml
kctl apply -f manifests/alertmanager/alertmanager-config.yaml
kctl apply -f manifests/alertmanager/alertmanager-service.yaml
# `kubectl apply` is currently not working for third party resources so we are
# using `kubectl create` here for the time being.
# (https://github.com/kubernetes/kubernetes/issues/29542)
kctl create -f manifests/prometheus/prometheus-k8s.yaml
kctl create -f manifests/alertmanager/alertmanager.yaml

View File

@@ -21,3 +21,4 @@ kctl delete -f manifests/alertmanager
sleep 5 sleep 5
kctl delete -f manifests/prometheus-operator.yaml kctl delete -f manifests/prometheus-operator.yaml

View File

@@ -4,4 +4,8 @@ if [ -z "${KUBECONFIG}" ]; then
KUBECONFIG=~/.kube/config KUBECONFIG=~/.kube/config
fi fi
kubectl --kubeconfig="$KUBECONFIG" create -f manifests/examples/example-app kubectl --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/prometheus-frontend-svc.yaml
kubectl --kubeconfig="$KUBECONFIG" apply -f manifests/examples/example-app/example-app.yaml
kubectl --kubeconfig="$KUBECONFIG" create -f manifests/examples/example-app/prometheus-frontend.yaml
kubectl --kubeconfig="$KUBECONFIG" create -f manifests/examples/example-app/servicemonitor-frontend.yaml

View File

@@ -4,4 +4,5 @@ if [ -z "${KUBECONFIG}" ]; then
KUBECONFIG=~/.kube/config KUBECONFIG=~/.kube/config
fi fi
kubectl --kubeconfig="$KUBECONFIG" delete -f manifests/examples/example-app kubectl --kubeconfig="$KUBECONFIG" delete -f manifests/examples/example-app

View File

@@ -8,3 +8,4 @@ kubectl create configmap --dry-run=true prometheus-k8s-rules --from-file=assets/
# Generate Dashboard ConfigMap # Generate Dashboard ConfigMap
kubectl create configmap --dry-run=true grafana-dashboards --from-file=assets/grafana/ -oyaml > manifests/grafana/grafana-cm.yaml kubectl create configmap --dry-run=true grafana-dashboards --from-file=assets/grafana/ -oyaml > manifests/grafana/grafana-cm.yaml