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
4 changes: 2 additions & 2 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" -}}
Expand Down
2 changes: 2 additions & 0 deletions chart/templates/deployment-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -12,57 +12,56 @@ 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 }}
{{- with .Values.global.commonAnnotations }}
{{- 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 }}
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/external-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
20 changes: 10 additions & 10 deletions chart/templates/hpa-engine.yaml → chart/templates/hpa-worker.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{{- 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 }}
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 }}
18 changes: 9 additions & 9 deletions chart/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -92,7 +92,7 @@ spec:
app.kubernetes.io/component: app
ports:
- protocol: TCP
port: 3005
port: 3000
egress:
- to:
- podSelector:
Expand Down Expand Up @@ -306,7 +306,7 @@ spec:
- from:
- podSelector:
matchLabels:
app.kubernetes.io/component: engine
app.kubernetes.io/component: worker
ports:
- protocol: TCP
port: 5432
Expand Down Expand Up @@ -358,7 +358,7 @@ spec:
- from:
- podSelector:
matchLabels:
app.kubernetes.io/component: engine
app.kubernetes.io/component: worker
ports:
- protocol: TCP
port: 6379
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion chart/templates/secret-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }}
{{- include "openops.componentSelectorLabels" (dict "root" . "component" "worker") | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
10 changes: 5 additions & 5 deletions chart/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
---
Expand Down
2 changes: 1 addition & 1 deletion chart/values.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ app:
cpu: "500m"
memory: "1Gi"

engine:
worker:
replicas: 1
podDisruptionBudget:
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion chart/values.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ app:
memory: "4Gi"
cpu: "2000m"

engine:
worker:
replicas: 3
resources:
requests:
Expand Down
4 changes: 2 additions & 2 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
}
},
"engine": {
"worker": {
"type": "object",
"required": ["name", "image", "replicas"],
"properties": {
Expand All @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Loading