commit 3792eaa844401844da11450e517c7cf5e31d90d3 Author: Markus Pesch Date: Sun Sep 26 17:08:01 2021 +0200 Initial Commit diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..004d2d0 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,101 @@ +--- +kind: pipeline +type: kubernetes +name: linter + +platform: + os: linux + arch: amd64 + +steps: +- name: helm lint + commands: + - helm lint + image: quay.io/helmpack/chart-testing:latest + resources: + limits: + cpu: 50 + memory: 50M + +- name: markdown lint + commands: + - markdownlint *.md + image: docker.io/volkerraschek/markdownlint:0.28.1 + resources: + limits: + cpu: 50 + memory: 50M + +- name: email-notification + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + image: docker.io/drillster/drone-email:latest + resources: + limits: + cpu: 50 + memory: 25M + when: + status: + - changed + - failure + +trigger: + event: + exclude: + - tag + +--- +kind: pipeline +type: kubernetes +name: sync + +platform: + os: linux + arch: amd64 + +steps: +- name: github + image: docker.io/appleboy/drone-git-push:latest + resources: + limits: + cpu: 50 + memory: 25M + settings: + branch: master + remote: ssh://git@github.com/volker-raschek/postfixadmin-fetchmail-charts.git + force: true + ssh_key: + from_secret: ssh_key + +- name: email-notification + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + image: docker.io/drillster/drone-email:latest + resources: + limits: + cpu: 50 + memory: 25M + when: + status: + - changed + - failure + +trigger: + event: + - push + repo: + - volker.raschek/postfixadmin-fetchmail-charts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cdcaed9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.tgz +values2.yml +values2.yaml \ No newline at end of file diff --git a/.helmignore b/.helmignore new file mode 100644 index 0000000..22b5ff9 --- /dev/null +++ b/.helmignore @@ -0,0 +1,32 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# drone +.drone.yml +# markdownlint +.markdownlint.yaml +# customized values +values2.yml +values2.yaml +# helm packages +*.tgz \ No newline at end of file diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..c158976 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,144 @@ +# markdownlint YAML configuration +# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml + +# Default state for all rules +default: true + +# Path to configuration file to extend +extends: null + +# MD003/heading-style/header-style - Heading style +MD003: + # Heading style + style: "atx" + +# MD004/ul-style - Unordered list style +MD004: + style: "dash" + +# MD007/ul-indent - Unordered list indentation +MD007: + # Spaces for indent + indent: 2 + # Whether to indent the first level of the list + start_indented: false + +# MD009/no-trailing-spaces - Trailing spaces +MD009: + # Spaces for line break + br_spaces: 2 + # Allow spaces for empty lines in list items + list_item_empty_lines: false + # Include unnecessary breaks + strict: false + +# MD010/no-hard-tabs - Hard tabs +MD010: + # Include code blocks + code_blocks: true + +# MD012/no-multiple-blanks - Multiple consecutive blank lines +MD012: + # Consecutive blank lines + maximum: 1 + +# MD013/line-length - Line length +MD013: + # Number of characters + line_length: 80 + # Number of characters for headings + heading_line_length: 80 + # Number of characters for code blocks + code_block_line_length: 80 + # Include code blocks + code_blocks: false + # Include tables + tables: false + # Include headings + headings: true + # Include headings + headers: true + # Strict length checking + strict: false + # Stern length checking + stern: false + +# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines +MD022: + # Blank lines above heading + lines_above: 1 + # Blank lines below heading + lines_below: 1 + +# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content +MD024: + # Only check sibling headings + allow_different_nesting: true + +# MD025/single-title/single-h1 - Multiple top-level headings in the same document +MD025: + # Heading level + level: 1 + # RegExp for matching title in front matter + front_matter_title: "^\\s*title\\s*[:=]" + +# MD026/no-trailing-punctuation - Trailing punctuation in heading +MD026: + # Punctuation characters + punctuation: ".,;:!。,;:!" + +# MD029/ol-prefix - Ordered list item prefix +MD029: + # List style + style: "one_or_ordered" + +# MD030/list-marker-space - Spaces after list markers +MD030: + # Spaces for single-line unordered list items + ul_single: 1 + # Spaces for single-line ordered list items + ol_single: 1 + # Spaces for multi-line unordered list items + ul_multi: 1 + # Spaces for multi-line ordered list items + ol_multi: 1 + +# MD033/no-inline-html - Inline HTML +MD033: + # Allowed elements + allowed_elements: [] + +# MD035/hr-style - Horizontal rule style +MD035: + # Horizontal rule style + style: "---" + +# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading +MD036: + # Punctuation characters + punctuation: ".,;:!?。,;:!?" + +# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading +MD041: + # Heading level + level: 1 + # RegExp for matching title in front matter + front_matter_title: "^\\s*title\\s*[:=]" + +# MD044/proper-names - Proper names should have the correct capitalization +MD044: + # List of proper names + # names: + # - drone + # Include code blocks + code_blocks: false + +# MD046/code-block-style - Code block style +MD046: + # Block style + style: "fenced" + +# MD048/code-fence-style - Code fence style +MD048: + # Code fence syle + style: "backtick" \ No newline at end of file diff --git a/Chart.yaml b/Chart.yaml new file mode 100644 index 0000000..1a31fb0 --- /dev/null +++ b/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: postfixadmin-fetchmail +description: Helm chart for postfixadmin's fetchmail +type: application +version: 0.1.0 +appVersion: latest +icon: https://a.fsdn.com/allura/p/postfixadmin/icon?1620415130 + +keywords: +- postfix +- postfixadmin +- fetchmail + +sources: +- https://github.com/volker-raschek/postfixadmin-fetchmail-charts +- https://hub.docker.com/volkerraschek/postfixadmin-fetchmail + +maintainers: +- name: Markus Pesch + email: markus.pesch+apps@cryptic.systems diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bf58594 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2021 Markus Pesch + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f0ac02a --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# postfixadmin-fetchmail-charts + +[![Build Status](https://postfixadmin-fetchmail.cryptic.systems/api/badges/volker.raschek/postfixadmin-fetchmail-runner-charts/status.svg)](https://postfixadmin-fetchmail.cryptic.systems/volker.raschek/postfixadmin-fetchmail-runner-charts) +[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/volker-raschek)](https://artifacthub.io/packages/search?repo=volker-raschek) + +This is helm chart is an addon for +[postfixadmin-fetchmail-runner](https://github.com/postfixadmin-fetchmail/postfixadmin-fetchmail-runner-kube) +and should replace the official unmainted helm chart +[repository](https://github.com/postfixadmin-fetchmail/postfixadmin-fetchmail-runner-kube). + +This helm chart can be found on [artifacthub.io](https://artifacthub.io/) and +can be installed via helm. + +```bash +helm repo add volker.raschek https://charts.cryptic.systems/volker.raschek +helm install postfixadmin-fetchmail volker.raschek/postfixadmin-fetchmail-runner +``` + +## Customization + +All [configuration +options](https://github.com/volker-raschek/postfixadmin-fetchmail-docker#supported-environment-variables) +can be defined in the `values.yml` file below the `config` section. +Alternatively can be the options passed via the `--set` flag of the `helm +install` command. diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl new file mode 100644 index 0000000..c1241dd --- /dev/null +++ b/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "postfixadmin-fetchmail.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 "postfixadmin-fetchmail.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .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 "postfixadmin-fetchmail.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "postfixadmin-fetchmail.labels" -}} +helm.sh/chart: {{ include "postfixadmin-fetchmail.chart" . }} +{{ include "postfixadmin-fetchmail.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "postfixadmin-fetchmail.selectorLabels" -}} +app.kubernetes.io/name: {{ include "postfixadmin-fetchmail.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "postfixadmin-fetchmail.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "postfixadmin-fetchmail.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/templates/cronjob.yaml b/templates/cronjob.yaml new file mode 100644 index 0000000..1ed239b --- /dev/null +++ b/templates/cronjob.yaml @@ -0,0 +1,48 @@ +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ include "postfixadmin-fetchmail.fullname" . }} +spec: + schedule: {{ .Values.schedule | default "*/10 * * * *" | quote }} + jobTemplate: + spec: + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 10 }} + {{- end }} + labels: + {{- include "postfixadmin-fetchmail.selectorLabels" . | nindent 12 }} + spec: + containers: + - name: {{ .Chart.Name }} + envFrom: + - secretRef: + name: {{ include "postfixadmin-fetchmail.fullname" . }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 16 }} + securityContext: + {{- toYaml .Values.securityContext | nindent 16 }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 12 }} + {{- end }} + restartPolicy: OnFailure + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 12 }} + serviceAccountName: {{ include "postfixadmin-fetchmail.fullname" . }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 12 }} + {{- end }} diff --git a/templates/secrets.yaml b/templates/secrets.yaml new file mode 100644 index 0000000..cd6b325 --- /dev/null +++ b/templates/secrets.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "postfixadmin-fetchmail.fullname" . }} +type: Opaque +stringData: + + {{- if not (hasKey .Values "config") -}} + {{- $_ := set .Values "config" dict -}} + {{- end -}} + + {{/* SETUP CONFIG */}} + {{ range $key, $value := .Values.config }} + {{ upper $key}}: {{ quote $value }} + {{ end }} diff --git a/templates/serviceaccount.yaml b/templates/serviceaccount.yaml new file mode 100644 index 0000000..5b63f88 --- /dev/null +++ b/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "postfixadmin-fetchmail.serviceAccountName" . }} + labels: + {{- include "postfixadmin-fetchmail.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/values.yaml b/values.yaml new file mode 100644 index 0000000..67941cc --- /dev/null +++ b/values.yaml @@ -0,0 +1,95 @@ +# Default values for postfixadmin-fetchmail. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: docker.io/volkerraschek/fetchmail + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +schedule: "*/10 * * * *" + +config: + # DATABASE_TYPE + # Currently will be only postgres, mysql and mariadb supported. About the + # environment variable DATABASE_TYPE can the backend type defined. The value + # is required. + # https://github.com/volker-raschek/fetchmail-docker#database_type + # DATABASE_TYPE: + + # DATABASE_USER + # The environment variable DATABASE_USER is undefined and required. The value + # contains the database user which one fetchmail use to login. + # https://github.com/volker-raschek/fetchmail-docker#database_user + # DATABASE_USER: + + # DATABASE_PASSWORD + # The environment variable DATABASE_PASSWORD is undefined and required. The + # value contains the password of the database user which one fetchmail use to + # login. + # https://github.com/volker-raschek/fetchmail-docker#database_password + # DATABASE_PASSWORD: + + # DATABASE_HOST + # The environment variable DATABASE_PASSWORD is undefined and required. The + # value contains the password of the database user which one fetchmail use to + # login. + # https://github.com/volker-raschek/fetchmail-docker#database_host + # DATABASE_HOST: + + # DATABASE_PORT + # The environment variable DATABASE_PORT is undefined and required. The value + # contains the port of the host, where the database is listen on. + # https://github.com/volker-raschek/postfixadmin-docker#postfixadmin_database_port + # DATABASE_PORT: + + # DATABASE_NAME + # The environment variable DATABASE_NAME is undefined and required. The value + # contains the name of the database against which should be logged in. + # https://github.com/volker-raschek/postfixadmin-docker#postfixadmin_database_name + # DATABASE_NAME: + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +affinity: {} + +nodeSelector: {} + +tolerations: []