Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apis/stash/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type ResticSpec struct {
// Compute Resources required by the sidecar container.
Resources core.ResourceRequirements `json:"resources,omitempty"`
RetentionPolicies []RetentionPolicy `json:"retentionPolicies,omitempty"`
// https://github.com/appscode/stash/issues/225
Type BackupType `json:"type,omitempty"`
}

type ResticStatus struct {
Expand Down Expand Up @@ -109,6 +111,13 @@ type RestServerSpec struct {
URL string `json:"url,omitempty"`
}

type BackupType string

const (
BackupOnline BackupType = "online" // default, injects sidecar
BackupOffline BackupType = "offline" // injects init container
)

type RetentionStrategy string

const (
Expand Down
9 changes: 9 additions & 0 deletions apis/stash/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type ResticSpec struct {
// Compute Resources required by the sidecar container.
Resources core.ResourceRequirements `json:"resources,omitempty"`
RetentionPolicies []RetentionPolicy `json:"retentionPolicies,omitempty"`
// https://github.com/appscode/stash/issues/225
Type BackupType `json:"type,omitempty"`
}

type ResticStatus struct {
Expand Down Expand Up @@ -109,6 +111,13 @@ type RestServerSpec struct {
URL string `json:"url,omitempty"`
}

type BackupType string

const (
BackupOnline BackupType = "online" // default, injects sidecar
BackupOffline BackupType = "offline" // injects init container
)

type RetentionStrategy string

const (
Expand Down
2 changes: 2 additions & 0 deletions apis/stash/v1alpha1/zz_generated.conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func autoConvert_v1alpha1_ResticSpec_To_stash_ResticSpec(in *ResticSpec, out *st
out.VolumeMounts = *(*[]v1.VolumeMount)(unsafe.Pointer(&in.VolumeMounts))
out.Resources = in.Resources
out.RetentionPolicies = *(*[]stash.RetentionPolicy)(unsafe.Pointer(&in.RetentionPolicies))
out.Type = stash.BackupType(in.Type)
return nil
}

Expand All @@ -457,6 +458,7 @@ func autoConvert_stash_ResticSpec_To_v1alpha1_ResticSpec(in *stash.ResticSpec, o
out.VolumeMounts = *(*[]v1.VolumeMount)(unsafe.Pointer(&in.VolumeMounts))
out.Resources = in.Resources
out.RetentionPolicies = *(*[]RetentionPolicy)(unsafe.Pointer(&in.RetentionPolicies))
out.Type = BackupType(in.Type)
return nil
}

Expand Down
6 changes: 5 additions & 1 deletion docs/examples/tutorial/recovery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ metadata:
namespace: default
spec:
restic: stash-demo
workload:
kind: Deployment
name: stash-demo
volumes:
- name: source-data
emptyDir: {}
hostPath:
path: /data/stash-test/restic-restored

11 changes: 7 additions & 4 deletions docs/examples/tutorial/restic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ spec:
app: stash-demo
fileGroups:
- path: /source/data
retentionPolicy:
keepLast: 5
prune: true
retentionPolicyName: 'keep-last-5'
backend:
local:
path: /safe/data
volumeSource:
emptyDir: {}
hostPath:
path: /data/stash-test/restic-repo
storageSecretName: stash-demo
schedule: '@every 1m'
volumeMounts:
- mountPath: /source/data
name: source-data
retentionPolicies:
- name: 'keep-last-5'
keepLast: 5
prune: true
28 changes: 28 additions & 0 deletions docs/examples/tutorial/restic_offline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Restic
metadata:
name: stash-demo
namespace: default
spec:
selector:
matchLabels:
app: stash-demo
type: offline
fileGroups:
- path: /source/data
retentionPolicyName: 'keep-last-5'
backend:
local:
path: /safe/data
volumeSource:
hostPath:
path: /data/stash-test/restic-repo
storageSecretName: stash-demo
schedule: '@every 5m'
volumeMounts:
- mountPath: /source/data
name: source-data
retentionPolicies:
- name: 'keep-last-5'
keepLast: 5
prune: true
15 changes: 8 additions & 7 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions hack/deploy/with-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ rules:
- apps
resources:
- deployments
- statefulsets
verbs: ["get", "list", "watch", "patch"]
- apiGroups:
- batch
resources:
- jobs
verbs: ["get", "create", "delete"]
- cronjobs
verbs: ["get", "list", "watch", "create", "delete", "patch"]
- apiGroups:
- extensions
resources:
Expand All @@ -57,11 +59,13 @@ rules:
- apiGroups: [""]
resources:
- pods
verbs: ["list", delete", "deletecollection"]
- serviceaccounts
verbs: ["get", "create", "list", "delete", "deletecollection"]
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- roles
- rolebindings
verbs: ["get", "create", "delete", "patch"]
---
Expand Down Expand Up @@ -116,7 +120,7 @@ spec:
- run
- --v=3
- --rbac=true
image: appscode/stash:0.5.1
image: appscode/stash:offline-backup
ports:
- containerPort: 56790
name: http
Expand Down
2 changes: 1 addition & 1 deletion hack/deploy/without-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
args:
- run
- --v=3
image: appscode/stash:0.5.1
image: appscode/stash:offline-backup
ports:
- containerPort: 56790
name: http
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"os"

"github.com/appscode/go/log"
logs "github.com/appscode/go/log/golog"
_ "github.com/appscode/stash/client/fake"
_ "github.com/appscode/stash/client/internalclientset/scheme"
Expand All @@ -16,7 +17,8 @@ func main() {
defer logs.FlushLogs()

if err := cmds.NewCmdStash(Version).Execute(); err != nil {
os.Exit(1)
log.Fatalln("Error in Stash Main:", err)
}
log.Infoln("Exiting Stash Main")
os.Exit(0)
}
Loading