Skip to content

Commit

Permalink
fix: move prometheus install into make file to allow local integratio…
Browse files Browse the repository at this point in the history
…n tests

Signed-off-by: realanna <[email protected]>
  • Loading branch information
RealAnna committed Mar 23, 2023
1 parent 720e9e9 commit 8a1be3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
23 changes: 6 additions & 17 deletions .github/actions/deploy-prometheus-on-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,17 @@ runs:
using: "composite"
steps:
- name: Install and expose Prometheus
working-directory: ./test
shell: bash
run: |
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
kubectl apply --server-side -f ./prometheus/setup
kubectl wait --for=condition=Established --all CustomResourceDefinition --namespace=monitoring
kubectl apply -f ./prometheus/
kubectl wait --for=condition=available deployment/prometheus-operator -n monitoring --timeout=120s
kubectl wait --for=condition=available deployment/prometheus-adapter -n monitoring --timeout=120s
kubectl wait --for=condition=available deployment/kube-state-metrics -n monitoring --timeout=120s
kubectl wait pod/prometheus-k8s-0 --for=condition=ready --timeout=120s -n monitoring
kubectl -n monitoring port-forward svc/prometheus-k8s 9090 &
kubectl -n monitoring port-forward svc/node-exporter 9100 &
make install-prometheus
# wait for port 9090 to become available
while ! nc -vz localhost 9090 > /dev/null 2>&1 ; do
echo "Sleeping until port-forward for Prometheus at port 9090 is ready..."
sleep 5
echo "Sleeping until port-forward for Prometheus at port 9090 is ready..."
sleep 5
done
# wait until node exporter is available
while ! nc -vz localhost 9100 > /dev/null 2>&1 ; do
echo "Sleeping until port-forward for node exporter at port 9100 is ready..."
sleep 5
echo "Sleeping until port-forward for node exporter at port 9100 is ready..."
sleep 5
done
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ integration-test:
kubectl kuttl test --start-kind=false ./test/integration/ --config=kuttl-test.yaml

.PHONY: integration-test-local #these tests should run on a real cluster!
integration-test-local:
integration-test-local: install-prometheus
kubectl kuttl test --start-kind=false ./test/integration/ --config=kuttl-test-local.yaml

.PHONY: load-test
Expand All @@ -46,6 +46,20 @@ load-test:
kubectl apply -f ./test/load/assets/templates/provider.yaml
kube-burner init -c ./test/load/cfg.yml --metrics-profile ./test/load/metrics.yml

.PHONY: install-prometheus
install-prometheus:
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
kubectl apply --server-side -f test/prometheus/setup
kubectl wait --for=condition=Established --all CustomResourceDefinition --namespace=monitoring
kubectl apply -f test/prometheus/
kubectl wait --for=condition=available deployment/prometheus-operator -n monitoring --timeout=120s
kubectl wait --for=condition=available deployment/prometheus-adapter -n monitoring --timeout=120s
kubectl wait --for=condition=available deployment/kube-state-metrics -n monitoring --timeout=120s
kubectl wait pod/prometheus-k8s-0 --for=condition=ready --timeout=120s -n monitoring
kubectl -n monitoring port-forward svc/prometheus-k8s 9090 &
kubectl -n monitoring port-forward svc/node-exporter 9100 &


.PHONY: cleanup-manifests
cleanup-manifests:
rm -rf manifests
Expand All @@ -68,7 +82,6 @@ helm-package:
$(MAKE) build-release-manifests CHART_APPVERSION=$(CHART_APPVERSION) RELEASE_REGISTRY=$(RELEASE_REGISTRY)
$(MAKE) release-helm-manifests CHART_APPVERSION=$(CHART_APPVERSION) RELEASE_REGISTRY=$(RELEASE_REGISTRY)


.PHONY: build-release-manifests
build-release-manifests:
$(MAKE) -C operator generate
Expand Down

0 comments on commit 8a1be3c

Please sign in to comment.