Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
},
"opentelemetryOptions": {
"enabled": {
"__name": "TELEMETRY_LOGGER_OTEL_ENABLED",
"__name": "OPENTELEMETRY_LOGGING_ENABLED",
"__format": "boolean"
},
"url": "TELEMETRY_LOGGER_OTEL_URL",
"resourceAttributes": {
"__name": "TELEMETRY_LOGGER_OTEL_RESOURCE_ATTRIBUTES",
"__format": "json"
}
"url": "OTLP_LOGGER_ENDPOINT_URL",
"resourceAttributes": "OTEL_RESOURCE_ATTRIBUTES"
}
}
},
Expand Down
34 changes: 23 additions & 11 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,35 @@ Returns the cloud provider image pull secret name from global if exists or from
{{- end -}}

{{/*
Returns the tracing url from global if exists or from the chart's values
Returns the tracing url from global if set, otherwise from the chart's values
*/}}
{{- define "cleaner.tracingUrl" -}}
{{- if .Values.global.tracing.url }}
{{- .Values.global.tracing.url -}}
{{- else if .Values.cloudProvider -}}
{{- .Values.env.tracing.url -}}
{{- if .Values.global.telemetry.tracing.url }}
{{- .Values.global.telemetry.tracing.url -}}
{{- else if .Values.telemetry.tracing.url -}}
{{- .Values.telemetry.tracing.url -}}
{{- end -}}
{{- end -}}

{{/*
Returns the metrics url from global if exists or from the chart's values
Returns the opentelemetry logging url from global if set, otherwise from the chart's values
*/}}
{{- define "cleaner.metricsUrl" -}}
{{- if .Values.global.metrics.url }}
{{- .Values.global.metrics.url -}}
{{- else -}}
{{- .Values.env.metrics.url | default "" -}}
{{- define "cleaner.opentelemetryLoggingUrl" -}}
{{- if .Values.global.telemetry.logger.opentelemetryOptions.url }}
{{- .Values.global.telemetry.logger.opentelemetryOptions.url -}}
{{- else if .Values.telemetry.logger.opentelemetryOptions.url -}}
{{- .Values.telemetry.logger.opentelemetryOptions.url -}}
{{- end -}}
{{- end -}}

{{/*
Renders a map of resource attributes as key=value,key=value for OTEL_RESOURCE_ATTRIBUTES.
Usage: {{ include "cleaner.otelResourceAttributes" .resourceAttributes }}
*/}}
{{- define "cleaner.otelResourceAttributes" -}}
{{- $attributes := list }}
{{- range $key, $value := . }}
{{- $attributes = append $attributes (printf "%s=%s" $key (toString $value)) }}
{{- end }}
{{- join "," $attributes }}
{{- end -}}
4 changes: 0 additions & 4 deletions helm/templates/_tplValues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ Custom definitions
{{- define "common.storage.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.storage .Values.global.storage ) "context" . ) }}
{{- end -}}

{{- define "common.ca.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.ca .Values.global.ca ) "context" . ) }}
{{- end -}}
26 changes: 16 additions & 10 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{- $telemetry := .Values.telemetry -}}
{{- $tracingUrl := include "cleaner.tracingUrl" . -}}
{{- $opentelemetryLoggingUrl := include "cleaner.opentelemetryLoggingUrl" . -}}
{{- $serviceUrls := fromYaml (include "common.serviceUrls.merged" .) -}}
{{- $storage := fromYaml (include "common.storage.merged" .) -}}
{{- $s3 := ($storage.s3) | default dict -}}
Expand All @@ -11,18 +13,22 @@ kind: ConfigMap
metadata:
name: {{ printf "%s-configmap" (include "cleaner.fullname" .) }}
data:
LOG_LEVEL: {{ .Values.env.logLevel | quote }}
LOG_PRETTY_PRINT_ENABLED: {{ .Values.env.prettyPrintEnabled | quote }}
{{- with .Values.env.openTelemetryOptions }}
TELEMETRY_LOGGER_OTEL_ENABLED: {{ .enabled | default false | quote }}
{{- with $telemetry }}
LOG_LEVEL: {{ .logger.level | quote }}
LOG_PRETTY_PRINT_ENABLED: {{ .logger.prettyPrint | quote }}
{{- with .logger.opentelemetryOptions }}
OPENTELEMETRY_LOGGING_ENABLED: {{ .enabled | quote }}
{{- if .enabled }}
TELEMETRY_LOGGER_OTEL_URL: {{ .url | default "" | quote }}
TELEMETRY_LOGGER_OTEL_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | default dict | toJson | quote }}
{{- end}}
OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | quote }}
{{- if .resourceAttributes }}
OTEL_RESOURCE_ATTRIBUTES: {{ include "cleaner.otelResourceAttributes" .resourceAttributes | quote }}
{{- end }}
{{- end }}
{{- end }}
TELEMETRY_TRACING_ENABLED: {{ .tracing.enabled | quote }}
{{- if .tracing.enabled }}
TELEMETRY_TRACING_URL: {{ $tracingUrl | quote }}
{{- end }}
{{- if .Values.env.tracing.enabled }}
TELEMETRY_TRACING_ENABLED: 'true'
TELEMETRY_TRACING_URL: {{ $tracingUrl }}
{{- end }}
npm_config_cache: /tmp/
{{- with .Values.configManagement }}
Expand Down
24 changes: 12 additions & 12 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- $cloudProviderDockerRegistryUrl := include "cleaner.cloudProviderDockerRegistryUrl" . -}}
{{- $cloudProviderImagePullSecretName := include "cleaner.cloudProviderImagePullSecretName" . -}}
{{- $imageTag := include "cleaner.tag" . -}}
{{- $ca := fromYaml (include "common.ca.merged" .) -}}
{{- $server := .Values.server -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was $ca removed?

{{- $storage := fromYaml (include "common.storage.merged" .) -}}
{{- $s3 := ($storage.s3) | default dict -}}
{{- $internalPvc := (($storage.fs).internalPvc) | default dict -}}
Expand Down Expand Up @@ -62,10 +62,10 @@ spec:
{{- end }}
{{- end }}
volumeMounts:
{{- if $ca.secretName }}
- mountPath: {{ printf "%s/%s" $ca.path $ca.key | quote }}
{{- if .Values.global.ca.secretName }}
- mountPath: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }}
name: root-ca
subPath: {{ quote $ca.key }}
subPath: {{ quote .Values.global.ca.key }}
{{- end }}
{{- if .Values.extraVolumeMounts -}}
{{ toYaml .Values.extraVolumeMounts | nindent 12 }}
Expand All @@ -80,12 +80,12 @@ spec:
fieldRef:
fieldPath: metadata.uid
- name: SERVER_PORT
value: {{ .Values.env.targetPort | quote }}
{{- if $ca.secretName }}
value: {{ $server.targetPort | quote }}
{{- if .Values.global.ca.secretName }}
- name: REQUESTS_CA_BUNDLE
value: {{ printf "%s/%s" $ca.path $ca.key | quote }}
value: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }}
- name: NODE_EXTRA_CA_CERTS
value: {{ printf "%s/%s" $ca.path $ca.key | quote }}
value: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }}
{{- end }}
{{- if $s3.secretName }}
- name: S3_ACCESS_KEY_ID
Expand All @@ -112,7 +112,7 @@ spec:
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
httpGet:
path: {{ .Values.livenessProbe.path }}
port: {{ .Values.env.targetPort }}
port: {{ $server.targetPort }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
Expand All @@ -121,7 +121,7 @@ spec:
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
httpGet:
path: {{ .Values.readinessProbe.path }}
port: {{ .Values.env.targetPort }}
port: {{ $server.targetPort }}
{{- end }}
{{- if .Values.resources.enabled }}
resources:
Expand All @@ -131,10 +131,10 @@ spec:
{{ tpl (toYaml .Values.sidecars) . | nindent 8 }}
{{- end }}
volumes:
{{- if $ca.secretName }}
{{- if .Values.global.ca.secretName }}
- name: root-ca
secret:
secretName: {{ $ca.secretName }}
secretName: {{ .Values.global.ca.secretName }}
{{- end }}
{{- if .Values.extraVolumes -}}
{{ tpl (toYaml .Values.extraVolumes) . | nindent 8 }}
Expand Down
56 changes: 34 additions & 22 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
global:
cloudProvider: {}
tracing: {}
metrics: {}
telemetry:
tracing: {}
logger:
opentelemetryOptions: {}
jobDefinitions: {}
storage: {}
serviceUrls: {}
ca: {}
ca:
secretName: ''
path: '/usr/local/share/ca-certificates'
key: 'ca.crt'
Comment on lines +10 to +13

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not aligned with the boilerplate


serviceUrls:
jobManager: ""
heartbeatManager: ""
jobTracker: ""

storage:
cleanupStorageProviders: {}
cleanupStorageProviders: [] # e.g. [S3, FS]
s3:
delete:
batchSize: 1000
Expand Down Expand Up @@ -49,10 +54,10 @@ nameOverride: ""
fullnameOverride: ""

configManagement:
offlineMode: false
offlineMode: true
name: 'cleaner'
version: ''
serverUrl: ''
version: 'latest'
serverUrl: 'http://localhost:8080/api'

jobDefinitions: {}

Expand Down Expand Up @@ -90,37 +95,44 @@ cloudProvider:
imagePullSecretName: ''
flavor: openshift

ca:
secretName: ''
path: '/usr/local/share/ca-certificates'
key: 'ca.crt'

image:
repository: cleaner
# If commented, appVersion will be taken. See: _helpers.tpl
# tag: 'latest'
pullPolicy: IfNotPresent

env:
server:
port: 8080
logLevel: info
prettyPrintEnabled: false
openTelemetryOptions:
enabled: false
url: ""
resourceAttributes: {}
targetPort: 8080

telemetry:
logger:
level: info
prettyPrint: false
opentelemetryOptions:
enabled: true
url: http://localhost:4317
# resourceAttributes:
# service.namespace: namespace
# deployment.environment: dev
tracing:
enabled: false
url: ""
enabled: true
# url can be overridden from global.telemetry.tracing.url
url: http://localhost:4318/v1/traces

env:
queue:
heartbeatIntervalMs: 1000
dequeueIntervalMs: 3000
jobnik:
worker:
concurrency: 1
worker:
capabilities:
pairs:
- job: "Ingestion_Update"
task: "tiles-deletion"
- job: "Ingestion_Swap_Update"
- job: "Delete_Layer"
task: "tiles-deletion"
Comment on lines +135 to 136

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add artifacts-deletion as well? if worker.capabilities.pairs is overidden by global all/most of time, should we just put it in comment?

httpRetry:
attempts: 3
Expand Down
2 changes: 1 addition & 1 deletion src/containerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const registerExternalValues = async (options?: RegisterOptions): Promise

const loggerConfig = configInstance.get('telemetry.logger');

const logger = await jsLogger({ ...loggerConfig, prettyPrint: loggerConfig.prettyPrint, mixin: getOtelMixin() });
const logger = await jsLogger({ ...loggerConfig, mixin: getOtelMixin() });

const tracer = trace.getTracer(SERVICE_NAME);
const metricsRegistry = new Registry();
Expand Down
Loading