Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
NDS-886: etcdumper restore currently broken in cluster-backup (#20)
Browse files Browse the repository at this point in the history
* Added my setup stuff

* sync

* Sync

* Updated specs

* Removed my personal templates

* Added a YAML for cluster-backup as a cronjob (requires setting a special flag on the apiserver)

* Added a shell into a backup container

* Sync with upstream, fix merge conflicts, make sure PR is synced

* Removed hard-coded CLUSTER_ID

* Update backup.yaml

* Update shell.yaml

* Removed stray spaces from env block
  • Loading branch information
bodom0015 authored and craig-willis committed Oct 19, 2017
1 parent ee6da17 commit 2279d40
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 4 deletions.
1 change: 1 addition & 0 deletions manifests/master.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"--etcd-servers=http://127.0.0.1:4001",
"--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota",
"--client-ca-file=/srv/kubernetes/ca.crt",
"--runtime-config=batch/v2alpha1=true",
"--basic-auth-file=/srv/kubernetes/basic_auth.csv",
"--min-request-timeout=300",
"--tls-cert-file=/srv/kubernetes/server.cert",
Expand Down
3 changes: 1 addition & 2 deletions ndslabs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ function start_all() {
$ECHO '\nStarting Labs Workbench core services...'

# Pre-process jinja-style variables by piping through sed
cat templates/core/loadbalancer.yaml | sed -e "s#{{[ ]*DOMAIN[ ]*}}#$DOMAIN#g" | $KUBECTL_BIN create -f -
cat templates/core/loadbalancer.yaml | sed -e "s#{{[ \s]*DOMAIN[ \s]*}}#$DOMAIN#g" | $KUBECTL_BIN create -f -
$KUBECTL_BIN create -f templates/smtp/ -f templates/core/svc.yaml -f templates/core/etcd.yaml -f templates/core/apiserver.yaml

# Only start bind if requested
if [ "$3" == YES ]; then
cat templates/core/loadbalancer.yaml | sed -e "s#{{[ ]*DOMAIN[ ]*}}#$DOMAIN#g" | $KUBECTL_BIN create -f -
$KUBECTL_BIN create -f templates/core/bind.yaml
fi

Expand Down
53 changes: 53 additions & 0 deletions templates/backup/backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: batch/v2alpha1
kind: CronJob
metadata:
name: cluster-backup
spec:
# suspend: true
# schedule: "*/1 * * * *"
schedule: "@daily"
jobTemplate:
spec:
template:
spec:
hostNetwork: true
restartPolicy: OnFailure
containers:
- image: ndslabs/cluster-backup:latest
imagePullPolicy: Always
name: cluster-backup
command: [ "./backup.sh" ]
env:
- name: CLUSTER_ID
valueFrom:
configMapKeyRef:
name: ndslabs-config
key: workbench.domain
- name: ETCD_HOST
value: $(NDSLABS_ETCD_SERVICE_HOST)
- name: ETCD_PORT
value: $(NDSLABS_ETCD_SERVICE_PORT)
- name: BACKUP_SRC
value: "/var/glfs"
- name: BACKUP_DEST
value: /ndsbackup
- name: BACKUP_HOST
value:
- name: BACKUP_USER
value:
- name: BACKUP_KEY
value: "/etc/backup-key/ssh-privatekey"
volumeMounts:
- name: clusterdata
mountPath: /var/glfs
- name: backupkey
readOnly: true
mountPath: /etc/backup-key/
volumes:
- name: clusterdata
hostPath:
path: /var/glfs
- name: backupkey
secret:
secretName: backup-key
defaultMode: 0600
54 changes: 54 additions & 0 deletions templates/backup/shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: backup-shell
spec:
replicas: 1
selector:
component: backup-shell
template:
metadata:
labels:
component: backup-shell
spec:
hostNetwork: true
containers:
- name: backup-shell
imagePullPolicy: Always
image: ndslabs/cluster-backup:latest
stdin: true
tty: true
env:
- name: CLUSTER_ID
valueFrom:
configMapKeyRef:
name: ndslabs-config
key: workbench.domain
- name: ETCD_HOST
value: $(NDSLABS_ETCD_SERVICE_HOST)
- name: ETCD_PORT
value: $(NDSLABS_ETCD_SERVICE_PORT)
- name: BACKUP_SRC
value: "/var/glfs"
- name: BACKUP_DEST
value: /ndsbackup
- name: BACKUP_HOST
value:
- name: BACKUP_USER
value:
- name: BACKUP_KEY
value: "/etc/backup-key/ssh-privatekey"
volumeMounts:
- name: clusterdata
mountPath: /var/glfs
- name: backupkey
readOnly: true
mountPath: /etc/backup-key/
volumes:
- name: clusterdata
hostPath:
path: /var/glfs
- name: backupkey
secret:
secretName: backup-key
defaultMode: 0600
4 changes: 2 additions & 2 deletions templates/core/loadbalancer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ spec:
resources:
limits:
cpu: 10m
memory: 20Mi
memory: 512Mi
requests:
cpu: 10m
memory: 20Mi
memory: 256Mi
---
apiVersion: v1
data:
Expand Down

0 comments on commit 2279d40

Please sign in to comment.