Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
No longer a maintainer on Velero.

Nolan Brubaker nrb

🌴
No longer a maintainer on Velero.
View GitHub Profile
View namespace.md

Run in custom namespace

In Velero version 0.7.0 and later, you can run Velero in any namespace. To do so, you specify the namespace in the YAML files that configure the Velero server. You then also specify the namespace when you run Velero client commands.

Edit the example files

The Velero release tarballs include a set of example configs that you can use to set up your Velero server. The examples place the server and backup/schedule/restore/etc. data in the velero namespace.

@nrb
nrb / deployment.diff
Last active Apr 13, 2019
The important part of a diff between the original gcp deployment yaml and the YAML after velero plugin add gcr.io/heptio-images/velero-plugin-example was run
View deployment.diff
66a67,76
> initContainers:
> - image: gcr.io/heptio-images/velero-plugin-example
> imagePullPolicy: IfNotPresent
> name: velero-plugin-example
> resources: {}
> terminationMessagePath: /dev/termination-log
> terminationMessagePolicy: File
> volumeMounts:
> - mountPath: /plugins
@nrb
nrb / pv_to_restore.json
Last active Mar 19, 2019
Velero backup file structure
View pv_to_restore.json
resources
├── deployments.apps
│   └── namespaces
│   └── nginx-example
│   └── nginx-deployment.json
├── endpoints
│   └── namespaces
│   └── nginx-example
│   └── my-nginx.json
├── namespaces
View replace.yaml
APIVersion: velero.io/v1
Kind: ReplaceRule
spec:
appliesTo:
- PersistentVolumes
labels:
- key: failure-domain.beta.kubernetes/region
original: us-east-1
new: us-west-2
annotations:
View gist:ec03b88e3150b50b48950f0118b8f038
if groupResource == kuberesource.PersistentVolumes {
- _, found := ctx.backup.Status.VolumeBackups[name]
- reclaimPolicy, err := collections.GetString(obj.Object, "spec.persistentVolumeReclaimPolicy")
- if err == nil && !found && reclaimPolicy == "Delete" {
- ctx.log.Infof("Not restoring PV because it doesn't have a snapshot and its reclaim policy is Delete.")
+ var hasSnapshot bool
- ctx.pvsToProvision.Insert(name)
+ if len(ctx.backup.Status.VolumeBackups) > 0 {
+ // pre-v0.10 backup
@nrb
nrb / gke-install.sh
Last active Sep 20, 2018
A helper scrip to spin up GKE clusters
View gke-install.sh
#!/usr/bin/env sh
# This script lives in ~/bin
# It mostly automates the instructions found on https://heptio.github.io/ark/v0.9.0/gcp-config, except that creating the bucket and service account has already been done.
# Source the variables since they're private information
# Defines $PROJECT, $CREDS_FILE, $SERVICE_ACCOUNT_EMAIL, and $BUCKET.
source ~/bin/gke-vars.sh
# Spin up a GKE cluster and get the credentials for kubeconfig
View gist:6aeab433903ca6877499df63a38750c9
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DeleteSnapshot",
"ec2:CreateTags",
"ec2:DescribeVolumes",
View gist:adf85b179281b8c317cc61bd6ec45d75
x1c in /home/nrb/go/src/github.com/heptio/ark (git) skriss-rotate-restic-key U
% k get podvolumerestore -n heptio-ark -o yaml
apiVersion: v1
items:
- apiVersion: ark.heptio.com/v1
kind: PodVolumeRestore
metadata:
clusterName: ""
creationTimestamp: 2018-06-21T20:17:34Z
generateName: nginx-20180621161706-
View gist:b69984020c6d5fb175f1e467895d42a6
x1c in /home/nrb/go/src/github.com/heptio/ark (git) skriss-rotate-restic-key U
% ./_output/bin/linux/amd64/ark restore describe nginx-20180621161706
Name: nginx-20180621161706
Namespace: heptio-ark
Labels: <none>
Annotations: <none>
Backup: nginx
Namespaces:
View gist:e2cdc9663a23037cc80db13a29ade8e6
Name: nginx-deployment-99997d74d-j2qvh
Namespace: nginx-example
Node: gke-cluster-1-default-pool-0b8556a0-bcfx/10.150.0.2
Start Time: Thu, 21 Jun 2018 16:17:34 -0400
Labels: app=nginx
ark-restore=nginx-20180621161706
pod-template-hash=555538308
Annotations: backup.ark.heptio.com/backup-volumes=nginx-logs
snapshot.ark.heptio.com/nginx-logs=42cc95b1
Status: Pending