From 1f492c0e623230f91f704d281acd0f83176302a2 Mon Sep 17 00:00:00 2001 From: yair Date: Wed, 19 Jun 2024 13:20:42 +0300 Subject: [PATCH 1/4] podServiceAccount --- charts/port-ocean/README.md | 1 + charts/port-ocean/templates/cron-job/cron.yaml | 3 +++ .../port-ocean/templates/cron-job/installation-resync-job.yml | 2 +- charts/port-ocean/templates/deployment.yaml | 3 +++ charts/port-ocean/values.yaml | 3 +++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/charts/port-ocean/README.md b/charts/port-ocean/README.md index 30d2cbe..126da73 100644 --- a/charts/port-ocean/README.md +++ b/charts/port-ocean/README.md @@ -56,6 +56,7 @@ The following table lists the configuration parameters of the `port-ocean` chart | `scheduledResyncInterval` | The number in minutes to reschedule and poll data from the 3rd party system. When workload.kind is set to CronJob this parameter is required and should be in a format of a cron string | `null` | | `sendRawDataExamples` | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping | `true` | | `podAnnotations` | Annotations to be added to the pod. | `{}` | +| `podServiceAccount.name` | Service account to attach to the pod. | `null` | | `podSecurityContext` | Security context applied to the pod. | `{}` | | `containerSecurityContext` | Security context applied to the container. | `{}` | | `extraInitContainers` | Additional init containers to be added to the pod. | `[]` | diff --git a/charts/port-ocean/templates/cron-job/cron.yaml b/charts/port-ocean/templates/cron-job/cron.yaml index 2db7e0c..3c877cb 100644 --- a/charts/port-ocean/templates/cron-job/cron.yaml +++ b/charts/port-ocean/templates/cron-job/cron.yaml @@ -38,6 +38,9 @@ spec: app: {{ include "port-ocean.cronJobName" . }} {{- include "port-ocean.labels" . | nindent 12 }} spec: + {{- with .Values.podServiceAccount.name }} + serviceAccountName: {{ . }} + {{- end }} restartPolicy: Never {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/port-ocean/templates/cron-job/installation-resync-job.yml b/charts/port-ocean/templates/cron-job/installation-resync-job.yml index 3122a7e..0705ba1 100644 --- a/charts/port-ocean/templates/cron-job/installation-resync-job.yml +++ b/charts/port-ocean/templates/cron-job/installation-resync-job.yml @@ -1,7 +1,7 @@ {{- $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 }} +{{- $jobName := print (randAlphaNum 4) .Release.Revision }} apiVersion: batch/v1 kind: Job metadata: diff --git a/charts/port-ocean/templates/deployment.yaml b/charts/port-ocean/templates/deployment.yaml index bd132ed..9e024c5 100644 --- a/charts/port-ocean/templates/deployment.yaml +++ b/charts/port-ocean/templates/deployment.yaml @@ -23,6 +23,9 @@ spec: app: {{ include "port-ocean.deploymentName" . }} {{- include "port-ocean.labels" . | nindent 8 }} spec: + {{- with .Values.podServiceAccount.name }} + serviceAccountName: {{ . }} + {{- end }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} diff --git a/charts/port-ocean/values.yaml b/charts/port-ocean/values.yaml index 9859ecf..045f24e 100644 --- a/charts/port-ocean/values.yaml +++ b/charts/port-ocean/values.yaml @@ -9,6 +9,9 @@ port: podAnnotations: { } +podServiceAccount: + name: null + extraEnv: # Example # - name: HTTPS_PROXY From 73216577fb00f378e9872173885bf51fa22c9aa2 Mon Sep 17 00:00:00 2001 From: yair Date: Wed, 19 Jun 2024 13:20:42 +0300 Subject: [PATCH 2/4] podServiceAccount --- charts/port-ocean/README.md | 1 + charts/port-ocean/templates/cron-job/cron.yaml | 3 +++ .../port-ocean/templates/cron-job/installation-resync-job.yml | 2 +- charts/port-ocean/templates/deployment.yaml | 3 +++ charts/port-ocean/values.yaml | 3 +++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/charts/port-ocean/README.md b/charts/port-ocean/README.md index 30d2cbe..126da73 100644 --- a/charts/port-ocean/README.md +++ b/charts/port-ocean/README.md @@ -56,6 +56,7 @@ The following table lists the configuration parameters of the `port-ocean` chart | `scheduledResyncInterval` | The number in minutes to reschedule and poll data from the 3rd party system. When workload.kind is set to CronJob this parameter is required and should be in a format of a cron string | `null` | | `sendRawDataExamples` | Enable sending raw data examples from the third party API to port for testing and managing the integration mapping | `true` | | `podAnnotations` | Annotations to be added to the pod. | `{}` | +| `podServiceAccount.name` | Service account to attach to the pod. | `null` | | `podSecurityContext` | Security context applied to the pod. | `{}` | | `containerSecurityContext` | Security context applied to the container. | `{}` | | `extraInitContainers` | Additional init containers to be added to the pod. | `[]` | diff --git a/charts/port-ocean/templates/cron-job/cron.yaml b/charts/port-ocean/templates/cron-job/cron.yaml index 8c7f99c..470f2c9 100644 --- a/charts/port-ocean/templates/cron-job/cron.yaml +++ b/charts/port-ocean/templates/cron-job/cron.yaml @@ -38,6 +38,9 @@ spec: app: {{ include "port-ocean.cronJobName" . }} {{- include "port-ocean.labels" . | nindent 12 }} spec: + {{- with .Values.podServiceAccount.name }} + serviceAccountName: {{ . }} + {{- end }} restartPolicy: Never {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/port-ocean/templates/cron-job/installation-resync-job.yml b/charts/port-ocean/templates/cron-job/installation-resync-job.yml index 3122a7e..0705ba1 100644 --- a/charts/port-ocean/templates/cron-job/installation-resync-job.yml +++ b/charts/port-ocean/templates/cron-job/installation-resync-job.yml @@ -1,7 +1,7 @@ {{- $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 }} +{{- $jobName := print (randAlphaNum 4) .Release.Revision }} apiVersion: batch/v1 kind: Job metadata: diff --git a/charts/port-ocean/templates/deployment.yaml b/charts/port-ocean/templates/deployment.yaml index cb9d2a8..466a7b3 100644 --- a/charts/port-ocean/templates/deployment.yaml +++ b/charts/port-ocean/templates/deployment.yaml @@ -23,6 +23,9 @@ spec: app: {{ include "port-ocean.deploymentName" . }} {{- include "port-ocean.labels" . | nindent 8 }} spec: + {{- with .Values.podServiceAccount.name }} + serviceAccountName: {{ . }} + {{- end }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} diff --git a/charts/port-ocean/values.yaml b/charts/port-ocean/values.yaml index 69375c9..fb5e994 100644 --- a/charts/port-ocean/values.yaml +++ b/charts/port-ocean/values.yaml @@ -9,6 +9,9 @@ port: podAnnotations: { } +podServiceAccount: + name: null + extraEnv: # Example # - name: HTTPS_PROXY From a9f600a2137ede51507502116117e079e1efcdde Mon Sep 17 00:00:00 2001 From: yair Date: Wed, 19 Jun 2024 13:22:07 +0300 Subject: [PATCH 3/4] podServiceAccount --- charts/port-ocean/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/port-ocean/Chart.yaml b/charts/port-ocean/Chart.yaml index 6164e4d..a997576 100644 --- a/charts/port-ocean/Chart.yaml +++ b/charts/port-ocean/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: port-ocean description: A Helm chart for Port Ocean integrations type: application -version: 0.3.3 +version: 0.4.0 appVersion: "0.1.0" home: https://getport.io/ sources: From 5d9c36d6a9777071e4d8cebc77ce143c07a259ec Mon Sep 17 00:00:00 2001 From: yair Date: Wed, 19 Jun 2024 13:51:15 +0300 Subject: [PATCH 4/4] podServiceAccount --- .../port-ocean/templates/cron-job/installation-resync-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/port-ocean/templates/cron-job/installation-resync-job.yml b/charts/port-ocean/templates/cron-job/installation-resync-job.yml index 0705ba1..e0c70c4 100644 --- a/charts/port-ocean/templates/cron-job/installation-resync-job.yml +++ b/charts/port-ocean/templates/cron-job/installation-resync-job.yml @@ -1,7 +1,7 @@ {{- $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 := print (randAlphaNum 4) .Release.Revision }} +{{- $jobName := print (randAlphaNum 4) "-" .Release.Revision }} apiVersion: batch/v1 kind: Job metadata: