Skip to content

Commit

Permalink
Merge pull request #28 from foomo/keel-cronjob-0.1.0
Browse files Browse the repository at this point in the history
docs(keel-cronjob): add chart
  • Loading branch information
franklinkim authored Oct 23, 2024
2 parents a48227b + dbfc96b commit c6c12d5
Show file tree
Hide file tree
Showing 32 changed files with 2,051 additions and 27 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ docs:
schema: PWD=$(pwd)
schema:
#helm-schema -n -c charts/namespace
helm-schema -n -c charts/squadron-keel-server
helm-schema -n -c charts/keel-server
helm-schema -n -c charts/keel-cronjob
helm schema-gen charts/namespace/values.yaml > charts/namespace/values.schema.json
helm schema-gen charts/beam/values.yaml > charts/beam/values.schema.json
helm schema-gen charts/contentserver/values.yaml > charts/contentserver/values.schema.json
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
apiVersion: v2
type: application
name: squadron-keel-server
description: Squadron Keel Server chart
name: keel-cronjob
description: Keel CronJob Chart
icon: https://avatars.githubusercontent.com/u/889755?s=200&v=4
home: https://www.foomo.org
keywords:
- foomo
- foomo-keel
- foomo-squadron
sources:
- https://github.com/foomo/helm-charts
annotations:
"artifacthub.io/links": |
- name: Chart Source
url: https://github.com/foomo/helm-charts
version: 0.1.3
appVersion: 0.1.3
version: 0.1.0
appVersion: 0.1.0
105 changes: 105 additions & 0 deletions charts/keel-cronjob/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# keel-cronjob

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)

Keel CronJob Chart

**Homepage:** <https://www.foomo.org>

## Source Code

* <https://github.com/foomo/helm-charts>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| cronjob | object | `{"additionalEnv":[],"additionalEnvFrom":[],"additionalLabels":{},"additionalVolumeMounts":[],"additionalVolumes":[],"annotations":{},"backoffLimit":0,"concurrency":"Forbid","historyLimit":1,"hostAliases":[],"jobAnnotations":{},"jobLabels":{},"livenessProbe":{"httpGet":{"path":"/healthz/liveness","port":"healthz"}},"podAnnotations":{},"readinessProbe":{"httpGet":{"path":"/healthz/readiness","port":"healthz"}},"resources":{},"restart":"Never","startupProbe":{"httpGet":{"path":"/healthz/startup","port":"healthz"}}}` | CronJob settings |
| cronjob.additionalEnv | list | `[]` | Additional environment variables |
| cronjob.additionalEnvFrom | list | `[]` | Additional env from |
| cronjob.additionalLabels | object | `{}` | Additional labels |
| cronjob.additionalVolumeMounts | list | `[]` | Additional volume mounts |
| cronjob.additionalVolumes | list | `[]` | Additional volumes |
| cronjob.annotations | object | `{}` | Deployment annotations |
| cronjob.backoffLimit | int | `0` | Successful history item to keep |
| cronjob.concurrency | string | `"Forbid"` | Concurency policy |
| cronjob.historyLimit | int | `1` | Max history item to keep |
| cronjob.hostAliases | list | `[]` | Host aliases |
| cronjob.jobAnnotations | object | `{}` | Pod annotations |
| cronjob.jobLabels | object | `{}` | Job labels |
| cronjob.livenessProbe | object | `{"httpGet":{"path":"/healthz/liveness","port":"healthz"}}` | Liveness probe settings |
| cronjob.podAnnotations | object | `{}` | Pod annotations |
| cronjob.readinessProbe | object | `{"httpGet":{"path":"/healthz/readiness","port":"healthz"}}` | Readiness probe settings |
| cronjob.resources | object | `{}` | See: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ |
| cronjob.restart | string | `"Never"` | Restart policy |
| cronjob.startupProbe | object | `{"httpGet":{"path":"/healthz/startup","port":"healthz"}}` | Startup probe settings |
| env | object | `{}` | FOO: bar |
| fleet | string | `""` | Squadron fleet name |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| graceful | object | `{"delaySeconds":15,"enabled":false,"periodSeconds":45}` | Graceful shutdown settings |
| graceful.delaySeconds | int | `15` | Seconds to wait for kubernetes to deregister |
| graceful.enabled | bool | `false` | Indicates wether graceful shutdown is enabled |
| graceful.periodSeconds | int | `45` | Total seconds for the grace period |
| image | object | `{"pullPolicy":"IfNotPresent","pullSecrets":[],"repository":"","tag":""}` | Image settings |
| image.pullPolicy | string | `"IfNotPresent"` | Image tag |
| image.pullSecrets | list | `[]` | Image pull secrets |
| image.repository | string | `""` | Image repository |
| image.tag | string | `""` | Image tag |
| log | object | `{"level":"info","mode":"prod"}` | Log settings |
| log.level | string | `"info"` | Log level |
| log.mode | string | `"prod"` | Log mode |
| nameOverride | string | `""` | Overrides the chart's name |
| namespaceOverride | string | `""` | If not set, `.Release.Namespace` is used |
| networkPolicy.egress | object | `{"additionalRules":[],"allowExternal":true,"enabled":true}` | Egress settings |
| networkPolicy.egress.additionalRules | list | `[]` | Additional egress rules |
| networkPolicy.egress.allowExternal | bool | `true` | Allow ingress through labels |
| networkPolicy.egress.enabled | bool | `true` | Specifies whether egress should be enabled |
| networkPolicy.enabled | bool | `false` | Specifies whether Network Policies should be created |
| networkPolicy.ingress | object | `{"additionalRules":[],"allowExternal":true,"enabled":true}` | Ingress settings |
| networkPolicy.ingress.additionalRules | list | `[]` | Additional ingress rules |
| networkPolicy.ingress.allowExternal | bool | `true` | Allow ingress through labels |
| networkPolicy.ingress.enabled | bool | `true` | Specifies whether ingress should be enabled |
| networkPolicy.rules | list | `[]` | |
| otel | object | `{"enabled":false,"gorm":{"enabled":true,"sqlParametersDisabled":true},"gotsrpc":{"enabled":true,"payloadAttributeDisabled":true},"mongo":{"commandAttributeDisabled":true,"enabled":true},"otlp":{"endpoint":"alloy:4317","insecure":true},"ratio":1}` | OpenTelemetry settings |
| otel.enabled | bool | `false` | Indicates wether to enable it or not |
| otel.gorm | object | `{"enabled":true,"sqlParametersDisabled":true}` | GORM settings |
| otel.gorm.sqlParametersDisabled | bool | `true` | Indicates wether to trace sql attributes |
| otel.gotsrpc | object | `{"enabled":true,"payloadAttributeDisabled":true}` | GOTSRPC settings |
| otel.gotsrpc.enabled | bool | `true` | Indicates wether to enable it or not |
| otel.gotsrpc.payloadAttributeDisabled | bool | `true` | Indicates wether to trace payload attributes |
| otel.mongo | object | `{"commandAttributeDisabled":true,"enabled":true}` | Mongo settings |
| otel.mongo.commandAttributeDisabled | bool | `true` | Indicates wether to trace command attributes |
| otel.mongo.enabled | bool | `true` | Indicates wether to enable it or not |
| otel.otlp | object | `{"endpoint":"alloy:4317","insecure":true}` | OTLP exporter settings |
| otel.otlp.endpoint | string | `"alloy:4317"` | Enpoint uri |
| otel.otlp.insecure | bool | `true` | Indicates wether to use insecure connection |
| otel.ratio | int | `1` | Trace ratio |
| persistence | object | `{"accessMode":"ReadWriteOnce","enabled":false,"mountPath":"/var/lib/cronjob/data","size":"1Gi","storageClass":""}` | Persistence settings |
| persistence.accessMode | string | `"ReadWriteOnce"` | Access mode |
| persistence.enabled | bool | `false` | Indicates wether a pv should be attached or not |
| persistence.mountPath | string | `"/var/lib/cronjob/data"` | Storage mount path |
| persistence.size | string | `"1Gi"` | Storage size |
| persistence.storageClass | string | `""` | Storage class name |
| rbac | object | `{"enabled":false}` | RBAC configuration |
| rbac.enabled | bool | `false` | Create PodSecurityPolicy. |
| revisionHistoryLimit | int | `10` | Number of revisions to keep |
| schedule | string | `""` | Cron job schedule |
| scheduling | object | `{"affinity":{},"enabled":false,"nodeSelector":{},"priorityClass":null,"tolerations":[]}` | Scheduling settings |
| scheduling.affinity | object | `{}` | Affinity for pod assignment |
| scheduling.enabled | bool | `false` | Indicates wether scheduling is enabled or not |
| scheduling.nodeSelector | object | `{}` | Node labels for pod assignment |
| scheduling.tolerations | list | `[]` | Tolerations for pod assignment |
| secretEnv | object | `{}` | Map of environment variables to add as a secret |
| secretMounts | list | `[]` | |
| securityContext | object | `{"fsGroup":10001,"runAsGroup":10001,"runAsNonRoot":true,"runAsUser":10001}` | Security context |
| securityContext.fsGroup | int | `10001` | File system group id |
| securityContext.runAsGroup | int | `10001` | Run as group id |
| securityContext.runAsNonRoot | bool | `true` | Indicates wether to run as non root user |
| securityContext.runAsUser | int | `10001` | Run as user id |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template |
| squadron | string | `""` | Squadron name |
| timeZone | string | `"Europe/Berlin"` | Cron job time zone |
| unit | string | `""` | Squadron unit name |
File renamed without changes.
157 changes: 157 additions & 0 deletions charts/keel-cronjob/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "keel.cronjob.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "keel.cronjob.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- tpl .Values.fullnameOverride . | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "keel.cronjob.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "keel.cronjob.chart-revision" -}}
{{- printf "%s-%s-%d" .Chart.Name .Chart.Version .Release.Revision | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "keel.cronjob.labels" -}}
helm.sh/chart: {{ include "keel.cronjob.chart" . }}
{{ include "keel.cronjob.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "keel.cronjob.selectorLabels" -}}
app.kubernetes.io/name: {{ include "keel.cronjob.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Networking labels
*/}}
{{- define "keel.cronjob.networkingLabels" -}}
{{- if .Values.networkPolicy.enabled }}
{{- range .Values.networkPolicy.rules }}
networking/{{ . }}: "true"
{{- end}}
{{- if .Values.networkPolicy.ingress.enabled }}
{{- if .Values.networkPolicy.ingress.allowExternal }}
kubernetes.io/networking.name: {{ include "keel.cronjob.fullname" . }}
{{- end}}
{{- end}}
{{- end }}
{{- end }}

{{/*
Create the name of the namespace
*/}}
{{- define "keel.cronjob.namespace" -}}
{{- default .Release.Namespace .Values.namespaceOverride }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "keel.cronjob.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "keel.cronjob.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Keel standard envs
{{- include "keel.cronjob.env.log" . | nindent 12 }}
*/}}
{{- define "keel.cronjob.env.log" -}}
- name: LOG_MODE
value: "{{ .Values.log.mode }}"
- name: LOG_LEVEL
value: "{{ .Values.log.level }}"
{{- if eq .Values.log.mode "dev" }}
- name: LOG_DISABLE_CALLER
value: "false"
- name: LOG_DISABLE_STACKTRACE
value: "true"
{{- end }}
{{- end -}}

{{/*
Squadron standard envs
{{- include "keel.cronjob.env.squadron" . | nindent 12 }}
*/}}
{{- define "keel.cronjob.env.squadron" -}}
{{- if .Values.fleet }}
- name: FLEET
value: {{ .Values.fleet | quote }}
{{- end }}
{{- if .Values.squadron }}
- name: SQUADRON
value: {{ .Values.squadron | quote }}
{{- end }}
{{- if .Values.unit }}
- name: UNIT
value: {{ .Values.unit | quote }}
{{- end }}
{{- end -}}

{{/*
OpenTelemetry standard envs
{{- include "keel.cronjob.env.opentelemetry" . | nindent 12 }}
*/}}
{{- define "keel.cronjob.env.opentelemetry" -}}
- name: OTEL_ENABLED
value: "{{ .Values.otel.enabled }}"
- name: OTEL_SERVICE_NAME
value: {{ include "keel.cronjob.fullname" . | quote }}
- name: OTEL_TRACE_RATIO
value: "{{ .Values.otel.ratio }}"
- name: OTEL_GORM_ENABLED
value: "{{ .Values.otel.gorm.enabled }}"
- name: OTEL_GORM_SQL_PARAMETERS_ENABLED
value: "{{ not .Values.otel.gorm.sqlParametersDisabled }}"
- name: OTEL_MONGO_ENABLED
value: "{{ .Values.otel.mongo.enabled }}"
- name: OTEL_MONGO_COMMAND_ATTRIBUTE_DISABLED
value: "{{ .Values.otel.mongo.commandAttributeDisabled }}"
- name: OTEL_GOTSRPC_ENABLED
value: "{{ .Values.otel.gotsrpc.enabled }}"
- name: OTEL_GOTSRPC_PAYLOAD_ATTRIBUTE_DISABLED
value: "{{ .Values.otel.gotsrpc.payloadAttributeDisabled }}"
- name: OTEL_EXPORTER_OTLP_INSECURE
value: "{{ .Values.otel.otlp.insecure }}"
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: "{{ .Values.otel.otlp.endpoint }}"
{{- end -}}
Loading

0 comments on commit c6c12d5

Please sign in to comment.