Skip to content

Instantly share code, notes, and snippets.

View nrb's full-sized avatar
🤔

Nolan Brubaker nrb

🤔
View GitHub Profile
x1c in /home/nrb/go/src/github.com/heptio/velero (git) master U
% ag \"velero\" --ignore \*_test.go --ignore site/\*
changelogs/CHANGELOG-1.0.md
27:* The "ark" annotations for specifying hooks are no longer supported, and have been replaced with "velero"-based equivalents.
28:* The "ark" annotation for specifying restic backups is no longer supported, and has been replaced with a "velero"-based equivalent.
29:* The "ark" prometheus metrics no longer exist, and have been replaced with "velero"-based equivalents.
pkg/cmd/cli/plugin/add.go
38: veleroDeployment = "velero"
39: veleroContainer = "velero"

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 April 13, 2019 23:40
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
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 March 19, 2019 00:05
Velero backup file structure
resources
├── deployments.apps
│   └── namespaces
│   └── nginx-example
│   └── nginx-deployment.json
├── endpoints
│   └── namespaces
│   └── nginx-example
│   └── my-nginx.json
├── namespaces
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:
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 September 20, 2018 18:30
A helper scrip to spin up GKE clusters
#!/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
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DeleteSnapshot",
"ec2:CreateTags",
"ec2:DescribeVolumes",
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-
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: