Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template ocean volumes & mounts #118

Merged
merged 3 commits into from
Jun 13, 2024
Merged
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
2 changes: 1 addition & 1 deletion charts/port-ocean/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: port-ocean
description: A Helm chart for Port Ocean integrations
type: application
version: 0.2.0
version: 0.3.0
appVersion: "0.1.0"
home: https://getport.io/
sources:
Expand Down
9 changes: 6 additions & 3 deletions charts/port-ocean/README.md

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions charts/port-ocean/templates/cron-job/cron.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{- if eq .Values.workload.kind "CronJob" }}
{{- $maxRunTimeSeconds := "" }}
{{- if (.Values.workload.cron).resyncTimeout }}
{{- if (.Values.workload.cron).resyncTimeoutMinutes }}
{{- $minute := 60 }}
{{- $maxRunTimeSeconds = (mul (.Values.workload.cron).resyncTimeout $minute )}}
{{- $maxRunTimeSeconds = (mul (.Values.workload.cron).resyncTimeoutMinutes $minute )}}
{{- end }}
apiVersion: batch/v1
kind: CronJob
Expand Down Expand Up @@ -48,8 +48,8 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
{{- end }}
initContainers:
{{- with .Values.extraInitContainers }}
{{- toYaml . | nindent 12 }}
{{- if .Values.extraInitContainers }}
{{- tpl (toYaml .Values.extraInitContainers) . | nindent 12 }}
{{- end }}
- name: terminate-old-resync-jobs
image: bitnami/kubectl:latest
Expand Down Expand Up @@ -122,14 +122,19 @@ spec:
- name: SSL_CERT_FILE
value: /etc/ssl/certs/ca-certificates.crt
{{- end }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 14 }}
{{- if .Values.extraEnv }}
{{- tpl (toYaml .Values.extraEnv) . | nindent 14 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "port-ocean.configMapName" . }}
{{- if .Values.secret.useExistingSecret }}
{{- include "port-ocean.additionalSecrets" . | nindent 14 }}
{{- end }}
volumeMounts:
{{- if .Values.extraVolumeMounts }}
{{- tpl (toYaml .Values.extraVolumeMounts) . | nindent 14 }}
{{- end }}
{{- if .Values.selfSignedCertificate.enabled }}
- name: certificates
mountPath: /usr/local/share/ca-certificates/cert.crt
Expand Down Expand Up @@ -159,6 +164,9 @@ spec:
failureThreshold: {{ default 3 .Values.readinessProbe.failureThreshold }}
{{- end }}
volumes:
{{- if .Values.extraVolumes }}
{{- tpl (toYaml .Values.extraVolumes) . | nindent 12 }}
{{- end }}
{{- if and .Values.selfSignedCertificate.enabled .Values.selfSignedCertificate.secret.useExistingSecret }}
- name: certificates
projected:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{- if and (eq .Values.workload.kind "CronJob") }}
{{- $resyncOnInstall := (.Values.workload.cron).resyncOnInstall | default true }}
{{- $resyncOnUpgrade := (.Values.workload.cron).resyncOnUpgrade | default true }}
{{- if and (eq .Values.workload.kind "CronJob") (or $resyncOnInstall $resyncOnUpgrade) }}
{{- $jobName := .Release.Revision }}
apiVersion: batch/v1
kind: Job
Expand Down
16 changes: 12 additions & 4 deletions charts/port-ocean/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- end }}
initContainers:
{{- with .Values.extraInitContainers }}
{{- toYaml . | nindent 8 }}
{{- if .Values.extraInitContainers }}
{{- tpl (toYaml .Values.extraInitContainers) . | nindent 8 }}
{{- end }}
containers:
- name: {{ include "port-ocean.containerName" . }}
Expand All @@ -57,14 +57,19 @@ spec:
- name: SSL_CERT_FILE
value: /etc/ssl/certs/ca-certificates.crt
{{- end }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 10 }}
{{- if .Values.extraEnv }}
{{- tpl (toYaml .Values.extraEnv) . | nindent 10 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "port-ocean.configMapName" . }}
{{- if .Values.secret.useExistingSecret }}
{{- include "port-ocean.additionalSecrets" . | nindent 10 }}
{{- end }}
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
Expand Down Expand Up @@ -94,6 +99,9 @@ spec:
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:
Expand Down
2 changes: 1 addition & 1 deletion charts/port-ocean/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.secret.useExistingSecret false }}
{{- if .Values.secret.create }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
14 changes: 11 additions & 3 deletions charts/port-ocean/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ containerSecurityContext: { }

extraInitContainers: [ ]

extraVolumes: [ ]

extraVolumeMounts: [ ]

workload:
kind: "Deployment" # Deployment, CronJob

deployment:
rolloutStrategy: "Recreate"

# cron:
# resyncTimeout: 60
cron:
# number of minutes to wait before cancelling the resync
resyncTimeoutMinutes: null
resyncOnInstall: true
resyncOnUpgrade: true

resources:
requests:
Expand Down Expand Up @@ -72,12 +79,13 @@ clientTimeout: null
sendRawDataExamples: true

secret:
create: true
useExistingSecret: false
name: ""
# name:
# - "x"
# - "y"
# - "c"
useExistingSecret: false

service:
enabled: true
Expand Down
Loading