Skip to content

Commit

Permalink
Merge pull request #149 from linkernetworks/phstsai/VX-202
Browse files Browse the repository at this point in the history
[Bug] VX-202: Change prometheus's service account to vortex-admin

Former-commit-id: 9da5ebdee7e333db8a447368331380276ff7291d [formerly 9bd66f4]
Former-commit-id: b0e968db57ac380ca4508a5c55ea60f7b36d7dd8
  • Loading branch information
John-Lin authored Jul 24, 2018
2 parents 0349820 + 4aba3c3 commit 7f083f7
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 29 deletions.
1 change: 0 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
}
sh "make apps.init-helm 2>&1 | tee >(go-junit-report > report.xml)"
sh "JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lname=tiller -o jsonpath=\"\$JSONPATH\" 2>&1 | grep -q \"Ready=True\"; do sleep 1; echo \"wait the tiller to be available\"; done"

sh "make apps.launch-apps 2>&1 | tee >(go-junit-report > report.xml)"
sh "until curl --connect-timeout 1 -sL -w \"%{http_code}\\n\" http://`kubectl get service -n vortex prometheus -o jsonpath=\"{.spec.clusterIP}\"`:9090/api/v1/query?query=prometheus_build_info -o /dev/null | grep 200; do sleep 1; echo \"wait the prometheus to be available\"; kubectl get pods --all-namespaces; done"

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ apps.init-helm:

.PHONY: apps.launch-apps
apps.launch-apps:
helm install --debug --wait --set global.environment=testing deploy/helm/foundation
helm install --debug --wait --set global.environment=testing deploy/helm/apps/charts/prometheus
helm install --debug --wait --set global.environment=testing deploy/helm/apps/charts/vortex-server
helm install --name foundation --debug --wait --set global.environment=local deploy/helm/foundation
helm install --name prometheus --debug --wait --set global.environment=local deploy/helm/apps/charts/prometheus
helm install --name vortex-server --debug --wait --set global.environment=local deploy/helm/apps/charts/vortex-server

.PHONY: apps.teardown
apps.teardown:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
annotations:
prometheus.io/scrape: 'true'
spec:
serviceAccountName: prometheus
containers:
- name: cadvisor
image: google/cadvisor:latest
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ metadata:
spec:
selector:
matchLabels:
k8s-app: kube-state-metrics
app: kube-state-metrics
replicas: 1
template:
metadata:
labels:
k8s-app: kube-state-metrics
app: kube-state-metrics
spec:
serviceAccountName: default
serviceAccountName: prometheus
containers:
- name: kube-state-metrics
image: sdnvortex/kube-state-metrics:{{ .Values.image.tag }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: kube-state-metrics
namespace: vortex
labels:
k8s-app: kube-state-metrics
app: kube-state-metrics
annotations:
prometheus.io/scrape: 'true'
spec:
Expand All @@ -14,5 +14,5 @@ spec:
targetPort: http-metrics
protocol: TCP
selector:
k8s-app: kube-state-metrics
app: kube-state-metrics

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
image:
tag: develop
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spec:
prometheus.io/scrape: 'true'
spec:
hostPID: true
serviceAccountName: prometheus
containers:
- name: node-exporter
image: sdnvortex/node-exporter:{{ .Values.image.tag }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
image:
tag: develop
tag: latest
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
labels:
app: prometheus
spec:
serviceAccountName: prometheus
containers:
- image: prom/prometheus:v2.2.1
name: prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1
# kubernetes versions before 1.8.0 should use rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: kube-state-metrics
name: prometheus
rules:
- apiGroups: [""]
resources:
Expand Down Expand Up @@ -38,3 +38,19 @@ rules:
resources:
- horizontalpodautoscalers
verbs: ["list", "watch"]

---

apiVersion: rbac.authorization.k8s.io/v1
# kubernetes versions before 1.8.0 should use rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: prometheus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus
subjects:
- kind: ServiceAccount
name: prometheus
namespace: vortex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus
namespace: vortex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: vortex-admin
namespace: vortex
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ spec:
labels:
app: prometheus
spec:
initContainers:
- name: init-kube-state-metrics
image: busybox
command: ["sh", "-c", "until nslookup kube-state-metrics.monitoring.svc.cluster.local; do echo waiting for kube-state-metrics; sleep 2; done;"]
serviceAccountName: vortex-admin
containers:
- image: prom/prometheus:v2.2.1
name: prometheus
Expand Down

0 comments on commit 7f083f7

Please sign in to comment.