Skip to content

Commit

Permalink
Add chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Karina5005 committed Mar 18, 2024
1 parent 72a8567 commit e84234b
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 0 deletions.
Empty file added chart/.helmignore
Empty file.
6 changes: 6 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: github-backup
description: A Helm chart for github-backup
type: application
version: 0.1.0
appVersion: "1.0.4"
11 changes: 11 additions & 0 deletions chart/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.10
WORKDIR /backup

ARG VERSION
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir /backup/backup && mkdir /backup/metrics \
&& pip install backup-github-org==${VERSION}
CMD ["backup-github", "--help"]

# Build: docker build . -t backup --build-arg VERSION=1.0.4
# Run: docker run --rm -v .\backup:/backup/backup -v .\metrics:/backup/metrics backup backup-github --all -t "token" -o "/backup/backup" --metrics_path "/backup/metrics/backup.prom" "organization"
48 changes: 48 additions & 0 deletions chart/templates/CronJob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: "github-backup"
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
spec:
schedule: {{ .Values.schedule }}
successfulJobsHistoryLimit: 0
jobTemplate:
spec:
template:
metadata:
labels:
dataset.0.id: "s3"
dataset.0.useas: "mount"
spec:
containers:
- name: "s3"
image: {{ .Values.image.s3.repository }}:{{ .Values.image.s3.tag | default .Chart.AppVersion }}
command: [ /bin/bash ]
args: [ "-c","cat /data/hello_there.txt" ]
volumeMounts:
- name: data-dir
mountPath: /dir/to_s3
initContainers:
- name: "github-backup"
image: {{ .Values.image.backup.repository }}:{{ .Values.image.backup.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["backup-github", "--all", "-t", "$(TOKEN)", "-o", "/backup/backup", "--metrics_path", "/backup/backup/backup.prom", "$(ORGANIZATION)"]
volumeMounts:
- name: data-dir
mountPath: /backup
env:
- name: TOKEN
valueFrom:
secretKeyRef:
name: github-backup
key: token
- name: ORGANIZATION
valueFrom:
secretKeyRef:
name: github-backup
key: organization
volumes:
- name: data-dir
emptyDir: {}
restartPolicy: {{ .Values.restartPolicy }}
11 changes: 11 additions & 0 deletions chart/templates/Dataset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: com.ie.ibm.hpsys/v1alpha1
kind: Dataset
metadata:
name: s3
spec:
local:
type: "COS"
accessKeyID:
secretAccessKey:
endpoint:
bucket: "github-backup"
14 changes: 14 additions & 0 deletions chart/templates/PersistentVolume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Values.persistentVolume.name }}
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
11 changes: 11 additions & 0 deletions chart/templates/PersistentVolumeClaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.persistentVolumeClaim.name }}
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
8 changes: 8 additions & 0 deletions chart/templates/Secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: github-backup
type: Opaque
stringData:
token:
organization: cloud-labs-infra
17 changes: 17 additions & 0 deletions chart/templates/inspector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: pvc-inspector
spec:
volumes:
- name: {{ .Values.persistentVolume.name }}
persistentVolumeClaim:
claimName: {{ .Values.persistentVolumeClaim.name }}
containers:
- image: busybox
name: pvc-inspector
command: ["tail"]
args: ["-f", "/dev/null"]
volumeMounts:
- mountPath: /pvc
name: {{ .Values.persistentVolume.name }}
17 changes: 17 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
image:
backup:
repository: "backup"
tag: "latest"
s3:
repository: "s3"
tag: "latest"
pullPolicy: Never

restartPolicy: Never
schedule: '"53 14 * * *"'

persistentVolume:
name: backup-pv-storage

persistentVolumeClaim:
name: backup-pv-claim

0 comments on commit e84234b

Please sign in to comment.