Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #120 from endrec/master
Browse files Browse the repository at this point in the history
Update chart for 2020
  • Loading branch information
stefanprodan authored Oct 13, 2020
2 parents 4304e24 + ca838f9 commit d0db695
Show file tree
Hide file tree
Showing 11 changed files with 439 additions and 122 deletions.
11 changes: 9 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
apiVersion: v1
description: MongoDB dockerized backup agent. Runs schedule backups with retention, S3 & SFTP upload, notifications, instrumentation with Prometheus and more.
description: |
MongoDB dockerized backup agent.
Runs scheduled backups with retention, S3 & SFTP upload, notifications, instrumentation with Prometheus and more.
name: mgob
version: 0.11.0
version: 1.0.0
sources:
- https://github.com/stefanprodan/mgob
maintainers:
- name: endrec
email: [email protected]
21 changes: 21 additions & 0 deletions chart/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Stefan Prodan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# mgob

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square)

MongoDB dockerized backup agent.
Runs scheduled backups with retention, S3 & SFTP upload, notifications, instrumentation with Prometheus and more.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| endrec | [email protected] | |

## Source Code

* <https://github.com/stefanprodan/mgob>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| config | object | `{}` | Backup plans. For details, see [values.yaml](values.yaml) |
| env | object | `{}` | |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.repository | string | `"stefanprodan/mgob"` | Image repo |
| image.tag | float | `1.1` | Image tag |
| replicaCount | int | `1` | Number of replicas |
| resources | object | `{"limits":{"cpu":"100m","memory":"128Mi"},"requests":{"cpu":"100m","memory":"128Mi"}}` | Resource requests and limits ref: http://kubernetes.io/docs/user-guide/compute-resources/ |
| secret | object | `{}` | Secret(s) to mount. For details, see [values.yaml](values.yaml) |
| service.externalPort | int | `8090` | Port to access the service |
| service.internalPort | int | `8090` | Port to connect to in pod |
| service.name | string | `"mgob"` | Service name |
| serviceAccount.annotations | object | `{}` | Annotations to add on service account |
| serviceAccount.create | bool | `true` | If false, default service account will be used |
| storage.longTerm | object | `{"accessMode":"ReadWriteOnce","name":"mgob-storage","size":"10Gi","storageClass":"gp2"}` | Persistent volume for backups, see `config.retention` |
| storage.tmp | object | `{"accessMode":"ReadWriteOnce","name":"mgob-tmp","size":"3Gi","storageClass":"gp2"}` | Persistent volume for temporary files |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.3.0](https://github.com/norwoodj/helm-docs/releases/v1.3.0)
123 changes: 123 additions & 0 deletions chart/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Default values for mgob.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# Note that two backup plans are provided as templates - they contain dummy values and should be changed before
# attempting to apply the chart to your cluster.
replicaCount: 1
image:
repository: stefanprodan/mgob
pullPolicy: IfNotPresent
tag: 1.1
service:
name: mgob
externalPort: 8090
internalPort: 8090
serviceAccount:
create: true
annotations:
eks.amazonaws.com/role-arn: iamArn
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
storage:
longTerm:
accessMode: "ReadWriteOnce"
# storageClass: "gp2" # Note: "gp2" is for AWS. Use the storage class for your cloud provider.
name: "mgob-storage"
size: 10Mi
tmp:
accessMode: "ReadWriteOnce"
# storageClass: "gp2" # Note: "gp2" is for AWS. Use the storage class for your cloud provider.
name: "mgob-tmp"
size: 10Mi
config:
# Add each plan as per below.
the-first-database.yml:
# run every day at 6:00 and 18:00 UTC
schedule: "0 6,18 */1 * *"
# number of backups to keep locally
retention: 14
# backup operation timeout in minutes
timeout: 60
target:
# mongod IP or host name
host: "172.18.7.21"
# mongodb port
port: 27017
# mongodb database name, leave blank to backup all databases
database: "test"
# leave blank if auth is not enabled
username: "admin"
password: "secret"
# add custom params to mongodump (eg. Auth or SSL support), leave blank if not needed
params: "--ssl --authenticationDatabase admin"
# S3 upload (optional)
s3:
url: "https://play.minio.io:9000"
bucket: "backup"
accessKey: "Q3AM3UQ867SPQQA43P2F"
secretKey: "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
# For Minio and AWS use S3v4 for GCP use S3v2
api: "S3v4"
# GCloud upload (optional)
gcloud:
bucket: "backup"
keyFilePath: /path/to/service-account.json
# Azure blob storage upload (optional)
azure:
containerName: "backup"
connectionString: "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=core.windows.net"
# Rclone upload (optional)
rclone:
bucket: "my-backup-bucket"
# See https://rclone.org/docs/ for details on how to configure rclone
configFilePath: /etc/rclone.conf
configSection: "myrclonesection"
# SFTP upload (optional)
sftp:
host: sftp.company.com
port: 2022
username: user
password: secret
# you can also specify path to a private key and a passphrase
private_key: /etc/ssh/ssh_host_rsa_key
passphrase: secretpassphrase
# dir must exist on the SFTP server
dir: backup
# Email notifications (optional)
smtp:
server: smtp.company.com
port: 465
username: user
password: secret
from: [email protected]
to:
- [email protected]
- [email protected]
# Slack notifications (optional)
slack:
url: https://hooks.slack.com/services/xxxx/xxx/xx
channel: devops-alerts
username: mgob
# 'true' to notify only on failures
warnOnly: false
secret: {}
## You can either insert your secret values as part of helm values, or refer externally created secrets.
# - name: gcp-example-secret-name
# - name: gcp-example-secret-name-with-values
# data:
# service-account.json: |
# {
# "type": "service_account",
# "project_id": "your-gcp-project-id",
# "private_key_id": "12345678901234567890",
# "private_key": "-----BEGIN PRIVATE KEY-----\n...........\n-----END PRIVATE KEY-----\n",
# ...
# }
env: {}
# - name: HTTPS_PROXY
# value: "http://localhost:3128"
44 changes: 42 additions & 2 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,55 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- define "mgob.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 "fullname" -}}
{{- define "mgob.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 "mgob.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "mgob.labels" -}}
app.kubernetes.io/name: {{ include "mgob.name" . }}
helm.sh/chart: {{ include "mgob.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 "mgob.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "mgob.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
44 changes: 41 additions & 3 deletions chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ template "mgob.fullname" . }}-config
labels:
role: backup
name: "mgob-config"
{{- include "mgob.labels" . | nindent 4 }}
data:
{{ toYaml .Values.configMap.data | indent 2 }}
{{- range $name,$value := .Values.config }}
{{ $name | quote }}: |-
scheduler:
cron: {{ $value.schedule | quote }}
retention: {{ $value.retention }}
timeout: {{ $value.timeout }}
{{- with $value.target }}
target:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- with $value.s3 }}
s3:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- with $value.gcloud }}
gcloud:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- with $value.azure }}
azure:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- with $value.rclone }}
rclone:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- with $value.sftp }}
sftp:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- with $value.smtp }}
smtp:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- with $value.slack }}
slack:
{{ toYaml . | nindent 6 | trim }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions chart/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ kind: Secret
metadata:
name: {{ $secret.name }}
labels:
release: "{{ $.Release.Name }}"
heritage: "{{ $.Release.Service }}"
{{- include "mgob.labels" . | nindent 4 }}
type: Opaque
data:
{{- range $name, $value := $secret.data }}
Expand Down
9 changes: 4 additions & 5 deletions chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
name: {{ template "mgob.fullname" . }}
labels:
name: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{- include "mgob.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
Expand All @@ -13,5 +12,5 @@ spec:
protocol: TCP
name: {{ .Values.service.name }}
selector:
app: {{ template "fullname" . }}
role: {{ .Values.selector.role }}
app.kubernetes.io/name: {{ include "mgob.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
12 changes: 12 additions & 0 deletions chart/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
{{- include "mgob.labels" . | nindent 4 }}
name: {{ template "mgob.serviceAccountName" . }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
Loading

0 comments on commit d0db695

Please sign in to comment.