diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index abf6c4b..1c62de6 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -144,8 +144,8 @@ Service URLs {{- printf "http://%s" .Values.app.name -}} {{- end }} -{{- define "openops.engineServiceUrl" -}} -{{- printf "http://%s:3005" .Values.engine.name -}} +{{- define "openops.workerServiceUrl" -}} +{{- printf "http://%s:3000" .Values.worker.name -}} {{- end }} {{- define "openops.tablesServiceUrl" -}} diff --git a/chart/templates/deployment-app.yaml b/chart/templates/deployment-app.yaml index b19bb48..a6eb81b 100644 --- a/chart/templates/deployment-app.yaml +++ b/chart/templates/deployment-app.yaml @@ -74,6 +74,8 @@ spec: value: "--no-node-snapshot" - name: OPS_COMPONENT value: app + - name: OPS_CONTAINER_TYPE + value: APP {{ include "openops.renderEnv" (dict "root" . "env" .Values.openopsEnv "skipDuplicateSecrets" true) | nindent 12 }} {{ include "openops.renderEnv" (dict "root" . "env" .Values.openopsEnvSecrets) | nindent 12 }} ports: diff --git a/chart/templates/deployment-engine.yaml b/chart/templates/deployment-worker.yaml similarity index 73% rename from chart/templates/deployment-engine.yaml rename to chart/templates/deployment-worker.yaml index 6b567c6..a4c46e9 100644 --- a/chart/templates/deployment-engine.yaml +++ b/chart/templates/deployment-worker.yaml @@ -1,9 +1,9 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ .Values.engine.name }} + name: {{ .Values.worker.name }} labels: - {{- include "openops.componentLabels" (dict "root" . "component" "engine") | nindent 4 }} + {{- include "openops.componentLabels" (dict "root" . "component" "worker") | nindent 4 }} {{- with .Values.global.commonLabels }} {{- toYaml . | nindent 4 }} {{- end }} @@ -12,22 +12,22 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if not .Values.engine.autoscaling.enabled }} - replicas: {{ .Values.engine.replicas }} + {{- if not .Values.worker.autoscaling.enabled }} + replicas: {{ .Values.worker.replicas }} {{- end }} {{- include "openops.deploymentStrategy" . | nindent 2 }} selector: matchLabels: - {{- include "openops.componentSelectorLabels" (dict "root" . "component" "engine") | nindent 6 }} + {{- include "openops.componentSelectorLabels" (dict "root" . "component" "worker") | nindent 6 }} template: metadata: labels: - {{- include "openops.componentSelectorLabels" (dict "root" . "component" "engine") | nindent 8 }} + {{- include "openops.componentSelectorLabels" (dict "root" . "component" "worker") | nindent 8 }} {{- with .Values.global.commonLabels }} {{- toYaml . | nindent 8 }} {{- end }} annotations: - {{- include "openops.prometheusAnnotations" (dict "root" . "component" "engine") | nindent 8 }} + {{- include "openops.prometheusAnnotations" (dict "root" . "component" "worker") | nindent 8 }} {{- with include "openops.secretChecksum" . }} checksum/secret-env: {{ . }} {{- end }} @@ -35,34 +35,33 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: - serviceAccountName: {{ include "openops.serviceAccountName" (dict "root" . "component" "engine") }} + serviceAccountName: {{ include "openops.serviceAccountName" (dict "root" . "component" "worker") }} {{- include "openops.imagePullSecrets" . | nindent 6 }} - {{- include "openops.podSecurityContext" (dict "root" . "component" "engine") | nindent 6 }} + {{- include "openops.podSecurityContext" (dict "root" . "component" "worker") | nindent 6 }} {{- include "openops.priorityClassName" . | nindent 6 }} {{- include "openops.terminationGracePeriodSeconds" . | nindent 6 }} - {{- include "openops.topologySpreadConstraints" (dict "root" . "component" "engine") | nindent 6 }} - {{- include "openops.affinity" (dict "root" . "component" "engine") | nindent 6 }} + {{- include "openops.topologySpreadConstraints" (dict "root" . "component" "worker") | nindent 6 }} + {{- include "openops.affinity" (dict "root" . "component" "worker") | nindent 6 }} {{- include "openops.nodeSelector" . | nindent 6 }} {{- include "openops.tolerations" . | nindent 6 }} - {{- include "openops.initContainers" (dict "root" . "component" "engine") | nindent 6 }} + {{- include "openops.initContainers" (dict "root" . "component" "worker") | nindent 6 }} containers: - - name: {{ .Values.engine.name }} - image: "{{ include "openops.imageRepository" (dict "root" . "component" "engine") }}/{{ .Values.engine.image }}:{{ .Values.global.version }}" + - name: {{ .Values.worker.name }} + image: "{{ include "openops.imageRepository" (dict "root" . "component" "worker") }}/{{ .Values.worker.image }}:{{ .Values.global.version }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{- include "openops.containerSecurityContext" (dict "root" .) | nindent 10 }} - command: [ "/bin/sh", "-c", "cp -r /var/tmp-base/. /tmp/ && node main.js" ] env: - - name: NODE_OPTIONS - value: "--no-node-snapshot" - name: OPS_COMPONENT - value: engine + value: worker + - name: OPS_CONTAINER_TYPE + value: WORKER {{ include "openops.renderEnv" (dict "root" . "env" .Values.openopsEnv "skipDuplicateSecrets" true) | nindent 12 }} {{ include "openops.renderEnv" (dict "root" . "env" .Values.openopsEnvSecrets) | nindent 12 }} -{{ include "openops.renderEnv" (dict "root" . "env" .Values.engine.env) | nindent 12 }} +{{ include "openops.renderEnv" (dict "root" . "env" .Values.worker.env) | nindent 12 }} ports: - - containerPort: 3005 + - containerPort: 3000 name: http -{{- with .Values.engine.resources }} +{{- with .Values.worker.resources }} resources: {{ toYaml . | nindent 12 }} {{- end }} diff --git a/chart/templates/external-secret.yaml b/chart/templates/external-secret.yaml index 6d74d71..2030451 100644 --- a/chart/templates/external-secret.yaml +++ b/chart/templates/external-secret.yaml @@ -71,8 +71,8 @@ spec: {{- range $k, $v := .Values.tables.env }}{{ if not (hasKey $allEnv $k) }}{{ $_ := set $allEnv $k ($v | toString) }}{{ end }}{{ end }} {{- range $k, $v := .Values.analytics.env }}{{ if not (hasKey $allEnv $k) }}{{ $_ := set $allEnv $k ($v | toString) }}{{ end }}{{ end }} {{- range $k, $v := .Values.postgres.env }}{{ if not (hasKey $allEnv $k) }}{{ $_ := set $allEnv $k ($v | toString) }}{{ end }}{{ end }} -{{- if .Values.engine }}{{- if .Values.engine.env }} -{{- range $k, $v := .Values.engine.env }}{{ if not (hasKey $allEnv $k) }}{{ $_ := set $allEnv $k ($v | toString) }}{{ end }}{{ end }} +{{- if .Values.worker }}{{- if .Values.worker.env }} +{{- range $k, $v := .Values.worker.env }}{{ if not (hasKey $allEnv $k) }}{{ $_ := set $allEnv $k ($v | toString) }}{{ end }}{{ end }} {{- end }}{{- end }} {{- include "openops.collectSecretEntries" (dict "root" $ "env" $allEnv "secretName" .Values.externalSecrets.secretName) }} {{- end }} diff --git a/chart/templates/hpa-engine.yaml b/chart/templates/hpa-worker.yaml similarity index 54% rename from chart/templates/hpa-engine.yaml rename to chart/templates/hpa-worker.yaml index 608f9fc..1021e94 100644 --- a/chart/templates/hpa-engine.yaml +++ b/chart/templates/hpa-worker.yaml @@ -1,10 +1,10 @@ -{{- if .Values.engine.autoscaling.enabled }} +{{- if .Values.worker.autoscaling.enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ .Values.engine.name }}-hpa + name: {{ .Values.worker.name }}-hpa labels: - {{- include "openops.componentLabels" (dict "root" . "component" "engine") | nindent 4 }} + {{- include "openops.componentLabels" (dict "root" . "component" "worker") | nindent 4 }} {{- with .Values.global.commonLabels }} {{- toYaml . | nindent 4 }} {{- end }} @@ -12,24 +12,24 @@ spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ .Values.engine.name }} - minReplicas: {{ .Values.engine.autoscaling.minReplicas }} - maxReplicas: {{ .Values.engine.autoscaling.maxReplicas }} + name: {{ .Values.worker.name }} + minReplicas: {{ .Values.worker.autoscaling.minReplicas }} + maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }} metrics: - {{- if .Values.engine.autoscaling.targetCPUUtilizationPercentage }} + {{- if .Values.worker.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu target: type: Utilization - averageUtilization: {{ .Values.engine.autoscaling.targetCPUUtilizationPercentage }} + averageUtilization: {{ .Values.worker.autoscaling.targetCPUUtilizationPercentage }} {{- end }} - {{- if .Values.engine.autoscaling.targetMemoryUtilizationPercentage }} + {{- if .Values.worker.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory target: type: Utilization - averageUtilization: {{ .Values.engine.autoscaling.targetMemoryUtilizationPercentage }} + averageUtilization: {{ .Values.worker.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }} diff --git a/chart/templates/networkpolicy.yaml b/chart/templates/networkpolicy.yaml index c9dc2b1..6a4eccf 100644 --- a/chart/templates/networkpolicy.yaml +++ b/chart/templates/networkpolicy.yaml @@ -40,10 +40,10 @@ spec: - to: - podSelector: matchLabels: - app.kubernetes.io/component: engine + app.kubernetes.io/component: worker ports: - protocol: TCP - port: 3005 + port: 3000 - to: - podSelector: matchLabels: @@ -71,17 +71,17 @@ spec: - protocol: TCP port: 443 --- -# Network policy for engine +# Network policy for worker apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: - name: {{ .Values.engine.name }}-netpol + name: {{ .Values.worker.name }}-netpol labels: - {{- include "openops.componentLabels" (dict "root" . "component" "engine") | nindent 4 }} + {{- include "openops.componentLabels" (dict "root" . "component" "worker") | nindent 4 }} spec: podSelector: matchLabels: - {{- include "openops.componentSelectorLabels" (dict "root" . "component" "engine") | nindent 6 }} + {{- include "openops.componentSelectorLabels" (dict "root" . "component" "worker") | nindent 6 }} policyTypes: - Ingress - Egress @@ -92,7 +92,7 @@ spec: app.kubernetes.io/component: app ports: - protocol: TCP - port: 3005 + port: 3000 egress: - to: - podSelector: @@ -306,7 +306,7 @@ spec: - from: - podSelector: matchLabels: - app.kubernetes.io/component: engine + app.kubernetes.io/component: worker ports: - protocol: TCP port: 5432 @@ -358,7 +358,7 @@ spec: - from: - podSelector: matchLabels: - app.kubernetes.io/component: engine + app.kubernetes.io/component: worker ports: - protocol: TCP port: 6379 diff --git a/chart/templates/pdb-engine.yaml b/chart/templates/pdb-worker.yaml similarity index 60% rename from chart/templates/pdb-engine.yaml rename to chart/templates/pdb-worker.yaml index b0e670e..17a54ac 100644 --- a/chart/templates/pdb-engine.yaml +++ b/chart/templates/pdb-worker.yaml @@ -1,16 +1,16 @@ -{{- if .Values.engine.podDisruptionBudget.enabled }} +{{- if .Values.worker.podDisruptionBudget.enabled }} apiVersion: policy/v1 kind: PodDisruptionBudget metadata: - name: {{ .Values.engine.name }}-pdb + name: {{ .Values.worker.name }}-pdb labels: - {{- include "openops.componentLabels" (dict "root" . "component" "engine") | nindent 4 }} + {{- include "openops.componentLabels" (dict "root" . "component" "worker") | nindent 4 }} {{- with .Values.global.commonLabels }} {{- toYaml . | nindent 4 }} {{- end }} spec: - minAvailable: {{ .Values.engine.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.worker.podDisruptionBudget.minAvailable }} selector: matchLabels: - {{- include "openops.componentSelectorLabels" (dict "root" . "component" "engine") | nindent 6 }} + {{- include "openops.componentSelectorLabels" (dict "root" . "component" "worker") | nindent 6 }} {{- end }} diff --git a/chart/templates/secret-env.yaml b/chart/templates/secret-env.yaml index 7d50968..926b7a2 100644 --- a/chart/templates/secret-env.yaml +++ b/chart/templates/secret-env.yaml @@ -10,7 +10,7 @@ {{- $existingSecret := default "" $secretSettings.existingSecret -}} {{- if and $create (not $existingSecret) -}} {{- $autoSecretData := dict -}} -{{- $envSources := list .Values.openopsEnvSecrets .Values.openopsEnv .Values.engine.env .Values.tables.env .Values.analytics.env .Values.postgres.env -}} +{{- $envSources := list .Values.openopsEnvSecrets .Values.openopsEnv .Values.worker.env .Values.tables.env .Values.analytics.env .Values.postgres.env -}} {{- range $env := $envSources }} {{- if $env }} {{- range $k, $v := $env }} diff --git a/chart/templates/service-engine.yaml b/chart/templates/service-worker.yaml similarity index 65% rename from chart/templates/service-engine.yaml rename to chart/templates/service-worker.yaml index 8fa522d..0fda388 100644 --- a/chart/templates/service-engine.yaml +++ b/chart/templates/service-worker.yaml @@ -1,15 +1,15 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Values.engine.name }} + name: {{ .Values.worker.name }} labels: - {{- include "openops.componentLabels" (dict "root" . "component" "engine") | nindent 4 }} + {{- include "openops.componentLabels" (dict "root" . "component" "worker") | nindent 4 }} spec: type: ClusterIP ports: - - port: 3005 - targetPort: 3005 + - port: 3000 + targetPort: 3000 protocol: TCP name: http selector: - {{- include "openops.componentSelectorLabels" (dict "root" . "component" "engine") | nindent 4 }} \ No newline at end of file + {{- include "openops.componentSelectorLabels" (dict "root" . "component" "worker") | nindent 4 }} \ No newline at end of file diff --git a/chart/templates/serviceaccount-engine.yaml b/chart/templates/serviceaccount-worker.yaml similarity index 68% rename from chart/templates/serviceaccount-engine.yaml rename to chart/templates/serviceaccount-worker.yaml index 461b0bf..2d1dfdb 100644 --- a/chart/templates/serviceaccount-engine.yaml +++ b/chart/templates/serviceaccount-worker.yaml @@ -1,14 +1,14 @@ -{{- if .Values.engine.serviceAccount.create }} +{{- if .Values.worker.serviceAccount.create }} apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "openops.serviceAccountName" (dict "root" . "component" "engine") }} + name: {{ include "openops.serviceAccountName" (dict "root" . "component" "worker") }} labels: - {{- include "openops.componentLabels" (dict "root" . "component" "engine") | nindent 4 }} + {{- include "openops.componentLabels" (dict "root" . "component" "worker") | nindent 4 }} {{- with .Values.global.commonLabels }} {{- toYaml . | nindent 4 }} {{- end }} - {{- with .Values.engine.serviceAccount.annotations }} + {{- with .Values.worker.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/chart/templates/servicemonitor.yaml b/chart/templates/servicemonitor.yaml index ff16021..94cda23 100644 --- a/chart/templates/servicemonitor.yaml +++ b/chart/templates/servicemonitor.yaml @@ -20,23 +20,23 @@ spec: interval: {{ .Values.serviceMonitor.interval }} scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} --- -# ServiceMonitor for engine +# ServiceMonitor for worker apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ .Values.engine.name }} + name: {{ .Values.worker.name }} labels: - {{- include "openops.componentLabels" (dict "root" . "component" "engine") | nindent 4 }} + {{- include "openops.componentLabels" (dict "root" . "component" "worker") | nindent 4 }} {{- with .Values.serviceMonitor.labels }} {{- toYaml . | nindent 4 }} {{- end }} spec: selector: matchLabels: - {{- include "openops.componentSelectorLabels" (dict "root" . "component" "engine") | nindent 6 }} + {{- include "openops.componentSelectorLabels" (dict "root" . "component" "worker") | nindent 6 }} endpoints: - port: http - path: {{ .Values.engine.metrics.path }} + path: {{ .Values.worker.metrics.path }} interval: {{ .Values.serviceMonitor.interval }} scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} --- diff --git a/chart/values.ci.yaml b/chart/values.ci.yaml index dd1fb2f..41eef3c 100644 --- a/chart/values.ci.yaml +++ b/chart/values.ci.yaml @@ -41,7 +41,7 @@ app: cpu: "500m" memory: "1Gi" -engine: +worker: replicas: 1 podDisruptionBudget: enabled: false diff --git a/chart/values.production.yaml b/chart/values.production.yaml index f88c63d..e9fd02a 100644 --- a/chart/values.production.yaml +++ b/chart/values.production.yaml @@ -64,7 +64,7 @@ app: memory: "4Gi" cpu: "2000m" -engine: +worker: replicas: 3 resources: requests: diff --git a/chart/values.schema.json b/chart/values.schema.json index fa7f547..1d2df46 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -55,7 +55,7 @@ } } }, - "engine": { + "worker": { "type": "object", "required": ["name", "image", "replicas"], "properties": { @@ -67,7 +67,7 @@ }, "repository": { "type": "string", - "description": "Override global image.repository for engine (empty = use global)" + "description": "Override global image.repository for worker (empty = use global)" }, "replicas": { "type": "integer", diff --git a/chart/values.yaml b/chart/values.yaml index 54d5790..6c55908 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -106,8 +106,8 @@ openopsEnv: OPS_TELEMETRY_MODE: COLLECTOR OPS_TELEMETRY_COLLECTOR_URL: https://telemetry.openops.com/save - # Engine - OPS_ENGINE_URL: '{{ include "openops.engineServiceUrl" . }}/execute' + # Worker + OPS_WORKER_URL: '{{ include "openops.workerServiceUrl" . }}' OPS_EXECUTION_MODE: SANDBOX_CODE_ONLY # Queue @@ -214,9 +214,9 @@ app: port: 8080 path: /metrics -engine: - name: openops-engine - image: openops-engine +worker: + name: openops-worker + image: openops-worker repository: "" # Override global image.repository (empty = use global) replicas: 2 # Minimum 2 for high availability resources: @@ -598,7 +598,7 @@ ingress: - paths: - path: / pathType: Prefix - # serviceName must match a service defined in this chart (nginx, app, engine, tables, analytics) + # serviceName must match a service defined in this chart (nginx, app, worker, tables, analytics) serviceName: nginx servicePort: 80 # TLS-related settings below apply only to nginx ingress controller