Skip to content

Commit

Permalink
split liveevents deployment manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
stavbernazport committed Jan 7, 2025
1 parent d193eb7 commit 67d99f4
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 21 deletions.
9 changes: 9 additions & 0 deletions charts/port-ocean/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/}}
Expand Down
3 changes: 1 addition & 2 deletions charts/port-ocean/templates/cron-job/cron.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- if or (eq .Values.workload.kind "CronJob") (eq .Values.workload.kind "DeploymentAndCronJob") }}

{{- if eq .Values.workload.kind "CronJob" }}
{{- $maxRunTimeSeconds := "" }}
{{- if (.Values.workload.cron).resyncTimeoutMinutes }}
{{- $minute := 60 }}
Expand Down
141 changes: 141 additions & 0 deletions charts/port-ocean/templates/deployment-live-events.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion charts/port-ocean/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
47 changes: 29 additions & 18 deletions charts/port-ocean/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ port:

baseUrl: https://api.getport.io

podAnnotations: { }
podAnnotations: {}

podServiceAccount:
name: null
Expand All @@ -17,26 +17,26 @@ 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
kind: "Deployment" # Deployment, CronJob

deployment:
rolloutStrategy: "Recreate"
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -144,4 +155,4 @@ readinessProbe:
# periodSeconds: 10
# timeoutSeconds: 5
# failureThreshold: 3
# successThreshold: 2
# successThreshold: 2

0 comments on commit 67d99f4

Please sign in to comment.