From 525d75b32c8f5e11cd4fa1e077af1aa09aae286c Mon Sep 17 00:00:00 2001 From: almog8k Date: Tue, 17 Sep 2024 11:26:48 +0300 Subject: [PATCH 1/2] ops: supporting helm deployment --- helm/Chart.yaml | 4 +- helm/templates/_helpers.tpl | 84 ++++++++++++++++-------- helm/templates/_resources.tpl | 20 ++++++ helm/templates/_tplValues.tpl | 59 +++++++++++++++++ helm/templates/configmap.yaml | 37 +++++++++-- helm/templates/deployment.yaml | 62 +++++++++++------- helm/templates/ingress.yaml | 34 ---------- helm/templates/route.yaml | 34 ---------- helm/templates/service.yaml | 18 ++--- helm/values.yaml | 116 +++++++++++++++++++++------------ 10 files changed, 292 insertions(+), 176 deletions(-) create mode 100644 helm/templates/_resources.tpl create mode 100644 helm/templates/_tplValues.tpl delete mode 100644 helm/templates/ingress.yaml delete mode 100644 helm/templates/route.yaml diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 8dcfae7..e24dce4 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: ts-server-boilerplate -description: A Helm chart for ts-server-boilerplate service +name: overseer +description: A Helm chart for overseer service type: application version: 1.0.0 appVersion: 1.0.0 diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index 98cf4d7..3e0dc86 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -1,9 +1,16 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "overseer.name" -}} +{{- default .Chart.Name | trunc 63 | trimSuffix "-" }} +{{- end }} + {{/* Common labels */}} -{{- define "ts-server-boilerplate.labels" -}} -helm.sh/chart: {{ include "ts-server-boilerplate.chart" . }} -{{ include "ts-server-boilerplate.selectorLabels" . }} +{{- define "overseer.labels" -}} +helm.sh/chart: {{ include "overseer.chart" . }} +{{ include "overseer.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -13,22 +20,22 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Returns the tag of the chart. */}} -{{- define "ts-server-boilerplate.tag" -}} +{{- define "overseer.tag" -}} {{- default (printf "v%s" .Chart.AppVersion) .Values.image.tag }} {{- end }} {{/* Selector labels */}} -{{- define "ts-server-boilerplate.selectorLabels" -}} -app.kubernetes.io/name: {{ include "ts-server-boilerplate.name" . }} +{{- define "overseer.selectorLabels" -}} +app.kubernetes.io/name: {{ include "overseer.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Returns the environment from global if exists or from the chart's values, defaults to development */}} -{{- define "ts-server-boilerplate.environment" -}} +{{- define "overseer.environment" -}} {{- if .Values.global.environment }} {{- .Values.global.environment -}} {{- else -}} @@ -39,29 +46,52 @@ Returns the environment from global if exists or from the chart's values, defaul {{/* Returns the tracing url from global if exists or from the chart's values */}} -{{- define "ts-server-boilerplate.tracingUrl" -}} +{{- define "overseer.tracingUrl" -}} {{- if .Values.global.tracing.url }} {{- .Values.global.tracing.url -}} -{{- else if .Values.env.tracing.url -}} - {{- .Values.env.tracing.url -}} +{{- else if .Values.tracing.url -}} + {{- .Values.tracing.url -}} {{- end -}} {{- end -}} {{/* Returns the tracing url from global if exists or from the chart's values */}} -{{- define "ts-server-boilerplate.metricsUrl" -}} +{{- define "overseer.metricsUrl" -}} {{- if .Values.global.metrics.url }} {{- .Values.global.metrics.url -}} {{- else -}} - {{- .Values.env.metrics.url -}} + {{- .Values.metrics.url -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the cloud provider image pull secret name from global if exists or from the chart's values +*/}} +{{- define "overseer.cloudProviderImagePullSecretName" -}} +{{- if .Values.global.cloudProvider.imagePullSecretName }} + {{- .Values.global.cloudProvider.imagePullSecretName -}} +{{- else if .Values.cloudProvider.imagePullSecretName -}} + {{- .Values.cloudProvider.imagePullSecretName -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the cloud provider docker registry url from global if exists or from the chart's values +*/}} +{{- define "overseer.cloudProviderDockerRegistryUrl" -}} +{{- if .Values.global.cloudProvider.dockerRegistryUrl }} + {{- printf "%s/" .Values.global.cloudProvider.dockerRegistryUrl -}} +{{- else if .Values.cloudProvider.dockerRegistryUrl -}} + {{- printf "%s/" .Values.cloudProvider.dockerRegistryUrl -}} +{{- else -}} {{- end -}} {{- end -}} {{/* Return the proper image name */}} -{{- define "ts-server-boilerplate.image" -}} +{{- define "overseer.image" -}} {{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} {{- end -}} @@ -69,42 +99,40 @@ Return the proper image name {{/* Return the proper Docker Image Registry Secret Names */}} -{{- define "ts-server-boilerplate.imagePullSecrets" -}} +{{- define "overseer.imagePullSecrets" -}} {{ include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) }} {{- end -}} {{/* Return the proper image pullPolicy */}} -{{- define "ts-server-boilerplate.pullPolicy" -}} +{{- define "overseer.pullPolicy" -}} {{ include "common.images.pullPolicy" (dict "imageRoot" .Values.image "global" .Values.global) }} {{- end -}} {{/* -Return the proper image deploymentFlavor +Returns the cloud provider name from global if exists or from the chart's values, defaults to minikube */}} -{{- define "ts-server-boilerplate.deploymentFlavor" -}} -{{ include "common.images.deploymentFlavor" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- define "overseer.cloudProviderFlavor" -}} +{{- if .Values.global.cloudProvider.flavor }} + {{- .Values.global.cloudProvider.flavor -}} +{{- else if .Values.cloudProvider -}} + {{- .Values.cloudProvider.flavor | default "minikube" -}} +{{- else -}} + {{ "minikube" }} {{- end -}} - +{{- end -}} {{/* Return the proper fully qualified app name */}} -{{- define "ts-server-boilerplate.fullname" -}} +{{- define "overseer.fullname" -}} {{ include "common.names.fullname" . }} {{- end -}} {{/* Return the proper chart name */}} -{{- define "ts-server-boilerplate.name" -}} -{{ include "common.names.name" . }} -{{- end -}} - -{{/* -Return the proper chart name -*/}} -{{- define "ts-server-boilerplate.chart" -}} +{{- define "overseer.chart" -}} {{ include "common.names.chart" . }} {{- end -}} diff --git a/helm/templates/_resources.tpl b/helm/templates/_resources.tpl new file mode 100644 index 0000000..28c75d1 --- /dev/null +++ b/helm/templates/_resources.tpl @@ -0,0 +1,20 @@ +{{/* +Create service name as used by the service name label. +*/}} +{{- define "service.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name .Chart.Name "service" | indent 1 }} +{{- end }} + +{{/* +Create configmap name as used by the service name label. +*/}} +{{- define "configmap.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name .Chart.Name "configmap" | indent 1 }} +{{- end }} + +{{/* +Create deployment name as used by the service name label. +*/}} +{{- define "deployment.fullname" -}} +{{- printf "%s-%s-%s" .Release.Name .Chart.Name "deployment" | indent 1 }} +{{- end }} \ No newline at end of file diff --git a/helm/templates/_tplValues.tpl b/helm/templates/_tplValues.tpl new file mode 100644 index 0000000..71972d5 --- /dev/null +++ b/helm/templates/_tplValues.tpl @@ -0,0 +1,59 @@ +{{/* +Copyright VMware, Inc. +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template perhaps with scope if the scope is present. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }} +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }} +*/}} +{{- define "common.tplvalues.render" -}} +{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} +{{- if contains "{{" (toJson .value) }} + {{- if .scope }} + {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }} + {{- else }} + {{- tpl $value .context }} + {{- end }} +{{- else }} + {{- $value }} +{{- end }} +{{- end -}} + +{{/* +Merge a list of values that contains template after rendering them. +Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge +Usage: +{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }} +*/}} +{{- define "common.tplvalues.merge" -}} +{{- $dst := dict -}} +{{- range .values -}} +{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}} +{{- end -}} +{{ $dst | toYaml }} +{{- end -}} + +{{/* +End of usage example +*/}} + +{{/* +Custom definitions +*/}} + + +{{- define "common.tracing.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.tracing .Values.global.tracing ) "context" . ) }} +{{- end -}} + +{{- define "common.metrics.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics .Values.global.metrics ) "context" . ) }} +{{- end -}} + +{{- define "common.serviceUrls.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceUrls .Values.global.serviceUrls ) "context" . ) }} +{{- end -}} diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 69202f7..3d5922f 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -1,22 +1,45 @@ -{{- $tracingUrl := include "ts-server-boilerplate.tracingUrl" . -}} -{{- $metricsUrl := include "ts-server-boilerplate.metricsUrl" . -}} +{{- $configmapName := include "configmap.fullname" . }} +{{- $tracing := (include "common.tracing.merged" .) | fromYaml }} +{{- $metrics := (include "common.metrics.merged" .) | fromYaml }} +{{- $serviceUrls := (include "common.serviceUrls.merged" .) | fromYaml }} + {{- if .Values.enabled -}} apiVersion: v1 kind: ConfigMap metadata: - name: {{ printf "%s-configmap" (include "ts-server-boilerplate.fullname" .) }} + name: {{ $configmapName }} data: REQUEST_PAYLOAD_LIMIT: {{ .Values.env.requestPayloadLimit | quote }} RESPONSE_COMPRESSION_ENABLED: {{ .Values.env.responseCompressionEnabled | quote }} LOG_LEVEL: {{ .Values.env.logLevel | quote }} LOG_PRETTY_PRINT_ENABLED: {{ .Values.env.logPrettyPrintEnabled | quote }} - {{ if .Values.env.tracing.enabled }} + {{ if $tracing.enabled }} TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ $tracingUrl }} + TELEMETRY_TRACING_URL: {{ $tracing.url }} {{ end }} - {{ if .Values.env.metrics.enabled }} + {{ if $metrics.enabled }} TELEMETRY_METRICS_ENABLED: 'true' - TELEMETRY_METRICS_URL: {{ $metricsUrl }} + TELEMETRY_METRICS_URL: {{ $metrics.url }} + {{ end }} npm_config_cache: /tmp/ + + HTTP_RETRY_ATTEMPTS: {{ .Values.env.httpRetry.attempts | quote }} + HTTP_RETRY_DELAY: {{ .Values.env.httpRetry.delay | quote }} + HTTP_RETRY_RESET_TIMEOUT: {{ .Values.env.httpRetry.resetTimeout | quote }} + DISABLE_HTTP_CLIENT_LOGS: {{ .Values.env.disableHttpClientLogs | quote }} + JOB_MANAGER_BASE_URL: {{ $serviceUrls.jobManager | quote}} + HEARTBEAT_BASE_URL: {{ $serviceUrls.heartbeatManager | quote}} + HEARTBEAT_INTERVAL_MS: {{ .Values.env.jobManagement.config.heartBeat.intervalMs | quote }} + DEQUEUE_INTERVAL_MS: {{ .Values.env.jobManagement.config.dequeueIntervalMs | quote }} + MAP_SERVER_CACHE_TYPE: {{ .Values.env.mapServerCacheType | quote }} + INGESTION_POLLING_INIT_TASK: {{ .Values.env.jobManagement.ingestion.pollingTasks.init | quote }} + INGESTION_POLLING_FINALIZE_TASK: {{ .Values.env.jobManagement.ingestion.pollingTasks.finalize | quote }} + INGESTION_JOB_NEW_TYPE: {{ .Values.env.jobManagement.ingestion.jobs.new.type | quote }} + INGESTION_JOB_UPDATE_TYPE: {{ .Values.env.jobManagement.ingestion.jobs.update.type | quote }} + INGESTION_JOB_SWAP_UPDATE_TYPE: {{ .Values.env.jobManagement.ingestion.jobs.swapUpdate.type | quote }} + TILES_MERGING_TASK_TYPE: {{ .Values.env.jobManagement.ingestion.tasks.tilesMerging.type | quote }} + TILES_MERGING_TILE_BATCH_SIZE: {{ .Values.env.jobManagement.ingestion.tasks.tilesMerging.tileBatchSize | quote }} + TILES_MERGING_TASK_BATCH_SIZE: {{ .Values.env.jobManagement.ingestion.tasks.tilesMerging.taskBatchSize | quote }} + TILES_MERGING_USE_NEW_TARGET_FLAG_IN_UPDATE: {{ .Values.env.jobManagement.ingestion.tasks.tilesMerging.useNewTargetFlagInUpdate | quote }} {{- end }} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 007efa2..791050c 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -1,16 +1,22 @@ {{- $releaseName := .Release.Name -}} -{{- $chartName := include "ts-server-boilerplate.name" . -}} +{{- $deploymentName := include "deployment.fullname" . }} +{{- $chartName := include "overseer.name" . -}} +{{- $metrics := (include "common.metrics.merged" .) | fromYaml }} +{{- $cloudProviderImagePullSecretName := include "overseer.cloudProviderImagePullSecretName" . -}} +{{- $cloudProviderDockerRegistryUrl := include "overseer.cloudProviderDockerRegistryUrl" . -}} +{{- $imageTag := include "overseer.tag" . -}} + {{- if .Values.enabled -}} apiVersion: apps/v1 kind: Deployment metadata: - name: {{ printf "%s-deployment" (include "ts-server-boilerplate.fullname" .) }} + name: {{ $deploymentName }} labels: app: {{ $chartName }} component: {{ $chartName }} - environment: {{ include "ts-server-boilerplate.environment" . }} + environment: {{ include "overseer.environment" . }} release: {{ $releaseName }} - {{- include "ts-server-boilerplate.labels" . | nindent 4 }} + {{- include "overseer.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} @@ -19,33 +25,43 @@ spec: app: {{ $chartName }} release: {{ $releaseName }} run: {{ $releaseName }}-{{ $chartName }} - {{- include "ts-server-boilerplate.selectorLabels" . | nindent 6 }} + {{- include "overseer.selectorLabels" . | nindent 6 }} template: metadata: labels: app: {{ $chartName }} release: {{ $releaseName }} run: {{ $releaseName }}-{{ $chartName }} - {{- include "ts-server-boilerplate.selectorLabels" . | nindent 8 }} + {{- include "overseer.selectorLabels" . | nindent 8 }} annotations: - {{- if .Values.resetOnConfigChange }} + {{- if .Values.resetOnConfigChange }} checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - {{- end }} - {{- if .Values.podAnnotations }} - {{- toYaml .Values.podAnnotations | nindent 8 }} - {{- end }} + {{- end }} + {{- if $metrics.enabled }} + prometheus.io/port: {{ $metrics.prometheus.port | quote }} + prometheus.io/scrape: {{ $metrics.prometheus.scrape | quote }} + {{- end }} + {{- if .Values.podAnnotations }} + {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} spec: - {{- include "ts-server-boilerplate.imagePullSecrets" . | nindent 6 }} + {{- if $cloudProviderImagePullSecretName }} + imagePullSecrets: + - name: {{ $cloudProviderImagePullSecretName | quote }} + {{- end }} containers: - name: {{ $releaseName }}-{{ $chartName }}-deployment - image: {{ include "ts-server-boilerplate.image" . }} + {{- with .Values.image }} + image: {{ $cloudProviderDockerRegistryUrl }}{{ .repository }}:{{ $imageTag }} + imagePullPolicy: {{ .pullPolicy | default "IfNotPresent" }} + {{- end }} {{- if .Values.command }} command: - {{- toYaml .Values.command | nindent 12 }} + {{- toYaml .Values.command | nindent 12 }} + {{- end }} {{- if .Values.args }} args: - {{- toYaml .Values.args | nindent 12 }} - {{- end }} + {{- toYaml .Values.args | nindent 12 }} {{- end }} volumeMounts: {{- if .Values.caSecretName }} @@ -53,8 +69,8 @@ spec: name: root-ca subPath: {{ quote .Values.caKey }} {{- end }} - {{- if .Values.extraVolumeMounts -}} - {{ toYaml .Values.extraVolumeMounts | nindent 12 }} + {{- if .Values.extraVolumeMounts }} + {{- toYaml .Values.extraVolumeMounts | nindent 12 }} {{- end }} env: - name: SERVER_PORT @@ -70,7 +86,7 @@ spec: {{- end }} envFrom: - configMapRef: - name: {{ printf "%s-configmap" (include "ts-server-boilerplate.fullname" .) }} + name: {{ printf "%s-configmap" (include "overseer.fullname" .) }} ports: - name: http containerPort: {{ .Values.env.targetPort }} @@ -98,7 +114,7 @@ spec: {{- toYaml .Values.resources.value | nindent 12 }} {{- end }} {{- if .Values.sidecars }} - {{ tpl (toYaml .Values.sidecars) . | nindent 8 }} + {{- tpl (toYaml .Values.sidecars) . | nindent 8 }} {{- end }} volumes: - name: nginx-config @@ -109,7 +125,7 @@ spec: secret: secretName: {{ .Values.caSecretName }} {{- end }} - {{- if .Values.extraVolumes -}} - {{ tpl (toYaml .Values.extraVolumes) . | nindent 8 }} + {{- if .Values.extraVolumes }} + {{- tpl (toYaml .Values.extraVolumes) . | nindent 8 }} {{- end }} -{{- end -}} +{{- end }} \ No newline at end of file diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml deleted file mode 100644 index 94f92f8..0000000 --- a/helm/templates/ingress.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "ts-server-boilerplate.name" . -}} -{{- if and (.Values.enabled) (.Values.ingress.enabled) -}} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ $releaseName }}-{{ $chartName }}-ingress - annotations: - kubernetes.io/ingress.class: "nginx" - nginx.org/mergeable-ingress-type: "minion" - nginx.org/rewrites: 'serviceName={{ $releaseName }}-{{ $chartName }} rewrite=/' - nginx.org/location-snippets: | - if ($request_method = OPTIONS) { - return 204; - } - {{- if .Values.ingress.cors.enabled }} - add_header 'Access-Control-Allow-Origin' '{{- .Values.ingress.cors.origin -}}'; - add_header 'Access-Control-Max-Age' 3600; - add_header 'Access-Control-Expose-Headers' 'Content-Length'; - add_header 'Access-Control-Allow-Headers' '*'; - {{- end }} -spec: - rules: - - http: - paths: - - path: {{ .Values.ingress.path }} - pathType: Prefix - backend: - service: - name: {{ printf "%s-service" (include "ts-server-boilerplate.fullname" .) }} - port: - number: {{ .Values.env.port }} - host: {{ .Values.ingress.host | quote }} -{{- end -}} diff --git a/helm/templates/route.yaml b/helm/templates/route.yaml deleted file mode 100644 index 7b65be5..0000000 --- a/helm/templates/route.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- $releaseName := .Release.Name -}} -{{- $chartName := include "ts-server-boilerplate.name" . -}} -{{- $cloudProviderFlavor := include "ts-server-boilerplate.deploymentFlavor" . -}} -{{- if and (and (.Values.enabled) (eq $cloudProviderFlavor "openshift")) (.Values.route.enabled) -}} -apiVersion: route.openshift.io/v1 -kind: Route -metadata: - name: {{ $releaseName }}-{{ $chartName }}-route - annotations: - {{- if .Values.route.rewriteTarget }} - haproxy.router.openshift.io/rewrite-target: {{ .Values.route.rewriteTarget }} - {{- end }} - {{- if .Values.route.timeout.enabled }} - haproxy.router.openshift.io/timeout: {{ .Values.route.timeout.durationSeconds }} - {{- end }} -spec: - {{- if .Values.route.host }} - host: {{ .Values.route.host }} - {{- end }} - path: {{ .Values.route.path | default "/" }} - to: - kind: Service - name: {{ printf "%s-service" (include "ts-server-boilerplate.fullname" .) }} - {{- if .Values.route.tls.enabled }} - tls: - termination: {{ .Values.route.tls.termination | quote }} - insecureEdgeTerminationPolicy: {{ .Values.route.tls.insecureEdgeTerminationPolicy | quote }} - {{- if .Values.route.tls.useCerts }} - certificate: {{ .Values.route.tls.certificate | quote }} - key: {{ .Values.route.tls.key | quote }} - caCertificate: {{ .Values.route.tls.caCertificate | quote }} - {{- end }} - {{- end -}} -{{- end -}} diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml index 00ce0f9..7c61b88 100644 --- a/helm/templates/service.yaml +++ b/helm/templates/service.yaml @@ -1,19 +1,21 @@ {{- $releaseName := .Release.Name -}} -{{- $chartName := include "ts-server-boilerplate.name" . -}} -{{- $deploymentFlavor := include "ts-server-boilerplate.deploymentFlavor" . -}} +{{- $chartName := include "overseer.name" . -}} +{{- $cloudProviderFlavor := include "overseer.cloudProviderFlavor" . -}} +{{- $serviceName := include "service.fullname" . -}} + {{- if .Values.enabled -}} apiVersion: v1 kind: Service metadata: - name: {{ printf "%s-service" (include "ts-server-boilerplate.fullname" .) }} + name: {{ $serviceName }} labels: app: {{ $chartName }} component: {{ $chartName }} - environment: {{ include "ts-server-boilerplate.environment" . }} + environment: {{ include "overseer.environment" . }} release: {{ $releaseName }} - {{- include "ts-server-boilerplate.labels" . | nindent 4 }} + {{- include "overseer.labels" . | nindent 4 }} spec: - {{- if eq $deploymentFlavor "minikube" }} + {{- if eq $cloudProviderFlavor "minikube" }} type: NodePort {{- end }} ports: @@ -21,12 +23,12 @@ spec: targetPort: {{ .Values.env.targetPort }} protocol: {{ .Values.env.protocol }} name: http - {{- if eq $deploymentFlavor "minikube" }} + {{- if eq $cloudProviderFlavor "minikube" }} nodePort: {{ .Values.nodePort }} {{- end }} selector: app: {{ $chartName }} release: {{ $releaseName }} run: {{ $releaseName }}-{{ $chartName }} - {{- include "ts-server-boilerplate.selectorLabels" . | nindent 4 }} + {{- include "overseer.selectorLabels" . | nindent 4 }} {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 25fd768..271985a 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -1,11 +1,16 @@ global: - imageRegistry: "" - imagePullSecrets: [] - deploymentFlavor: "openshift" - pullPolicy: "IfNotPresent" + cloudProvider: {} tracing: {} metrics: {} environment: '' + serviceUrls: + jobManager: "" + heartbeatManager: "" + ca: + caSecretName: '' + caPath: '/usr/local/share/ca-certificates' + caKey: 'ca.crt' + gracefulReloadMaxSeconds: 300 enabled: true environment: development @@ -46,16 +51,47 @@ args: [] sidecars: [] +cloudProvider: + dockerRegistryUrl: 'my-registry-url.io' + imagePullSecretName: 'my-registry-secret' + flavor: openshift + caSecretName: '' caPath: '/usr/local/share/ca-certificates' caKey: 'ca.crt' image: - registry: "" - repository: ts-server-boilerplate - tag: 'v4.2.0' - digest: "" - pullSecrets: [] + repository: overseer + tag: 'latest' + pullPolicy: Always + +serviceUrls: + jobManager: "http://localhost:8081" + heartbeatManager: "http://localhost:8082" + +tracing: + enabled: false + url: http://localhost:55681/v1/trace +metrics: + enabled: false + url: http://localhost:55681/v1/metrics + buckets: + - 0.005 + - 0.01 + - 0.025 + - 0.05 + - 0.1 + - 0.25 + - 0.5 + - 1 + - 2.5 + - 5 + - 10 + - 15 + - 50 + - 250 + - 500 + env: port: 8080 targetPort: 8080 @@ -64,12 +100,37 @@ env: logPrettyPrintEnabled: false responseCompressionEnabled: true requestPayloadLimit: 1mb - tracing: - enabled: false - url: http://localhost:55681/v1/trace - metrics: - enabled: false - url: http://localhost:55681/v1/metrics + + httpRetry: + attempts: 5 + delay: exponential + resetTimeout: 30000 + disableHttpClientLogs: true + + mapServerCacheType: "FS" + jobManagement: + config: + dequeueIntervalMs: 3000 + heartBeat: + intervalMs: 3000 + ingestion: + pollingTasks: + init: init + finalize: finalize + jobs: + new: + type: 'Ingestion_New' + update: + type: 'Ingestion_Update' + swapUpdate: + type: 'Ingestion_Swap_Update' + tasks: + tilesMerging: + type: 'Tiles_Merging' + tileBatchSize: 10000 + taskBatchSize: 5 + useNewTargetFlagInUpdate: true + resources: enabled: true @@ -80,28 +141,3 @@ resources: requests: cpu: 100m memory: 128Mi - -route: - enabled: true - path: / - host: - timeout: - enabled: false # defaults to 30s by openshift - duration: 60s # supported units (us, ms, s, m, h, d) - rewriteTarget: '' - tls: - enabled: true - termination: edge - insecureEdgeTerminationPolicy: Redirect - useCerts: false - certificate: '' - key: '' - caCertificate: '' - -ingress: - enabled: false - path: / - host: 'localhost' - cors: - enabled: true - origin: '*' From ce8697346a70edcb85040379db8c5c61002805e9 Mon Sep 17 00:00:00 2001 From: almog8k Date: Tue, 17 Sep 2024 11:28:25 +0300 Subject: [PATCH 2/2] ops: supporting helm deployment --- .gitignore | 1 + catalog-info.yaml | 4 +- config/custom-environment-variables.json | 57 +++++++++++++++++++++++- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d26e379..f360ad1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ lerna-debug.log* # Development tools .idea local.json +local.yaml # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json diff --git a/catalog-info.yaml b/catalog-info.yaml index 55a51de..0f2680e 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -1,10 +1,10 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: - name: ts-server-boilerplate + name: overseer description: A boilerplate github repo for a REST API service in NodeJS for MapColonies annotations: - github.com/project-slug: MapColonies/ts-server-boilerplate + github.com/project-slug: MapColonies/overseer tags: - nodejs - typescript diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index a2de0b0..1f7ec3e 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -17,7 +17,11 @@ "metrics": { "enabled": "TELEMETRY_METRICS_ENABLED", "url": "TELEMETRY_METRICS_URL", - "interval": "TELEMETRY_METRICS_INTERVAL" + "interval": "TELEMETRY_METRICS_INTERVAL", + "buckets": { + "__name": "TELEMETRY_METRICS_BUCKETS", + "__format": "json" + } } }, "server": { @@ -34,6 +38,57 @@ "__format": "boolean" } } + }, + "httpRetry": { + "attempts": "HTTP_RETRY_ATTEMPTS", + "delay": "HTTP_RETRY_DELAY", + "shouldResetTimeout": { + "__name": "HTTP_RETRY_RESET_TIMEOUT", + "__format": "boolean" + }, + "disableHttpClientLogs": { + "__name": "HTTP_RETRY_DISABLE_LOGS", + "__format": "boolean" + } + } + }, + "mapServerCacheType": "MAP_SERVER_CACHE_TYPE", + "jobManagement": { + "config": { + "jobManagerBaseUrl": "JOB_MANAGER_BASE_URL", + "heartbeat": { + "baseUrl": "HEARTBEAT_BASE_URL", + "intervalMs": "HEARTBEAT_INTERVAL_MS" + }, + "dequeueIntervalMs": "DEQUEUE_INTERVAL_MS" + }, + "ingestion": { + "pollingTasks": { + "init": "INGESTION_POLLING_INIT_TASK", + "finalize": "INGESTION_POLLING_FINALIZE_TASK" + }, + "jobs": { + "new": { + "type": "INGESTION_NEW_JOB_TYPE" + }, + "update": { + "type": "INGESTION_UPDATE_JOB_TYPE" + }, + "swapUpdate": { + "type": "INGESTION_SWAP_UPDATE_JOB_TYPE" + } + }, + "task": { + "tilesMerging": { + "type": "TILES_MERGING_TASK_TYPE", + "tileBatchSize": "TILES_MERGING_TILE_BATCH_SIZE", + "taskBatchSize": "TILES_MERGING_TASK_BATCH_SIZE", + "useNewTargetFlagInUpdate": { + "__name": "TILES_MERGING_USE_NEW_TARGET_FLAG", + "__format": "boolean" + } + } + } } } }