hack/*: use kubectl apply where possible

There is an issue with kubectl apply and third party resources, so for
the time being we use create for TPRs, but apply for all manifests that
it can handle.
This commit is contained in:
Frederic Branczyk
2017-01-03 11:33:42 +01:00
parent 0efaf385eb
commit 9e319acaa9
5 changed files with 26 additions and 7 deletions

View File

@@ -14,14 +14,26 @@ kctl() {
kubectl --namespace "$NAMESPACE" "$@"
}
kctl create -f manifests/prometheus-operator.yaml
kctl apply -f manifests/prometheus-operator.yaml
# Wait for TPRs to be ready.
until kctl get servicemonitor; do sleep 1; done
until kctl get prometheus; do sleep 1; done
until kctl get alertmanager; do sleep 1; done
kctl create -f manifests/exporters
kctl create -f manifests/grafana
kctl create -f manifests/prometheus
kctl create -f manifests/alertmanager
kctl apply -f manifests/exporters
kctl apply -f manifests/grafana
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
kctl delete -f manifests/prometheus-operator.yaml

View File

@@ -4,4 +4,8 @@ if [ -z "${KUBECONFIG}" ]; then
KUBECONFIG=~/.kube/config
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

@@ -5,3 +5,4 @@ if [ -z "${KUBECONFIG}" ]; then
fi
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
kubectl create configmap --dry-run=true grafana-dashboards --from-file=assets/grafana/ -oyaml > manifests/grafana/grafana-cm.yaml