Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a minimal prometheus server manifest #4687

Merged
merged 5 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ LOG_LEVEL := debug
UPPERIO_DB_DEBUG := 0
NAMESPACED := true

ifeq ($(PROFILE),prometheus)
RUN_MODE := kubernetes
simster7 marked this conversation as resolved.
Show resolved Hide resolved
endif
alexec marked this conversation as resolved.
Show resolved Hide resolved

ALWAYS_OFFLOAD_NODE_STATUS := false
ifeq ($(PROFILE),mysql)
ALWAYS_OFFLOAD_NODE_STATUS := true
Expand Down Expand Up @@ -430,7 +434,16 @@ ifeq ($(RUN_MODE),kubernetes)
kubectl -n $(KUBE_NAMESPACE) scale deploy/workflow-controller --replicas 1
kubectl -n $(KUBE_NAMESPACE) scale deploy/argo-server --replicas 1
endif
kubectl -n $(KUBE_NAMESPACE) wait --for=condition=Ready pod --all -l app --timeout 2m
ifeq ($(PROFILE),prometheus)
kubectl -n $(KUBE_NAMESPACE) scale deploy/prometheus --replicas 1
endif
ifeq ($(RUN_MODE),kubernetes)
kubectl -n $(KUBE_NAMESPACE) wait --for=condition=Ready pod --all -l app=argo-server --timeout 1m || true
simster7 marked this conversation as resolved.
Show resolved Hide resolved
kubectl -n $(KUBE_NAMESPACE) wait --for=condition=Ready pod --all -l app=workflow-controller --timeout 1m || true
endif
ifeq ($(PROFILE),prometheus)
kubectl -n $(KUBE_NAMESPACE) wait --for=condition=Ready pod --all -l app=prometheus --timeout 1m || true
endif
./hack/port-forward.sh
# Check dex, minio, postgres and mysql are in hosts file
ifeq ($(AUTH_MODE),sso)
Expand Down
7 changes: 6 additions & 1 deletion hack/port-forward.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ pf() {
name=$1
resource=$2
port=$3
dest_port=${4:-"$port"}
pid=$(lsof -i ":$port" | grep -v PID | awk '{print $2}' || true)
if [ "$pid" != "" ]; then
kill $pid
fi
kubectl -n argo port-forward "$resource" "$port:$port" > /dev/null &
kubectl -n argo port-forward "$resource" "$port:$dest_port" > /dev/null &
# wait until port forward is established
until lsof -i ":$port" > /dev/null ; do sleep 1s ; done
info "$name on http://localhost:$port"
Expand Down Expand Up @@ -44,3 +45,7 @@ fi
if [[ "$(kubectl -n argo get pod -l app=workflow-controller -o name)" != "" ]]; then
pf "Workflow Controller" deploy/workflow-controller 9090
fi

if [[ "$(kubectl -n argo get pod -l app=prometheus -o name)" != "" ]]; then
pf "Prometheus Server" deploy/prometheus 9091 9090
fi
2 changes: 1 addition & 1 deletion manifests/quick-start/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ resources:

patchesStrategicMerge:
- overlays/workflow-controller-configmap.yaml
- overlays/argo-server-deployment.yaml
- overlays/argo-server-deployment.yaml
6 changes: 6 additions & 0 deletions manifests/quick-start/base/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
simster7 marked this conversation as resolved.
Show resolved Hide resolved
- prometheus-deployment.yaml
- prometheus-config-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config
data:
prometheus.yaml: |
global:
scrape_interval: 15s
simster7 marked this conversation as resolved.
Show resolved Hide resolved
scrape_configs:
- job_name: 'argo'
static_configs:
- targets: ['workflow-controller-metrics:9090']
37 changes: 37 additions & 0 deletions manifests/quick-start/base/prometheus/prometheus-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This manifests creates a minimal Prometheus server to scrape and display the metrics emitted by the workflow
# controller. To open this server, create an external IP for the prometheus service or use kubectl port-forward,
# then open:
#
# localhost:9091/graph
#
# Note: this assumes the workflow-controller is emitting metrics in the default port (9090). This will need to
# be modified if the default is overriden.
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
name: prometheus
spec:
containers:
- name: prometheus
image: prom/prometheus
args:
- --config.file=/config/prometheus.yaml
volumeMounts:
- name: config
mountPath: /config
volumes:
- name: config
configMap:
name: prometheus-config


6 changes: 6 additions & 0 deletions test/e2e/manifests/mixins/prometheus-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus
spec:
replicas: 0
simster7 marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 16 additions & 0 deletions test/e2e/manifests/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/quick-start/minimal
- ../../../../manifests/quick-start/base/prometheus

patchesStrategicMerge:
- ../mixins/argo-server-deployment.yaml
- ../mixins/workflow-controller-configmap.yaml
- ../mixins/workflow-controller-deployment.yaml
- ../mixins/cluster-workflow-template-rbac.yaml
- ../mixins/prometheus-deployment.yaml

commonLabels:
"app.kubernetes.io/part-of": "argo"