diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..f5602ea --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +appVersion: 1.0.0 +description: A Helm chart for Kubernetes +name: polaris-slack +type: application +version: 1.0.0 diff --git a/helm/README.md b/helm/README.md new file mode 100644 index 0000000..612e30a --- /dev/null +++ b/helm/README.md @@ -0,0 +1,8 @@ +# polaris-slack helm chart + +- build docker image +- push to your docker repo +- use this helm chart to create cronjob in Kubernetes cluster (tested with EKS and ArgoCD) +- change main needed parameters in values.yaml ( better overwrite via ArgoCD UI parameters, ** not recommended to keep sensitive info in github repo ** ) + + diff --git a/helm/templates/cronjob.yaml b/helm/templates/cronjob.yaml new file mode 100644 index 0000000..f45f0c7 --- /dev/null +++ b/helm/templates/cronjob.yaml @@ -0,0 +1,45 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: polaris-slack + namespace: default # Namespace where the CronJob is created +spec: + concurrencyPolicy: Forbid # Forbid, Replace, Allow + failedJobsHistoryLimit: 1 # Number of failed jobs to keep + jobTemplate: + metadata: + name: polaris-slack + spec: + template: + metadata: + spec: + containers: + - image: "{{ .Values.image.registry }}:{{ .Values.image.tag }}" # Image to be used for the job + env: + - name: POLARIS_URL + value: {{ .Values.url }} # URL of the Polaris API endpoint + - name: POLARIS_TOKEN + value: {{ .Values.token}} # Token to authenticate with the Polaris API + - name: SLACK_WEBHOOK_URL + value: {{ .Values.webhook }} # URL of the Slack webhook + imagePullPolicy: IfNotPresent + name: polaris-slack + resources: + requests: + memory: {{ .Values.resources.requests.memory }} + cpu: {{ .Values.resources.requests.cpu }} + limits: + memory: {{ .Values.resources.limits.memory }} + cpu: {{ .Values.resources.limits.cpu }} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Never + schedulerName: default-scheduler + securityContext: + runAsNonRoot: true + runAsUser: 1000 + schedule: {{ .Values.cron.schedule }} + successfulJobsHistoryLimit: 0 # Number of successful jobs to keep + suspend: false +status: {} diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..3b8989c --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1,18 @@ +image: + registry: "docker.registry" + tag: "latest" + +url: "https://www.example.com" +token: "token" +webhook: "https://www.example.com" + +resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi + +cron: + schedule: "0 10 * * 5" # Schedule for the CronJob every Friday at 10:00 AM \ No newline at end of file