From 7347e2fc46526e9fbc0d890b8c467936a88e3241 Mon Sep 17 00:00:00 2001 From: stavbernazport Date: Tue, 7 Jan 2025 11:58:15 +0200 Subject: [PATCH] split liveevents deployment manifest --- charts/port-ocean/templates/_helpers.tpl | 9 ++ .../port-ocean/templates/cron-job/cron.yaml | 1 + .../templates/deployment-live-events.yaml | 141 ++++++++++++++++++ charts/port-ocean/templates/deployment.yaml | 2 +- charts/port-ocean/values.yaml | 45 +++--- 5 files changed, 180 insertions(+), 18 deletions(-) create mode 100644 charts/port-ocean/templates/deployment-live-events.yaml diff --git a/charts/port-ocean/templates/_helpers.tpl b/charts/port-ocean/templates/_helpers.tpl index 957236d..9d51c66 100644 --- a/charts/port-ocean/templates/_helpers.tpl +++ b/charts/port-ocean/templates/_helpers.tpl @@ -45,6 +45,15 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{- end }} +{{/* +Live Events labels +*/}} +{{- define "port-ocean.liveEventsLabels" -}} +{{- if .Values.liveEvents.enabled -}} +liveEvents: "true" +{{- end }} +{{- end }} + {{/* Selector labels */}} diff --git a/charts/port-ocean/templates/cron-job/cron.yaml b/charts/port-ocean/templates/cron-job/cron.yaml index 984c99a..468b578 100644 --- a/charts/port-ocean/templates/cron-job/cron.yaml +++ b/charts/port-ocean/templates/cron-job/cron.yaml @@ -1,3 +1,4 @@ +{{- if eq .Values.workload.kind "CronJob" }} {{- if or (eq .Values.workload.kind "CronJob") (eq .Values.workload.kind "DeploymentAndCronJob") }} {{- $maxRunTimeSeconds := "" }} diff --git a/charts/port-ocean/templates/deployment-live-events.yaml b/charts/port-ocean/templates/deployment-live-events.yaml new file mode 100644 index 0000000..e9f7e11 --- /dev/null +++ b/charts/port-ocean/templates/deployment-live-events.yaml @@ -0,0 +1,141 @@ +{{- if .Values.liveEvents.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "{{ include "port-ocean.deploymentName" . }}-live-events" + labels: + {{- include "port-ocean.labels" . | nindent 4 }} + {{- include "port-ocean.liveEventsLabels" . | nindent 4 }} +spec: + strategy: + type: {{ .Values.workload.deployment.rolloutStrategy | default "Recreate" }} + replicas: 1 + selector: + matchLabels: + app: "{{ include "port-ocean.deploymentName" . }}-live-events" + {{- include "port-ocean.selectorLabels" . | indent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: "{{ include "port-ocean.deploymentName" . }}-live-events" + {{- include "port-ocean.labels" . | nindent 8 }} + spec: + {{- with .Values.podServiceAccount.name }} + serviceAccountName: {{ . }} + {{- end }} + terminationGracePeriodSeconds: {{ default 30 .Values.terminationGracePeriodSeconds }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- if .Values.podSecurityContext }} + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- end }} + initContainers: + {{- if .Values.extraInitContainers }} + {{- tpl (toYaml .Values.extraInitContainers) . | nindent 8 }} + {{- end }} + containers: + - name: {{ include "port-ocean.containerName" . }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + image: '{{ .Values.imageRegistry }}/port-ocean-{{ .Values.integration.type }}:{{ .Values.integration.version | default "latest" }}' + {{- if .Values.service.enabled }} + securityContext: + {{- if .Values.containerSecurityContext }} + {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + resources: + {{- if .Values.liveEvents.resources }} + {{- toYaml .Values.liveEvents.resources | nindent 10 }} + {{- end }} + ports: + - containerPort: {{.Values.service.port}} + protocol: TCP + {{- end }} + env: + {{- if .Values.selfSignedCertificate.enabled }} + - name: SSL_CERT_FILE + value: /etc/ssl/certs/ca-certificates.crt + - name: REQUESTS_CA_BUNDLE + value: /etc/ssl/certs/ca-certificates.crt + {{- end }} + {{- if .Values.extraEnv }} + {{- tpl (toYaml .Values.extraEnv) . | nindent 10 }} + {{- end }} + envFrom: + - configMapRef: + name: {{ include "port-ocean.configMapName" . }} + {{- include "port-ocean.additionalSecrets" . | nindent 10 }} + volumeMounts: + {{- if .Values.extraVolumeMounts }} + {{- tpl (toYaml .Values.extraVolumeMounts) . | nindent 8 }} + {{- end }} + {{- if .Values.selfSignedCertificate.enabled }} + - name: certificates + mountPath: /usr/local/share/ca-certificates/cert.crt + subPath: cert.crt + readOnly: true + {{- end }} + {{- if (.Values.livenessProbe).enabled}} + livenessProbe: + httpGet: + path: /docs + port: {{.Values.service.port}} + initialDelaySeconds: {{ default 30 .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ default 10 .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ default 5 .Values.livenessProbe.timeoutSeconds }} + successThreshold: 1 + failureThreshold: {{ default 3 .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if (.Values.readinessProbe).enabled}} + readinessProbe: + httpGet: + path: /docs + port: {{.Values.service.port}} + initialDelaySeconds: {{ default 30 .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ default 10 .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ default 5 .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ default 2 .Values.readinessProbe.successThreshold }} + failureThreshold: {{ default 3 .Values.readinessProbe.failureThreshold }} + {{- end }} + volumes: + {{- if .Values.extraVolumes }} + {{- tpl (toYaml .Values.extraVolumes) . | nindent 8 }} + {{- end }} + {{- if and .Values.selfSignedCertificate.enabled .Values.selfSignedCertificate.secret.useExistingSecret }} + - name: certificates + projected: + sources: + - secret: + name: {{ .Values.selfSignedCertificate.secret.name }} + items: + - key: {{ .Values.selfSignedCertificate.secret.key }} + path: cert.crt + {{- else if .Values.selfSignedCertificate.enabled }} + - name: certificates + projected: + sources: + - secret: + name: {{ include "port-ocean.selfSignedCertName" . }} + items: + - key: crt + path: cert.crt + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/port-ocean/templates/deployment.yaml b/charts/port-ocean/templates/deployment.yaml index dc18461..3ed1408 100644 --- a/charts/port-ocean/templates/deployment.yaml +++ b/charts/port-ocean/templates/deployment.yaml @@ -1,4 +1,4 @@ -{{- if or (eq .Values.workload.kind "Deployment") (eq .Values.workload.kind "DeploymentAndCronJob") }} +{{- if eq .Values.workload.kind "Deployment" }} apiVersion: apps/v1 kind: Deployment metadata: diff --git a/charts/port-ocean/values.yaml b/charts/port-ocean/values.yaml index 310e55f..b7af073 100644 --- a/charts/port-ocean/values.yaml +++ b/charts/port-ocean/values.yaml @@ -7,7 +7,7 @@ port: baseUrl: https://api.getport.io -podAnnotations: { } +podAnnotations: {} podServiceAccount: name: null @@ -17,23 +17,23 @@ extraEnv: # - name: HTTPS_PROXY # value: http://myproxy.com -podSecurityContext: { } +podSecurityContext: {} # Example # runAsGroup: 1001 # runAsUser: 1001 # fsGroup: 1001 # fsGroupChangePolicy: "OnRootMismatch" -containerSecurityContext: { } +containerSecurityContext: {} # Example # runAsGroup: 1001 # runAsUser: 1001 # allowPrivilegeEscalation: false -extraInitContainers: [ ] +extraInitContainers: [] -extraVolumes: [ ] +extraVolumes: [] -extraVolumeMounts: [ ] +extraVolumeMounts: [] workload: kind: "Deployment" # Deployment, CronJob, DeploymentAndCronJob @@ -56,19 +56,19 @@ resources: memory: "1024Mi" cpu: "500m" -nodeSelector: { } +nodeSelector: {} -tolerations: [ ] +tolerations: [] -affinity: { } +affinity: {} -extraLabels: { } +extraLabels: {} imageRegistry: "ghcr.io/port-labs" imagePullPolicy: Always -imagePullSecrets: [ ] +imagePullSecrets: [] initializePortResources: true @@ -97,16 +97,16 @@ service: enabled: true type: ClusterIP port: 8000 - annotations: { } + annotations: {} ingress: enabled: false className: "" - annotations: { } + annotations: {} host: null path: / pathType: Prefix - tls: [ ] + tls: [] # Example # - secretName: my-secret # hosts: @@ -116,8 +116,8 @@ integration: identifier: "" version: "" type: "" - config: { } - secrets: { } + config: {} + secrets: {} eventListener: type: "KAFKA" brokers: "b-1-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196,b-2-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196,b-3-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196" @@ -130,6 +130,17 @@ selfSignedCertificate: key: crt useExistingSecret: false +liveEvents: + enabled: false + ingestBaseUrl: "" + + resources: + requests: + memory: "512Mi" + cpu: "200m" + limits: + memory: "1024Mi" + cpu: "500m" livenessProbe: enabled: true @@ -144,4 +155,4 @@ readinessProbe: # periodSeconds: 10 # timeoutSeconds: 5 # failureThreshold: 3 -# successThreshold: 2 \ No newline at end of file +# successThreshold: 2