Skip to content

Commit 50b5821

Browse files
author
Emruz Hossain
authored
Support passing args to restic backup/restore command (#1385)
Signed-off-by: Emruz Hossain <emruz@appscode.com>
1 parent 28d878e commit 50b5821

21 files changed

+591
-223
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ require (
3939
k8s.io/kubernetes v1.21.1
4040
kmodules.xyz/client-go v0.0.0-20210928133955-8df5bb467db6
4141
kmodules.xyz/constants v0.0.0-20210218100002-2c304bfda278
42-
kmodules.xyz/custom-resources v0.0.0-20211007064058-70fba50e58a4
42+
kmodules.xyz/custom-resources v0.0.0-20211007080833-72bd9e8cae6e
4343
kmodules.xyz/objectstore-api v0.0.0-20210928135706-fdf68f88ea6e
4444
kmodules.xyz/offshoot-api v0.0.0-20210829122105-6f4d481b0c61
4545
kmodules.xyz/openshift v0.0.0-20210618001443-f2507caa512f
4646
kmodules.xyz/prober v0.0.0-20210618020259-5836fb959027
4747
kmodules.xyz/webhook-runtime v0.0.0-20210928141616-7f73c2ab318a
48-
stash.appscode.dev/apimachinery v0.15.1-0.20211001093145-5e773145f153
48+
stash.appscode.dev/apimachinery v0.15.1-0.20211007085001-4e2a9445b1d7
4949
)
5050

5151
replace bitbucket.org/ww/goautoneg => gomodules.xyz/goautoneg v0.0.0-20120707110453-a547fc61f48d

go.sum

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,22 +1213,18 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
12131213
kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
12141214
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
12151215
kmodules.xyz/client-go v0.0.0-20210617233340-13d22e91512b/go.mod h1:A6GAK6xP5zBuWK6A/vUkkjKzcuywkms7fIxRf5wblO4=
1216-
kmodules.xyz/client-go v0.0.0-20210715065708-d4f0cc74ead1/go.mod h1:E/vGngai00UtVwP8R4PWpPUBF/EZa6Ub9WS5+tVcs4M=
12171216
kmodules.xyz/client-go v0.0.0-20210719120358-dd0503cf99cf/go.mod h1:E/vGngai00UtVwP8R4PWpPUBF/EZa6Ub9WS5+tVcs4M=
12181217
kmodules.xyz/client-go v0.0.0-20210822203828-5e9cebbf1dfa/go.mod h1:0gkPeALtYjB27OHt4rd6+ZmMgoVTHVLtEJQeU23/gtA=
1219-
kmodules.xyz/client-go v0.0.0-20210921150324-f005c6dfcb32/go.mod h1:0gkPeALtYjB27OHt4rd6+ZmMgoVTHVLtEJQeU23/gtA=
12201218
kmodules.xyz/client-go v0.0.0-20210928133955-8df5bb467db6 h1:o+SymmN26C8bqh1nLTFjT0UdOtAYrTLbp6v49iRe5MY=
12211219
kmodules.xyz/client-go v0.0.0-20210928133955-8df5bb467db6/go.mod h1:0gkPeALtYjB27OHt4rd6+ZmMgoVTHVLtEJQeU23/gtA=
12221220
kmodules.xyz/constants v0.0.0-20210218100002-2c304bfda278 h1:sFmqh4EaiZ4K2FkkGvrDFddstq8GSf6ogH24IAsuKew=
12231221
kmodules.xyz/constants v0.0.0-20210218100002-2c304bfda278/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY=
12241222
kmodules.xyz/crd-schema-fuzz v0.0.0-20210618002152-fae23aef5fb4/go.mod h1:IIkUctlfoptoci0BOrsUf8ya+MOG5uaeh1PE4uzaIbA=
1225-
kmodules.xyz/custom-resources v0.0.0-20210829135624-c63be82e13c0/go.mod h1:VYtz1fgHgLqCk+sdSUGBClfZfJ6z4873wB5MYOXxpS8=
1226-
kmodules.xyz/custom-resources v0.0.0-20211007064058-70fba50e58a4 h1:mRmwqv3kQTzL9/kccHztRJFZU2Ks2MHhIxBJi3yQi6w=
12271223
kmodules.xyz/custom-resources v0.0.0-20211007064058-70fba50e58a4/go.mod h1:pGabego8q4oi/2sNjhdtFkgVaVw4AyGv14GO6VtAjTw=
1228-
kmodules.xyz/objectstore-api v0.0.0-20210829122106-d39859fc2d56/go.mod h1:Tkcf9uTplnrJ6C8o0zlw2kpgS1SaWAiMO5P2YgLjTo8=
1224+
kmodules.xyz/custom-resources v0.0.0-20211007080833-72bd9e8cae6e h1:0IEUFAJPgwPx3+Zb1BMcHLywKhJtXMk6YCHNsjWJwYQ=
1225+
kmodules.xyz/custom-resources v0.0.0-20211007080833-72bd9e8cae6e/go.mod h1:pGabego8q4oi/2sNjhdtFkgVaVw4AyGv14GO6VtAjTw=
12291226
kmodules.xyz/objectstore-api v0.0.0-20210928135706-fdf68f88ea6e h1:2QZBUcUI6r7mLU5/9+Xxd1eDClEIEkZkJlyCU91UoY8=
12301227
kmodules.xyz/objectstore-api v0.0.0-20210928135706-fdf68f88ea6e/go.mod h1:Tkcf9uTplnrJ6C8o0zlw2kpgS1SaWAiMO5P2YgLjTo8=
1231-
kmodules.xyz/offshoot-api v0.0.0-20210804100837-d0388be3e60d/go.mod h1:3LECbAL3FgbyK80NP3V3Pmiuo/a3hFWg/PR6SPFhTns=
12321228
kmodules.xyz/offshoot-api v0.0.0-20210829122105-6f4d481b0c61 h1:J56UGmRFddu6tERRd8BELmP5QbXxievzb+6vAjFptiM=
12331229
kmodules.xyz/offshoot-api v0.0.0-20210829122105-6f4d481b0c61/go.mod h1:3LECbAL3FgbyK80NP3V3Pmiuo/a3hFWg/PR6SPFhTns=
12341230
kmodules.xyz/openshift v0.0.0-20210618001443-f2507caa512f h1:V1lapZtGG7GntoUsOuEz2kWPXv6scMzJxS+3NaHIUzc=
@@ -1268,5 +1264,5 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
12681264
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
12691265
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
12701266
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
1271-
stash.appscode.dev/apimachinery v0.15.1-0.20211001093145-5e773145f153 h1:SfkCbILyZleR24EklZsUetRZPriYnOkZ3auTe3HJmsM=
1272-
stash.appscode.dev/apimachinery v0.15.1-0.20211001093145-5e773145f153/go.mod h1:5xXk6R6QXc1qklFuQCWpHZEU2vRTf7mhD0fcTAYISIk=
1267+
stash.appscode.dev/apimachinery v0.15.1-0.20211007085001-4e2a9445b1d7 h1:7C+oucVxKRDgKnNkm5DYfFkFNM4eRk8r+tgCQ/bmZvc=
1268+
stash.appscode.dev/apimachinery v0.15.1-0.20211007085001-4e2a9445b1d7/go.mod h1:owQaNhtUMh6s727PX9dGIoLlqblMvMOtYLF2jy9CUek=

pkg/restore/restore.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ func (opt *Options) runRestore(inv invoker.RestoreInvoker, targetInfo invoker.Re
206206
// We will execute postRestore hook even if the restore failed.
207207
// Reason: https://github.com/stashed/stash/issues/986
208208
var restoreErr, hookErr error
209-
output, restoreErr := w.RunRestore(util.RestoreOptionsForHost(opt.Host, targetInfo.Target.Rules), targetInfo.Target.Ref)
209+
restoreOptions := util.RestoreOptionsForHost(opt.Host, targetInfo.Target.Rules)
210+
restoreOptions.Args = targetInfo.Target.Args
211+
output, restoreErr := w.RunRestore(restoreOptions, targetInfo.Target.Ref)
210212

211213
// If postRestore hook is specified, then execute those hooks
212214
if targetInfo.Hooks != nil && targetInfo.Hooks.PostRestore != nil {

pkg/util/options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func BackupOptionsForBackupTarget(backupTarget *api.BackupTarget, retentionPolic
4141
if backupTarget != nil {
4242
backupOpt.BackupPaths = backupTarget.Paths
4343
backupOpt.Exclude = backupTarget.Exclude
44+
backupOpt.Args = backupTarget.Args
4445
}
4546
return backupOpt
4647
}

vendor/kmodules.xyz/custom-resources/apis/auditor/v1alpha1/openapi_generated.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/kmodules.xyz/custom-resources/apis/auditor/v1alpha1/siteinfo_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ const (
2828
ResourceSiteInfos = "siteinfos"
2929
)
3030

31+
// SiteInfo captures information of a product deployment site.
32+
33+
// +k8s:openapi-gen=true
3134
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
3235

33-
// SiteInfo captures information of a product deployment site.
36+
// +kubebuilder:object:root=true
37+
// +kubebuilder:resource:path=siteinfos,singular=siteinfo,scope=Cluster,categories={auditor,appscode,all}
3438
type SiteInfo struct {
3539
metav1.TypeMeta `json:",inline"`
3640
metav1.ObjectMeta `json:"metadata,omitempty"`
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
creationTimestamp: null
7+
name: siteinfos.auditor.appscode.com
8+
spec:
9+
group: auditor.appscode.com
10+
names:
11+
categories:
12+
- auditor
13+
- appscode
14+
- all
15+
kind: SiteInfo
16+
listKind: SiteInfoList
17+
plural: siteinfos
18+
singular: siteinfo
19+
scope: Cluster
20+
versions:
21+
- name: v1alpha1
22+
schema:
23+
openAPIV3Schema:
24+
properties:
25+
apiVersion:
26+
description: 'APIVersion defines the versioned schema of this representation
27+
of an object. Servers should convert recognized schemas to the latest
28+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
29+
type: string
30+
kind:
31+
description: 'Kind is a string value representing the REST resource this
32+
object represents. Servers may infer this from the endpoint the client
33+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
34+
type: string
35+
kubernetes:
36+
properties:
37+
clusterName:
38+
description: https://github.com/kmodules/client-go/blob/master/tools/clusterid/lib.go
39+
type: string
40+
clusterUID:
41+
type: string
42+
controlPlane:
43+
description: https://github.com/kmodules/client-go/blob/kubernetes-1.16.3/tools/analytics/analytics.go#L66
44+
properties:
45+
dnsNames:
46+
items:
47+
type: string
48+
type: array
49+
emailAddresses:
50+
items:
51+
type: string
52+
type: array
53+
ipAddresses:
54+
items:
55+
type: string
56+
type: array
57+
notAfter:
58+
format: date-time
59+
type: string
60+
notBefore:
61+
format: date-time
62+
type: string
63+
uris:
64+
items:
65+
type: string
66+
type: array
67+
required:
68+
- notAfter
69+
- notBefore
70+
type: object
71+
nodeStats:
72+
properties:
73+
allocatable:
74+
additionalProperties:
75+
anyOf:
76+
- type: integer
77+
- type: string
78+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
79+
x-kubernetes-int-or-string: true
80+
description: Allocatable represents the resources of a node that
81+
are available for scheduling. Defaults to Capacity.
82+
type: object
83+
capacity:
84+
additionalProperties:
85+
anyOf:
86+
- type: integer
87+
- type: string
88+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
89+
x-kubernetes-int-or-string: true
90+
description: 'Capacity represents the total resources of a node.
91+
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity'
92+
type: object
93+
count:
94+
type: integer
95+
type: object
96+
version:
97+
description: 'Info contains versioning information. TODO: Add []string
98+
of api versions supported? It''s still unclear how we''ll want to
99+
distribute that information.'
100+
properties:
101+
buildDate:
102+
type: string
103+
compiler:
104+
type: string
105+
gitCommit:
106+
type: string
107+
gitTreeState:
108+
type: string
109+
gitVersion:
110+
type: string
111+
goVersion:
112+
type: string
113+
major:
114+
type: string
115+
minor:
116+
type: string
117+
platform:
118+
type: string
119+
required:
120+
- buildDate
121+
- compiler
122+
- gitCommit
123+
- gitTreeState
124+
- gitVersion
125+
- goVersion
126+
- major
127+
- minor
128+
- platform
129+
type: object
130+
required:
131+
- nodeStats
132+
type: object
133+
metadata:
134+
type: object
135+
product:
136+
properties:
137+
licenseID:
138+
type: string
139+
productName:
140+
description: This has been renamed to Features
141+
type: string
142+
productOwnerName:
143+
type: string
144+
productOwnerUID:
145+
type: string
146+
productUID:
147+
type: string
148+
version:
149+
properties:
150+
commitHash:
151+
type: string
152+
commitTimestamp:
153+
type: string
154+
compiler:
155+
type: string
156+
gitBranch:
157+
type: string
158+
gitTag:
159+
type: string
160+
goVersion:
161+
type: string
162+
platform:
163+
type: string
164+
version:
165+
type: string
166+
versionStrategy:
167+
type: string
168+
type: object
169+
required:
170+
- version
171+
type: object
172+
required:
173+
- kubernetes
174+
type: object
175+
served: true
176+
storage: true

vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ kmodules.xyz/constants/aws
13051305
kmodules.xyz/constants/azure
13061306
kmodules.xyz/constants/google
13071307
kmodules.xyz/constants/openstack
1308-
# kmodules.xyz/custom-resources v0.0.0-20211007064058-70fba50e58a4
1308+
# kmodules.xyz/custom-resources v0.0.0-20211007080833-72bd9e8cae6e
13091309
## explicit
13101310
kmodules.xyz/custom-resources/apis/appcatalog
13111311
kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1
@@ -1482,7 +1482,7 @@ sigs.k8s.io/structured-merge-diff/v4/typed
14821482
sigs.k8s.io/structured-merge-diff/v4/value
14831483
# sigs.k8s.io/yaml v1.2.0
14841484
sigs.k8s.io/yaml
1485-
# stash.appscode.dev/apimachinery v0.15.1-0.20211001093145-5e773145f153
1485+
# stash.appscode.dev/apimachinery v0.15.1-0.20211007085001-4e2a9445b1d7
14861486
## explicit
14871487
stash.appscode.dev/apimachinery/apis
14881488
stash.appscode.dev/apimachinery/apis/repositories

0 commit comments

Comments
 (0)