aboutsummaryrefslogtreecommitdiff
path: root/grumpy/gitsnapshot
diff options
context:
space:
mode:
authorMax Resnick <max@ofmax.li>2021-10-09 23:07:53 -0700
committerMax Resnick <max@ofmax.li>2021-10-09 23:28:41 -0700
commitbda8a1c25070678e6efd22003e398691404c832f (patch)
tree6ad3711b08bf3f8f3ad3577e97243402bad64b79 /grumpy/gitsnapshot
parentb2630dfd176884f9b33be88f2033b84a1c4dd7cd (diff)
downloadgrumpy-charts-bda8a1c25070678e6efd22003e398691404c832f.tar.gz
feat: switch to kustomize from helm
Diffstat (limited to '')
-rw-r--r--grumpy/gitsnapshot/.helmignore22
-rw-r--r--grumpy/gitsnapshot/Kube-descriptor.yaml (renamed from grumpy/gitsnapshot/Chart.yaml)2
-rw-r--r--grumpy/gitsnapshot/gitsnapshot-cronjob.yaml54
-rw-r--r--grumpy/gitsnapshot/gitsnapshot-test-connection-pod.yaml13
-rw-r--r--grumpy/gitsnapshot/kustomization.yaml30
-rw-r--r--grumpy/gitsnapshot/templates/NOTES.txt21
-rw-r--r--grumpy/gitsnapshot/templates/_helpers.tpl56
-rw-r--r--grumpy/gitsnapshot/templates/cronjob.yaml58
-rw-r--r--grumpy/gitsnapshot/templates/secrets.yaml9
-rw-r--r--grumpy/gitsnapshot/templates/tests/test-connection.yaml15
-rw-r--r--grumpy/gitsnapshot/values.yaml58
11 files changed, 98 insertions, 240 deletions
diff --git a/grumpy/gitsnapshot/.helmignore b/grumpy/gitsnapshot/.helmignore
deleted file mode 100644
index 50af031..0000000
--- a/grumpy/gitsnapshot/.helmignore
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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/
diff --git a/grumpy/gitsnapshot/Chart.yaml b/grumpy/gitsnapshot/Kube-descriptor.yaml
index f1067a8..4b429df 100644
--- a/grumpy/gitsnapshot/Chart.yaml
+++ b/grumpy/gitsnapshot/Kube-descriptor.yaml
@@ -1,5 +1,5 @@
apiVersion: v1
-appVersion: "0.0.1"
+appVersion: 0.0.1
description: A Helm chart for Kubernetes
name: gitsnapshot
version: 0.2.0
diff --git a/grumpy/gitsnapshot/gitsnapshot-cronjob.yaml b/grumpy/gitsnapshot/gitsnapshot-cronjob.yaml
new file mode 100644
index 0000000..2554f8a
--- /dev/null
+++ b/grumpy/gitsnapshot/gitsnapshot-cronjob.yaml
@@ -0,0 +1,54 @@
+apiVersion: batch/v1beta1
+kind: CronJob
+metadata:
+ name: gitsnapshot
+spec:
+ jobTemplate:
+ metadata:
+ labels:
+ app.kubernetes.io/instance: gitsnapshot
+ app.kubernetes.io/name: gitsnapshot
+ spec:
+ template:
+ spec:
+ containers:
+ - command:
+ - gitsnap
+ - backup
+ - /var/lib/git/repositories
+ - privategit
+ env:
+ - name: AWS_DEFAULT_REGION
+ valueFrom:
+ secretKeyRef:
+ key: AWS_DEFAULT_REGION
+ name: aws-s3-secret
+ - name: AWS_SECRET_ACCESS_KEY
+ valueFrom:
+ secretKeyRef:
+ key: AWS_SECRET_ACCESS_KEY
+ name: aws-s3-secret
+ - name: AWS_ACCESS_KEY_ID
+ valueFrom:
+ secretKeyRef:
+ key: AWS_ACCESS_KEY_ID
+ name: aws-s3-secret
+ image: registry.gitlab.com/grumps/grumpy-containers/git-snapshot:v0.0.4
+ imagePullPolicy: Always
+ name: gitsnapshot
+ volumeMounts:
+ - mountPath: /var/lib/git
+ name: gitolite-storage
+ readOnly: false
+ imagePullSecrets:
+ - name: regcred
+ restartPolicy: Never
+ volumes:
+ - name: gitolite-storage
+ persistentVolumeClaim:
+ claimName: gitolite-storage
+ schedule: '*/60 * * * *'
+ selector:
+ matchLabels:
+ app.kubernetes.io/instance: gitsnapshot
+ app.kubernetes.io/name: gitsnapshot
diff --git a/grumpy/gitsnapshot/gitsnapshot-test-connection-pod.yaml b/grumpy/gitsnapshot/gitsnapshot-test-connection-pod.yaml
new file mode 100644
index 0000000..b5ffa79
--- /dev/null
+++ b/grumpy/gitsnapshot/gitsnapshot-test-connection-pod.yaml
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: Pod
+metadata:
+ name: gitsnapshot-test-connection
+spec:
+ containers:
+ - args:
+ - gitsnapshot:80
+ command:
+ - wget
+ image: busybox
+ name: wget
+ restartPolicy: Never
diff --git a/grumpy/gitsnapshot/kustomization.yaml b/grumpy/gitsnapshot/kustomization.yaml
new file mode 100644
index 0000000..83cfe40
--- /dev/null
+++ b/grumpy/gitsnapshot/kustomization.yaml
@@ -0,0 +1,30 @@
+# Labels to add to all resources and selectors.
+commonLabels:
+ app.kubernetes.io/instance: gitsnapshot
+ app.kubernetes.io/managed-by: Tiller
+ app.kubernetes.io/name: gitsnapshot
+ app.kubernetes.io/version: 0.0.1
+ helm.sh/chart: gitsnapshot-0.2.0
+
+# Images modify the tags for images without
+# creating patches.
+images:
+- name: busybox
+- name: registry.gitlab.com/grumps/grumpy-containers/git-snapshot
+ newTag: v0.0.4
+
+# Value of this field is prepended to the
+# names of all resources
+namePrefix: gitsnapshot
+
+# List of resource files that kustomize reads, modifies
+# and emits as a YAML string
+resources:
+- gitsnapshot-cronjob.yaml
+- gitsnapshot-test-connection-pod.yaml
+
+# Each entry in this list results in the creation of
+# one Secret resource (it's a generator of n secrets).
+secretGenerator:
+- name: aws-s3-secret
+ type: Opaque \ No newline at end of file
diff --git a/grumpy/gitsnapshot/templates/NOTES.txt b/grumpy/gitsnapshot/templates/NOTES.txt
deleted file mode 100644
index 8213fc9..0000000
--- a/grumpy/gitsnapshot/templates/NOTES.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-1. Get the application URL by running these commands:
-{{- if .Values.ingress.enabled }}
-{{- range $host := .Values.ingress.hosts }}
- {{- range .paths }}
- http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
- {{- end }}
-{{- end }}
-{{- else if contains "NodePort" .Values.service.type }}
- export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gitsnapshot.fullname" . }})
- export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
- echo http://$NODE_IP:$NODE_PORT
-{{- else if contains "LoadBalancer" .Values.service.type }}
- NOTE: It may take a few minutes for the LoadBalancer IP to be available.
- You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "gitsnapshot.fullname" . }}'
- export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gitsnapshot.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
- echo http://$SERVICE_IP:{{ .Values.service.port }}
-{{- else if contains "ClusterIP" .Values.service.type }}
- export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "gitsnapshot.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
- echo "Visit http://127.0.0.1:8080 to use your application"
- kubectl port-forward $POD_NAME 8080:80
-{{- end }}
diff --git a/grumpy/gitsnapshot/templates/_helpers.tpl b/grumpy/gitsnapshot/templates/_helpers.tpl
deleted file mode 100644
index 8b854e5..0000000
--- a/grumpy/gitsnapshot/templates/_helpers.tpl
+++ /dev/null
@@ -1,56 +0,0 @@
-{{/* vim: set filetype=mustache: */}}
-{{/*
-Expand the name of the chart.
-*/}}
-{{- define "gitsnapshot.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 "gitsnapshot.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 "gitsnapshot.chart" -}}
-{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
-
-{{/*
-Common labels
-*/}}
-{{- define "gitsnapshot.labels" -}}
-app.kubernetes.io/name: {{ include "gitsnapshot.name" . }}
-helm.sh/chart: {{ include "gitsnapshot.chart" . }}
-app.kubernetes.io/instance: {{ .Release.Name }}
-{{- if .Chart.AppVersion }}
-app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
-{{- end }}
-app.kubernetes.io/managed-by: {{ .Release.Service }}
-{{- end -}}
-
-{{/*
-Create the name of the service account to use
-*/}}
-{{- define "gitsnapshot.serviceAccountName" -}}
-{{- if .Values.serviceAccount.create -}}
- {{ default (include "gitsnapshot.fullname" .) .Values.serviceAccount.name }}
-{{- else -}}
- {{ default "default" .Values.serviceAccount.name }}
-{{- end -}}
-{{- end -}}
diff --git a/grumpy/gitsnapshot/templates/cronjob.yaml b/grumpy/gitsnapshot/templates/cronjob.yaml
deleted file mode 100644
index 553a2ce..0000000
--- a/grumpy/gitsnapshot/templates/cronjob.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
-apiVersion: batch/v1beta1
-kind: CronJob
-metadata:
- name: {{ include "gitsnapshot.fullname" . }}
- labels:
-{{ include "gitsnapshot.labels" . | indent 4 }}
-spec:
- schedule: "*/60 * * * *"
- selector:
- matchLabels:
- app.kubernetes.io/name: {{ include "gitsnapshot.name" . }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- jobTemplate:
- metadata:
- labels:
- app.kubernetes.io/name: {{ include "gitsnapshot.name" . }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- spec:
- template:
- spec:
- restartPolicy: Never
- {{- with .Values.imagePullSecrets }}
- imagePullSecrets:
- {{- toYaml . | nindent 10 }}
- {{- end }}
- containers:
- - name: {{ .Chart.Name }}
- command:
- - gitsnap
- - backup
- - /var/lib/git/repositories
- - privategit
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- volumeMounts:
- - mountPath: /var/lib/git
- name: gitolite-storage
- readOnly: false
- env:
- - name: AWS_DEFAULT_REGION
- valueFrom:
- secretKeyRef:
- name: aws-s3-secret
- key: AWS_DEFAULT_REGION
- - name: AWS_SECRET_ACCESS_KEY
- valueFrom:
- secretKeyRef:
- name: aws-s3-secret
- key: AWS_SECRET_ACCESS_KEY
- - name: AWS_ACCESS_KEY_ID
- valueFrom:
- secretKeyRef:
- name: aws-s3-secret
- key: AWS_ACCESS_KEY_ID
- volumes:
- - name: gitolite-storage
- persistentVolumeClaim:
- claimName: gitolite-storage
diff --git a/grumpy/gitsnapshot/templates/secrets.yaml b/grumpy/gitsnapshot/templates/secrets.yaml
deleted file mode 100644
index b8b42d1..0000000
--- a/grumpy/gitsnapshot/templates/secrets.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-apiVersion: v1
-kind: Secret
-metadata:
- name: aws-s3-secret
-type: Opaque
-stringData:
- AWS_DEFAULT_REGION: {{ .Values.secrets.awsRegion }}
- AWS_SECRET_ACCESS_KEY: {{ .Values.secrets.accessKey }}
- AWS_ACCESS_KEY_ID: {{ .Values.secrets.accessKeyId }}
diff --git a/grumpy/gitsnapshot/templates/tests/test-connection.yaml b/grumpy/gitsnapshot/templates/tests/test-connection.yaml
deleted file mode 100644
index 189529f..0000000
--- a/grumpy/gitsnapshot/templates/tests/test-connection.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-apiVersion: v1
-kind: Pod
-metadata:
- name: "{{ include "gitsnapshot.fullname" . }}-test-connection"
- labels:
-{{ include "gitsnapshot.labels" . | indent 4 }}
- annotations:
- "helm.sh/hook": test-success
-spec:
- containers:
- - name: wget
- image: busybox
- command: ['wget']
- args: ['{{ include "gitsnapshot.fullname" . }}:{{ .Values.service.port }}']
- restartPolicy: Never
diff --git a/grumpy/gitsnapshot/values.yaml b/grumpy/gitsnapshot/values.yaml
deleted file mode 100644
index ea428ee..0000000
--- a/grumpy/gitsnapshot/values.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
-# Default values for gitsnapshot.
-# This is a YAML-formatted file.
-# Declare variables to be passed into your templates.
-
-replicaCount: 1
-
-image:
- repository: registry.gitlab.com/grumps/grumpy-containers/git-snapshot
- tag: v0.0.3
- pullPolicy: Always
-
-imagePullSecrets:
- - name: regcred
-nameOverride: ""
-fullnameOverride: ""
-
-serviceAccount:
- # Specifies whether a service account should be created
- create: true
- # The name of the service account to use.
- # If not set and create is true, a name is generated using the fullname template
- name:
-
-service:
- type: ClusterIP
- port: 80
-
-ingress:
- enabled: false
- annotations: {}
- # kubernetes.io/ingress.class: nginx
- # kubernetes.io/tls-acme: "true"
- hosts:
- - host: chart-example.local
- paths: []
-
- tls: []
- # - secretName: chart-example-tls
- # hosts:
- # - chart-example.local
-
-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: {}