Browse Source

Added new mail-mta-autoconfig chart

master
Fábio Kaiser Rauber 2 years ago
parent
commit
4d4eb33074
  1. 23
      charts/mail-mta-autoconfig/v0.1.0/.helmignore
  2. 16
      charts/mail-mta-autoconfig/v0.1.0/Chart.yaml
  3. 62
      charts/mail-mta-autoconfig/v0.1.0/templates/_helpers.tpl
  4. 38
      charts/mail-mta-autoconfig/v0.1.0/templates/cronjob.yaml
  5. 33
      charts/mail-mta-autoconfig/v0.1.0/templates/rbac.yaml
  6. 12
      charts/mail-mta-autoconfig/v0.1.0/templates/serviceaccount.yaml
  7. 57
      charts/mail-mta-autoconfig/v0.1.0/values.yaml

23
charts/mail-mta-autoconfig/v0.1.0/.helmignore

@ -0,0 +1,23 @@
# 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/

16
charts/mail-mta-autoconfig/v0.1.0/Chart.yaml

@ -0,0 +1,16 @@
apiVersion: v2
name: mail-mta-autoconfig
description: Job to automatically configure DKIM Keys and DNS records.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"

62
charts/mail-mta-autoconfig/v0.1.0/templates/_helpers.tpl

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "mail-mta-autoconfig.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 "mail-mta-autoconfig.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 "mail-mta-autoconfig.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "mail-mta-autoconfig.labels" -}}
helm.sh/chart: {{ include "mail-mta-autoconfig.chart" . }}
{{ include "mail-mta-autoconfig.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "mail-mta-autoconfig.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mail-mta-autoconfig.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "mail-mta-autoconfig.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "mail-mta-autoconfig.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

38
charts/mail-mta-autoconfig/v0.1.0/templates/cronjob.yaml

@ -0,0 +1,38 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ include "mail-mta-autoconfig.fullname" . }}
labels:
{{- include "mail-mta-autoconfig.labels" . | nindent 4 }}
spec:
# generate a random backup time between 1 and 5 AM
schedule: {{ .Values.schedule }}
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
metadata:
labels:
{{- include "mail-mta-autoconfig.selectorLabels" . | nindent 12 }}
spec:
serviceAccountName: {{ include "mail-mta-autoconfig.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
containers:
- name: {{ .Release.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: [ "python3", "watch.py" ]
restartPolicy: OnFailure
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}

33
charts/mail-mta-autoconfig/v0.1.0/templates/rbac.yaml

@ -0,0 +1,33 @@
{{ if .Values.rbac.create }}
# This role is used to allow mail-mta-autoconfig to get namespaces and patch PVCs
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}-role
labels:
{{- include "mail-mta-autoconfig.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources:
- namespaces
- pods
- services
verbs: ["get", "list", "watch"]
---
# We bind the role to the mail-mta-autoconfig ServiceAccount
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-binding
labels:
{{- include "mail-mta-autoconfig.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Release.Name }}-role
subjects:
- kind: ServiceAccount
name: {{ include "mail-mta-autoconfig.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{ end }}

12
charts/mail-mta-autoconfig/v0.1.0/templates/serviceaccount.yaml

@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "mail-mta-autoconfig.serviceAccountName" . }}
labels:
{{- include "mail-mta-autoconfig.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

57
charts/mail-mta-autoconfig/v0.1.0/values.yaml

@ -0,0 +1,57 @@
# Default values for mail-mta-autoconfig.
image:
repository: porto.interlegis.leg.br/library/mail-mta-autoconfig
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: ""
rbac:
create: true
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
# Defaults to midnight
schedule: "0 0 * * *"
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
nodeSelector: {}
tolerations: []
affinity: {}
Loading…
Cancel
Save