feat(mariadb): Add MariaDB App (#1333)

* add initial work on mariadb App

* hmm

* bump common
This commit is contained in:
Kjeld Schouten-Lebbing 2021-11-15 19:47:17 +01:00 committed by GitHub
parent 90e1b8ba4e
commit 004e845745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 523 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS

View File

@ -0,0 +1,32 @@
apiVersion: v2
appVersion: "14.1.0"
dependencies:
- name: common
repository: https://truecharts.org
version: 8.6.1
deprecated: false
description: Fast, reliable, scalable, and easy to use open-source relational database system.
home: https://github.com/truecharts/apps/tree/master/stable/mariadb
icon: https://bitnami.com/assets/stacks/mariadb/img/mariadb-stack-220x234.png
keywords:
- mariadb
- mysql
- database
- sql
kubeVersion: '>=1.16.0-0'
maintainers:
- email: info@truecharts.org
name: TrueCharts
url: https://truecharts.org
name: mariadb
sources:
- https://github.com/bitnami/bitnami-docker-mariadb
- https://github.com/prometheus/mysqld_exporter
- https://mariadb.org
type: application
version: 0.0.1
annotations:
truecharts.org/catagories: |
- database
truecharts.org/SCALE-support: "true"
truecharts.org/grade: U

View File

@ -0,0 +1,333 @@
# Include{groups}
questions:
- variable: portal
group: "Container Image"
label: "Configure Portal Button"
schema:
type: dict
hidden: true
attrs:
- variable: enabled
label: "Enable"
description: "enable the portal button"
schema:
hidden: true
editable: false
type: boolean
default: false
# Include{global}
- variable: controller
group: "Controller"
label: ""
schema:
type: dict
attrs:
- variable: advanced
label: "Show Advanced Controller Settings"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: type
description: "Please specify type of workload to deploy"
label: "(Advanced) Controller Type"
schema:
type: string
default: "deployment"
required: true
enum:
- value: "deployment"
description: "Deployment"
- value: "statefulset"
description: "Statefulset"
- value: "daemonset"
description: "Daemonset"
- variable: replicas
description: "Number of desired pod replicas"
label: "Desired Replicas"
schema:
type: int
default: 1
required: true
- variable: strategy
description: "Please specify type of workload to deploy"
label: "(Advanced) Update Strategy"
schema:
type: string
default: "Recreate"
required: true
enum:
- value: "Recreate"
description: "Recreate: Kill existing pods before creating new ones"
- value: "RollingUpdate"
description: "RollingUpdate: Create new pods and then kill old ones"
- value: "OnDelete"
description: "(Legacy) OnDelete: ignore .spec.template changes"
# Include{controllerExpert}
- variable: env
group: "Container Configuration"
label: "Image Environment"
schema:
type: dict
attrs:
# Include{fixedEnv}
# Include{containerConfig}
- variable: mariadbDatabase
group: "App Configuration"
label: "Database Name"
schema:
type: string
default: "mydatabase"
required: true
- variable: mariadbUsername
group: "App Configuration"
label: "Database User"
schema:
type: string
default: "mydatabaseuser"
required: true
- variable: mariadbPassword
group: "App Configuration"
label: "Database Password"
schema:
type: string
default: ""
required: true
- variable: service
group: "Networking and Services"
label: "Configure Service(s)"
schema:
type: dict
attrs:
- variable: main
label: "Main Service"
description: "The Primary service on which the healthcheck runs, often the webUI"
schema:
type: dict
attrs:
# Include{serviceSelector}
- variable: main
label: "Main Service Port Configuration"
schema:
type: dict
attrs:
- variable: port
label: "Port"
description: "This port exposes the container port on the service"
schema:
type: int
default: 3306
editable: true
required: true
- variable: advanced
label: "Show Advanced settings"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: protocol
label: "Port Type"
schema:
type: string
default: "TCP"
enum:
- value: HTTP
description: "HTTP"
- value: "HTTPS"
description: "HTTPS"
- value: TCP
description: "TCP"
- value: "UDP"
description: "UDP"
- variable: nodePort
label: "Node Port (Optional)"
description: "This port gets exposed to the node. Only considered when service type is NodePort, Simple or LoadBalancer"
schema:
type: int
min: 9000
max: 65535
- variable: targetPort
label: "Target Port"
description: "The internal(!) port on the container the Application runs on"
schema:
type: int
default: 3306
- variable: serviceexpert
group: "Networking and Services"
label: "Show Expert Config"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostNetwork
group: "Networking and Services"
label: "Host-Networking (Complicated)"
schema:
type: boolean
default: false
# Include{serviceExpert}
# Include{serviceList}
- variable: persistence
label: "Integrated Persistent Storage"
description: "Integrated Persistent Storage"
group: "Storage and Persistence"
schema:
type: dict
attrs:
- variable: db
label: "Old db Storage"
description: "Stores the old Application Database."
schema:
type: dict
hidden: true
attrs:
- variable: enabled
label: "Enable the storage"
schema:
type: boolean
default: true
hidden: true
- variable: type
label: "Type of Storage"
description: "Sets the persistence type, Anything other than PVC could break rollback!"
schema:
type: string
default: "simplePVC"
enum:
- value: "simplePVC"
description: "PVC (simple)"
- value: "simpleHP"
description: "HostPath (simple)"
- value: "emptyDir"
description: "emptyDir"
- value: "pvc"
description: "pvc"
- value: "hostPath"
description: "hostPath"
# Include{persistenceBasic}
- variable: hostPath
label: "hostPath"
description: "Path inside the container the storage is mounted"
schema:
show_if: [["type", "=", "hostPath"]]
type: hostpath
- variable: mountPath
label: "mountPath"
description: "Path inside the container the storage is mounted"
schema:
type: string
default: "/bitnami/mariadb"
hidden: true
valid_chars: '^\/([a-zA-Z0-9._-]+(\s?[a-zA-Z0-9._-]+|\/?))+$'
- variable: medium
label: "EmptyDir Medium"
schema:
show_if: [["type", "=", "emptyDir"]]
type: string
default: ""
enum:
- value: ""
description: "Default"
- value: "Memory"
description: "Memory"
# Include{persistenceAdvanced}
# Include{persistenceList}
# Include{ingressList}
- variable: advancedSecurity
label: "Show Advanced Security Settings"
group: "Security and Permissions"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: securityContext
label: "Security Context"
schema:
type: dict
attrs:
- variable: privileged
label: "Privileged mode"
schema:
type: boolean
default: false
- variable: readOnlyRootFilesystem
label: "ReadOnly Root Filesystem"
schema:
type: boolean
default: false
- variable: allowPrivilegeEscalation
label: "Allow Privilege Escalation"
schema:
type: boolean
default: false
- variable: runAsNonRoot
label: "runAsNonRoot"
schema:
type: boolean
default: true
- variable: podSecurityContext
group: "Security and Permissions"
label: "Pod Security Context"
schema:
type: dict
attrs:
- variable: runAsUser
label: "runAsUser"
description: "The UserID of the user running the application"
schema:
type: int
default: 568
- variable: runAsGroup
label: "runAsGroup"
description: The groupID this App of the user running the application"
schema:
type: int
default: 0
- variable: fsGroup
label: "fsGroup"
description: "The group that should own ALL storage."
schema:
type: int
default: 568
- variable: supplementalGroups
label: "supplemental Groups"
schema:
type: list
default: []
items:
- variable: supplementalGroupsEntry
label: "supplemental Group"
schema:
type: int
- variable: fsGroupChangePolicy
label: "When should we take ownership?"
schema:
type: string
default: "OnRootMismatch"
enum:
- value: "OnRootMismatch"
description: "OnRootMismatch"
- value: "Always"
description: "Always"
# Include{resources}
# Include{advanced}
# Include{addons}

View File

@ -0,0 +1 @@
{{ include "common.all" . }}

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- with .Values.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
type: Opaque
data:
mariadb-password: {{ ( .Values.postgresqlPassword | default "empty" ) | b64enc | quote }}
mariadb-root-password: {{ ( .Values.postgrespassword | default "empty" ) | b64enc | quote }}

View File

@ -0,0 +1,119 @@
image:
repository: bitnami/mariadb
pullPolicy: IfNotPresent
tag: 10.6.5@sha256:0099beca7ba9246595221c2ce676196a8efb1a9e8c0d474761d020da893b6576
controller:
# -- Set the controller type.
# Valid options are deployment, daemonset or statefulset
type: statefulset
# -- Number of desired pods
replicas: 1
# -- Set the controller upgrade strategy
# For Deployments, valid values are Recreate (default) and RollingUpdate.
# For StatefulSets, valid values are OnDelete and RollingUpdate (default).
# DaemonSets ignore this.
strategy: RollingUpdate
rollingUpdate:
# -- Set deployment RollingUpdate max unavailable
unavailable: 1
# -- Set deployment RollingUpdate max surge
surge:
# -- Set statefulset RollingUpdate partition
partition:
# -- ReplicaSet revision history limit
revisionHistoryLimit: 3
service:
main:
enabled: true
ports:
main:
port: 3306
targetPort: 3306
securityContext:
readOnlyRootFilesystem: false
podSecurityContext:
runAsGroup: 0
volumeClaimTemplates:
db:
enabled: true
mountPath: "/bitnami/mariadb"
accessMode: ReadWriteOnce
# -- Probe configuration
# -- [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)
# @default -- See below
probes:
# -- Liveness probe configuration
# @default -- See below
liveness:
# -- Enable the liveness probe
enabled: true
# -- Set this to `true` if you wish to specify your own livenessProbe
custom: true
# -- The spec field contains the values for the default livenessProbe.
# If you selected `custom: true`, this field holds the definition of the livenessProbe.
# @default -- See below
spec:
exec:
command:
- /bin/bash
- -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}"
# -- Redainess probe configuration
# @default -- See below
readiness:
# -- Enable the readiness probe
enabled: true
# -- Set this to `true` if you wish to specify your own readinessProbe
custom: true
# -- The spec field contains the values for the default readinessProbe.
# If you selected `custom: true`, this field holds the definition of the readinessProbe.
# @default -- See below
spec:
exec:
command:
- /bin/bash
- -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}"
# -- Startup probe configuration
# @default -- See below
startup:
# -- Enable the startup probe
enabled: true
custom: true
# -- The spec field contains the values for the default livenessProbe.
# If you selected `custom: true`, this field holds the definition of the livenessProbe.
# @default -- See below
spec:
exec:
command:
- /bin/bash
- -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}"
mariadbPassword: "testpass"
mariadbUsername: "test"
mariadbDatabase: "test"
mariadbRootPassword: "testroot"
existingSecret: ""
envValueFrom:
MARIADB_PASSWORD:
secretKeyRef:
name: '{{ ( tpl .Values.existingSecret $ ) | default ( include "common.names.fullname" . ) }}'
key: "mariadb-password"
MARIADB_ROOT_PASSWORD:
secretKeyRef:
name: '{{ ( tpl .Values.existingSecret $ ) | default ( include "common.names.fullname" . ) }}'
key: "mariadb-root-password"
envTpl:
MARIADB_USER: "{{ .Values.mariadbUsername }}"
MARIADB_DATABASE: "{{ .Values.mariadbDatabase }}"