commit 8b6d2727ad60121d0ceb3d6a960143dddfb87d13 Author: Felix Mumme Date: Thu May 12 15:14:17 2022 +0200 init diff --git a/template-app/.helmignore b/template-app/.helmignore new file mode 100644 index 0000000..4a505cf --- /dev/null +++ b/template-app/.helmignore @@ -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 +node_modules/ +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/template-app/Chart.yaml b/template-app/Chart.yaml new file mode 100644 index 0000000..191272a --- /dev/null +++ b/template-app/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: template-app +description: Template helm chart for a classical app + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +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.0.1" diff --git a/template-app/templates/deployment.yaml b/template-app/templates/deployment.yaml new file mode 100644 index 0000000..7c4fbb0 --- /dev/null +++ b/template-app/templates/deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.app.name }} + labels: + app: {{ .Values.app.name }} +resources: + requests: + cpu: {{ .Values.container.resources.requests.cpu }} + memory: {{ .Values.container.resources.requests.memory }} + {{ if .Values.container.resources.limits.enabled }} + limits: + cpu: {{ .Values.container.resources.limits.cpu }} + memory: {{ .Values.container.resources.limits.memory }} + {{ end }} +spec: + replicas: {{ .Values.container.replicas }} + selector: + matchLabels: + app: {{ .Values.app.name }} + template: + metadata: + annotations: + rollme: {{ randAlphaNum 5 | quote }} + labels: + app: {{ .Values.app.name }} + spec: + containers: + - name: {{ .Values.app.name }} + image: {{ .Values.container.image }} + ports: + - containerPort: {{ .Values.container.port }} + env: + {{- range $env := .Values.container.env }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{- end}} + imagePullSecrets: + - name: docker-registry-cred diff --git a/template-app/templates/ingress.yaml b/template-app/templates/ingress.yaml new file mode 100644 index 0000000..d62c27d --- /dev/null +++ b/template-app/templates/ingress.yaml @@ -0,0 +1,27 @@ +{{ if default false .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + cert-manager.io/cluster-issuer: letsencrypt + name: {{ .Values.app.name }}-ingress + namespace: {{ .Release.Namespace }} +spec: + rules: + - host: {{ .Values.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Values.app.name }}-service + port: + number: {{ .Values.container.port }} + path: / + pathType: Prefix + {{ if .Values.ingress.tlsEnabled }} + tls: + - hosts: + - {{ .Values.ingress.host }} + secretName: {{ .Values.app.name }}-cert + {{ end }} +{{ end }} \ No newline at end of file diff --git a/template-app/templates/service.yaml b/template-app/templates/service.yaml new file mode 100644 index 0000000..00c291d --- /dev/null +++ b/template-app/templates/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.app.name }}-service +spec: + selector: + app: {{ .Values.app.name }} + ports: + - protocol: TCP + port: {{ .Values.container.port }} + targetPort: {{ .Values.container.port }} \ No newline at end of file diff --git a/template-app/values.yaml b/template-app/values.yaml new file mode 100644 index 0000000..394ddc0 --- /dev/null +++ b/template-app/values.yaml @@ -0,0 +1,22 @@ +app: + name: "template-app" + version: "0.0.1" +ingress: + enabled: true + tlsEnabled: true + host: "test.mumme-it.de" +container: + replicas: 1 + env: + - name: SPRING_PROFILES_ACTIVE + value: prod + port: 8080 + image: docker.mumme-it.de/Mumme-IT/template-app + resources: + requests: + cpu: 250m + memory: 256Mi + limits: + enabled: true + cpu: 250m + memory: 256Mi \ No newline at end of file diff --git a/template-postgres/.helmignore b/template-postgres/.helmignore new file mode 100644 index 0000000..4a505cf --- /dev/null +++ b/template-postgres/.helmignore @@ -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 +node_modules/ +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/template-postgres/Chart.yaml b/template-postgres/Chart.yaml new file mode 100644 index 0000000..ecdf927 --- /dev/null +++ b/template-postgres/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: template-postgres +description: Template helm chart for a postgres-database +type: application +version: 0.1.0 +appVersion: "0.0.1" diff --git a/template-postgres/templates/deployment.yaml b/template-postgres/templates/deployment.yaml new file mode 100644 index 0000000..bfb2480 --- /dev/null +++ b/template-postgres/templates/deployment.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.database.name }} + labels: + app: {{ .Values.database.name }} +spec: + replicas: {{ .Values.container.replicas }} + selector: + matchLabels: + app: {{ .Values.database.name }} + template: + metadata: + labels: + app: {{ .Values.database.name }} + spec: + containers: + - name: {{ .Values.database.name }} + image: bitnami/postgresql:latest + ports: + containerPort: 5432 + volumeMounts: + - mountPath: /bitnami/postgresql + env: + - name: POSTGRESQL_USERNAME + value: {{ .Values.database.auth.user }} + - name: POSTGRESQL_PASSWORD + value: {{ .Values.database.auth.password }} + - name: POSTGRESQL_DATABASE + value: {{ .Values.database.createdDatabase }} diff --git a/template-postgres/templates/persistent-volume.yaml b/template-postgres/templates/persistent-volume.yaml new file mode 100644 index 0000000..4d62ca0 --- /dev/null +++ b/template-postgres/templates/persistent-volume.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ .Values.database.name }}-pv + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: {{ .Values.database.size }} + accessModes: + - ReadWriteOnce + hostPath: + path: {{ .Values.database.mountPath }} \ No newline at end of file diff --git a/template-postgres/templates/persistent-volumes-claim.yaml b/template-postgres/templates/persistent-volumes-claim.yaml new file mode 100644 index 0000000..0ce2c93 --- /dev/null +++ b/template-postgres/templates/persistent-volumes-claim.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.database.name }}-pvc +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.database.size }} \ No newline at end of file diff --git a/template-postgres/values.yaml b/template-postgres/values.yaml new file mode 100644 index 0000000..1675dcf --- /dev/null +++ b/template-postgres/values.yaml @@ -0,0 +1,10 @@ +container: + replicas: 1 +database: + createdDatabase: postgres + name: template-postgres + mountPath: /mnt/postgres/data + size: 10Gi + auth: + user: postgres + password: super \ No newline at end of file