Skip to content

Commit 0729ab1

Browse files
Md. Emruz Hossaintamalsaha
authored andcommitted
Add TARGET_RESOURCE variable for BackupConfigurationTemplate (#814)
1 parent bab795c commit 0729ab1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+520
-46
lines changed

apis/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const (
1818
TargetName = "TARGET_NAME"
1919
TargetAPIVersion = "TARGET_API_VERSION"
2020
TargetKind = "TARGET_KIND"
21+
TargetResource = "TARGET_RESOURCE"
2122
TargetNamespace = "TARGET_NAMESPACE"
2223
TargetMountPath = "TARGET_MOUNT_PATH"
2324
TargetDirectories = "TARGET_DIRECTORIES"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/stretchr/testify v1.3.0
3333
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
3434
golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect
35-
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5 // indirect
35+
golang.org/x/sys v0.0.0-20190528183647-3626398d7749 // indirect
3636
gomodules.xyz/cert v1.0.0
3737
gomodules.xyz/envsubst v0.0.0-20190321051520-c745d52104af
3838
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w
439439
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
440440
golang.org/x/sys v0.0.0-20190508100423-12bbe5a7a520 h1:5/ojcKo2vQ2eroPDFcBB9tuc4N42a5njs7UWP2jk3KU=
441441
golang.org/x/sys v0.0.0-20190508100423-12bbe5a7a520/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
442-
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5 h1:sM3evRHxE/1RuMe1FYAL3j7C7fUfIjkbE+NiDAYUF8U=
443-
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
442+
golang.org/x/sys v0.0.0-20190528183647-3626398d7749 h1:oG2HS+e2B9VqK95y67B5MgJIJhOPY27/m5uJKJhHzus=
443+
golang.org/x/sys v0.0.0-20190528183647-3626398d7749/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
444444
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
445445
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
446446
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

pkg/controller/backup.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"k8s.io/client-go/kubernetes/scheme"
1111
"k8s.io/client-go/tools/reference"
1212
core_util "kmodules.xyz/client-go/core/v1"
13+
discovery "kmodules.xyz/client-go/discovery"
1314
meta_util "kmodules.xyz/client-go/meta"
1415
wapi "kmodules.xyz/webhook-runtime/apis/workload/v1"
1516
"stash.appscode.dev/stash/apis"
@@ -69,6 +70,12 @@ func (c *StashController) applyBackupAnnotationLogic(w *wapi.Workload) error {
6970
inputs[apis.TargetName] = w.Name
7071
inputs[apis.TargetNamespace] = w.Namespace
7172

73+
gvr, err := discovery.ResourceForGVK(c.kubeClient.Discovery(), w.GroupVersionKind())
74+
if err != nil {
75+
return err
76+
}
77+
inputs[apis.TargetResource] = gvr.Resource
78+
7279
err = resolve.ResolveBackend(&backupTemplate.Spec.Backend, inputs)
7380
if err != nil {
7481
return err

vendor/golang.org/x/sys/unix/mkerrors.sh

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

vendor/golang.org/x/sys/unix/syscall_linux.go

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_386.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_arm.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)