diff --git a/Jenkinsfile b/Jenkinsfile index 521f1d3e..5b57c006 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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" diff --git a/Makefile b/Makefile index 76768663..73dbc60d 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/deploy/helm/apps/charts/prometheus/charts/cadvisor/templates/cadvisor.yaml b/deploy/helm/apps/charts/prometheus/charts/cadvisor/templates/cadvisor.yaml index 8b05119e..7d6b0ef7 100644 --- a/deploy/helm/apps/charts/prometheus/charts/cadvisor/templates/cadvisor.yaml +++ b/deploy/helm/apps/charts/prometheus/charts/cadvisor/templates/cadvisor.yaml @@ -14,6 +14,7 @@ spec: annotations: prometheus.io/scrape: 'true' spec: + serviceAccountName: prometheus containers: - name: cadvisor image: google/cadvisor:latest diff --git a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-cluster-role-binding.yaml b/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-cluster-role-binding.yaml deleted file mode 100644 index fe03c681..00000000 --- a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-cluster-role-binding.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -# kubernetes versions before 1.8.0 should use rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: kube-state-metrics -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: kube-state-metrics -subjects: -- kind: ServiceAccount - name: default - namespace: vortex - diff --git a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-deployment.yaml b/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-deployment.yaml index 758e6e95..e856e239 100644 --- a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-deployment.yaml +++ b/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-deployment.yaml @@ -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 }} diff --git a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-service.yaml b/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-service.yaml index 2c1c65b3..6b642862 100644 --- a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-service.yaml +++ b/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-service.yaml @@ -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: @@ -14,5 +14,5 @@ spec: targetPort: http-metrics protocol: TCP selector: - k8s-app: kube-state-metrics + app: kube-state-metrics diff --git a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/values.yaml b/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/values.yaml index e69de29b..1c0fb65c 100644 --- a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/values.yaml +++ b/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/values.yaml @@ -0,0 +1,2 @@ +image: + tag: develop \ No newline at end of file diff --git a/deploy/helm/apps/charts/prometheus/charts/node-exporter/templates/node-exporter.yaml b/deploy/helm/apps/charts/prometheus/charts/node-exporter/templates/node-exporter.yaml index 271787ae..05292a4e 100644 --- a/deploy/helm/apps/charts/prometheus/charts/node-exporter/templates/node-exporter.yaml +++ b/deploy/helm/apps/charts/prometheus/charts/node-exporter/templates/node-exporter.yaml @@ -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 }} diff --git a/deploy/helm/apps/charts/prometheus/charts/node-exporter/values.yaml b/deploy/helm/apps/charts/prometheus/charts/node-exporter/values.yaml index 1c0fb65c..39afc69d 100644 --- a/deploy/helm/apps/charts/prometheus/charts/node-exporter/values.yaml +++ b/deploy/helm/apps/charts/prometheus/charts/node-exporter/values.yaml @@ -1,2 +1,2 @@ image: - tag: develop \ No newline at end of file + tag: latest \ No newline at end of file diff --git a/deploy/helm/apps/charts/prometheus/templates/prometheus-config.yaml b/deploy/helm/apps/charts/prometheus/templates/config.yaml similarity index 100% rename from deploy/helm/apps/charts/prometheus/templates/prometheus-config.yaml rename to deploy/helm/apps/charts/prometheus/templates/config.yaml diff --git a/deploy/helm/apps/charts/prometheus/templates/prometheus-deployment.yaml b/deploy/helm/apps/charts/prometheus/templates/deployment.yaml similarity index 96% rename from deploy/helm/apps/charts/prometheus/templates/prometheus-deployment.yaml rename to deploy/helm/apps/charts/prometheus/templates/deployment.yaml index 995e01b2..8f72a17d 100644 --- a/deploy/helm/apps/charts/prometheus/templates/prometheus-deployment.yaml +++ b/deploy/helm/apps/charts/prometheus/templates/deployment.yaml @@ -12,6 +12,7 @@ spec: labels: app: prometheus spec: + serviceAccountName: prometheus containers: - image: prom/prometheus:v2.2.1 name: prometheus diff --git a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-cluster-role.yaml b/deploy/helm/apps/charts/prometheus/templates/role.yaml similarity index 68% rename from deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-cluster-role.yaml rename to deploy/helm/apps/charts/prometheus/templates/role.yaml index f9dbb969..941a0673 100644 --- a/deploy/helm/apps/charts/prometheus/charts/kube-state-metrics/templates/kube-state-metrics-cluster-role.yaml +++ b/deploy/helm/apps/charts/prometheus/templates/role.yaml @@ -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: @@ -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 \ No newline at end of file diff --git a/deploy/helm/apps/charts/prometheus/templates/prometheus-svc.yaml b/deploy/helm/apps/charts/prometheus/templates/service.yaml similarity index 100% rename from deploy/helm/apps/charts/prometheus/templates/prometheus-svc.yaml rename to deploy/helm/apps/charts/prometheus/templates/service.yaml diff --git a/deploy/helm/apps/charts/prometheus/templates/serviceaccount.yaml b/deploy/helm/apps/charts/prometheus/templates/serviceaccount.yaml new file mode 100644 index 00000000..ceea8ab9 --- /dev/null +++ b/deploy/helm/apps/charts/prometheus/templates/serviceaccount.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: prometheus + namespace: vortex diff --git a/deploy/helm/foundation/charts/rbac/templates/rbac.yaml b/deploy/helm/foundation/charts/rbac/templates/role.yaml similarity index 100% rename from deploy/helm/foundation/charts/rbac/templates/rbac.yaml rename to deploy/helm/foundation/charts/rbac/templates/role.yaml diff --git a/deploy/helm/foundation/charts/rbac/templates/serviceaccount.yaml b/deploy/helm/foundation/charts/rbac/templates/serviceaccount.yaml new file mode 100644 index 00000000..46b13527 --- /dev/null +++ b/deploy/helm/foundation/charts/rbac/templates/serviceaccount.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: vortex-admin + namespace: vortex diff --git a/deploy/kubernetes/apps/monitoring/prometheus/prometheus-deployment.yaml b/deploy/kubernetes/apps/monitoring/prometheus/prometheus-deployment.yaml index 492ac184..47ffd215 100644 --- a/deploy/kubernetes/apps/monitoring/prometheus/prometheus-deployment.yaml +++ b/deploy/kubernetes/apps/monitoring/prometheus/prometheus-deployment.yaml @@ -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