From 3e8e7e40ec5b19a2cd15840f2f0ec76d13ea43a0 Mon Sep 17 00:00:00 2001 From: Arsham Teymouri Date: Mon, 16 Aug 2021 09:46:27 +0300 Subject: [PATCH 1/4] adding servicemonitor for the core service changing the ci to trigger automatically --- .gitlab-ci.yml | 8 +++--- helm/templates/.core-service.yaml.swp | Bin 0 -> 12288 bytes helm/templates/core-deployment.yaml | 1 + helm/templates/core-servicemonitor.yaml | 32 ++++++++++++++++++++++++ helm/templates/frontend-deployment.yaml | 1 + helm/templates/shard-deployment.yaml | 1 + helm/values.yaml | 20 ++++++++++++++- 7 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 helm/templates/.core-service.yaml.swp create mode 100644 helm/templates/core-servicemonitor.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0840b6c..47d11a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ stages: image: quay.io/buildah/stable rules: - if: '$CI_COMMIT_BRANCH == "master"' - # when: manual # uncomment this line if we want to make this step a manual process + when: always tags: - kubernetes-parity-build @@ -33,7 +33,7 @@ stages: - |- sed -i "s/appVersion:.*/appVersion: $KUBERNETES_VERSION_TAG/" ./helm/Chart.yaml # validate the chart - - helm --debug template + - helm template --create-namespace --namespace $KUBE_NAMESPACE --set image.backend.repository="${CONTAINER_REGISTRY}/${BACKEND_CONTAINER_REPO}" @@ -42,7 +42,7 @@ stages: --set image.frontend.tag="${CI_COMMIT_SHORT_SHA}" $KUBE_NAMESPACE ./helm/ # install the chart into the relevant cluster - - helm --debug upgrade + - helm upgrade --install --atomic --timeout 120s @@ -55,7 +55,7 @@ stages: $KUBE_NAMESPACE ./helm/ rules: - if: '$CI_COMMIT_BRANCH == "master"' - # when: manual # uncomment this line if we want to make this step a manual process + when: on-success tags: - kubernetes-parity-build diff --git a/helm/templates/.core-service.yaml.swp b/helm/templates/.core-service.yaml.swp new file mode 100644 index 0000000000000000000000000000000000000000..5e26db17a59da172992071025846703c4e1e89e3 GIT binary patch literal 12288 zcmeI2v2GMG5QcqJGzo~%P%#|!?k0f(Z3z_;i6Q|fAt52(p2e-QYg@MO&~b!35HCPO zlb47nNRXgMNR$+e@dhHuU4tk!bLaD8xhi*Dtcg2zQ6K7F|&kKbGt zAFuX=bbc(`XjndypOvl-vph}N)aq`T*QPuEGC3B{jNA2AR;uump$|?5l?BzPRs}aJ z#;R$HpjzATzAq}{ROXeN)|JXPC2dbD2eU!%244;MLN9|S-E z1V8`;KmY_l00cnbKO_)rPwex(&UJTN>*n4sbN7e|1V8`;KmY_l00ck)1V8`;KmY_l z;2$I)M?y?jgg9cw|Nkf7|DP`i@qzW0b-;Sfdd_;x+G4G;&a>XH3USDK#qz8ttZmk9 z*4HlXyBHe-1V8`;KmY_l00ck)1V8`;K;SPDARa$DtFy|q)@Y?eNwKS1MC*K>QLU?H zGE&q(qa8c<+?ZVjX6CoVb+VBNA!Zs*=Vb*lxo*6HH~A zk{;aI>GpzjPgU44j;oo^DIdsYqCBTdo!+s){HIS!M3j+TdLmkrZ(R9UQJ7h-W?>4p z#sl7}D%Br}1oMbH&Cf1MYHflHwbA}}6sL?S+8@$y7E@2Am?iN(orzyAH`B|J46+ov W{I*KEpTG)f>w$8f%P(oVA-(};9Q_FZ literal 0 HcmV?d00001 diff --git a/helm/templates/core-deployment.yaml b/helm/templates/core-deployment.yaml index f283856..82da1a6 100644 --- a/helm/templates/core-deployment.yaml +++ b/helm/templates/core-deployment.yaml @@ -12,6 +12,7 @@ spec: selector: matchLabels: {{- include "substrate-telemetry.selectorLabels" . | nindent 6 }} + telemetry-component: core template: metadata: {{- with .Values.podAnnotations }} diff --git a/helm/templates/core-servicemonitor.yaml b/helm/templates/core-servicemonitor.yaml new file mode 100644 index 0000000..4ae1955 --- /dev/null +++ b/helm/templates/core-servicemonitor.yaml @@ -0,0 +1,32 @@ +{{- if .Values.serviceMonitor.core.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: telemetry-core + labels: + {{- include "substrate-telemetry.labels" . | nindent 4 }} + telemetry-component: core + {{- if .Values.serviceMonitor.core.additionalLabels }} +{{ toYaml .Values.serviceMonitor.core.additionalLabels | indent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.core.annotations }} + annotations: +{{ toYaml .Values.serviceMonitor.core.annotations | indent 4 }} + {{- end }} +spec: + selector: + matchLabels: + {{- include "substrate-telemetry.selectorLabels" . | nindent 6 }} + telemetry-component: core + namespaceSelector: + matchNames: + - {{ .Release.Namespace | quote }} + endpoints: + - port: http + {{- if .Values.serviceMonitor.core.interval }} + interval: {{ .Values.serviceMonitor.core.interval }} + {{- end }} + {{- if .Values.serviceMonitor.core.scrapeTimeout }} + scrapeTimeout: {{ .Values.serviceMonitor.core.scrapeTimeout }} + {{- end }} +{{- end }} diff --git a/helm/templates/frontend-deployment.yaml b/helm/templates/frontend-deployment.yaml index 8bb737f..128d3ec 100644 --- a/helm/templates/frontend-deployment.yaml +++ b/helm/templates/frontend-deployment.yaml @@ -12,6 +12,7 @@ spec: selector: matchLabels: {{- include "substrate-telemetry.selectorLabels" . | nindent 6 }} + telemetry-component: frontend template: metadata: {{- with .Values.podAnnotations }} diff --git a/helm/templates/shard-deployment.yaml b/helm/templates/shard-deployment.yaml index c5a7e66..8803635 100644 --- a/helm/templates/shard-deployment.yaml +++ b/helm/templates/shard-deployment.yaml @@ -12,6 +12,7 @@ spec: selector: matchLabels: {{- include "substrate-telemetry.selectorLabels" . | nindent 6 }} + telemetry-component: shard template: metadata: {{- with .Values.podAnnotations }} diff --git a/helm/values.yaml b/helm/values.yaml index fcd55ed..21b4731 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -28,7 +28,25 @@ envVars: core: {} frontend: {} - +serviceMonitor: + shard: + enabled: false + interval: "" + additionalLabels: {} + annotations: {} + # scrapeTimeout: 10s + core: + enabled: true + interval: "" + additionalLabels: {} + annotations: {} + # scrapeTimeout: 10s + frontend: + enabled: false + interval: "" + additionalLabels: {} + annotations: {} + # scrapeTimeout: 10s serviceAccount: # Specifies whether a service account should be created From 1a16f06df0f5bb43e64cb3d9749a37aa4b42d72f Mon Sep 17 00:00:00 2001 From: Arsham Teymouri Date: Mon, 16 Aug 2021 16:42:33 +0300 Subject: [PATCH 2/4] tweaking nginx conf --- helm/templates/frontend-nginx-configmap.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/helm/templates/frontend-nginx-configmap.yaml b/helm/templates/frontend-nginx-configmap.yaml index 15dbb01..7ae74dd 100644 --- a/helm/templates/frontend-nginx-configmap.yaml +++ b/helm/templates/frontend-nginx-configmap.yaml @@ -33,9 +33,5 @@ data: index index.html; listen 8000; server_name _; - - location = /favicon.ico { - return 204; - } } } From a620b8eb5dcc4dff4e299c25d10287142c59712f Mon Sep 17 00:00:00 2001 From: Arsham Teymouri Date: Mon, 16 Aug 2021 17:16:23 +0300 Subject: [PATCH 3/4] remove swp file --- helm/templates/.core-service.yaml.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 helm/templates/.core-service.yaml.swp diff --git a/helm/templates/.core-service.yaml.swp b/helm/templates/.core-service.yaml.swp deleted file mode 100644 index 5e26db17a59da172992071025846703c4e1e89e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2v2GMG5QcqJGzo~%P%#|!?k0f(Z3z_;i6Q|fAt52(p2e-QYg@MO&~b!35HCPO zlb47nNRXgMNR$+e@dhHuU4tk!bLaD8xhi*Dtcg2zQ6K7F|&kKbGt zAFuX=bbc(`XjndypOvl-vph}N)aq`T*QPuEGC3B{jNA2AR;uump$|?5l?BzPRs}aJ z#;R$HpjzATzAq}{ROXeN)|JXPC2dbD2eU!%244;MLN9|S-E z1V8`;KmY_l00cnbKO_)rPwex(&UJTN>*n4sbN7e|1V8`;KmY_l00ck)1V8`;KmY_l z;2$I)M?y?jgg9cw|Nkf7|DP`i@qzW0b-;Sfdd_;x+G4G;&a>XH3USDK#qz8ttZmk9 z*4HlXyBHe-1V8`;KmY_l00ck)1V8`;K;SPDARa$DtFy|q)@Y?eNwKS1MC*K>QLU?H zGE&q(qa8c<+?ZVjX6CoVb+VBNA!Zs*=Vb*lxo*6HH~A zk{;aI>GpzjPgU44j;oo^DIdsYqCBTdo!+s){HIS!M3j+TdLmkrZ(R9UQJ7h-W?>4p z#sl7}D%Br}1oMbH&Cf1MYHflHwbA}}6sL?S+8@$y7E@2Am?iN(orzyAH`B|J46+ov W{I*KEpTG)f>w$8f%P(oVA-(};9Q_FZ From 0b4ca0903f5fa3db354fc510be7c1c736f915d70 Mon Sep 17 00:00:00 2001 From: Arsham Teymouri Date: Mon, 16 Aug 2021 17:40:43 +0300 Subject: [PATCH 4/4] remove nginx configs as they are copied to the container in the build time --- helm/templates/frontend-env-config.yaml | 10 ------ helm/templates/frontend-nginx-configmap.yaml | 37 -------------------- 2 files changed, 47 deletions(-) delete mode 100644 helm/templates/frontend-env-config.yaml delete mode 100644 helm/templates/frontend-nginx-configmap.yaml diff --git a/helm/templates/frontend-env-config.yaml b/helm/templates/frontend-env-config.yaml deleted file mode 100644 index 4d2a563..0000000 --- a/helm/templates/frontend-env-config.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: frontend-env-config -data: - env-config.js: | - window.process_env = { - SUBSTRATE_TELEMETRY_URL: "wss://feed.telemetry.parity-stg.parity.io/feed", - SUBSTRATE_TELEMETRY_SAMPLE: "", - } diff --git a/helm/templates/frontend-nginx-configmap.yaml b/helm/templates/frontend-nginx-configmap.yaml deleted file mode 100644 index 7ae74dd..0000000 --- a/helm/templates/frontend-nginx-configmap.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: frontend-nginx -data: - nginx.conf: | - user nginx; - worker_processes auto; - worker_rlimit_nofile 30000; - error_log /var/log/nginx/error.log warn; - pid /var/run/nginx.pid; - - events { - worker_connections 8000; - } - - http { - default_type application/octet-stream; - include /etc/nginx/mime.types; - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - access_log /var/log/nginx/access.log main; - sendfile on; - #tcp_nopush on; - keepalive_timeout 65; - gzip on; - include /etc/nginx/conf.d/*.conf; - #server_tokens off; - - server { - root /usr/share/nginx/html; - index index.html; - listen 8000; - server_name _; - } - }