Skip to content

Commit

Permalink
Use stash-trigger as backup triggering CronJob name prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Emruz Hossain <emruz@appscode.com>
  • Loading branch information
Emruz Hossain committed Sep 16, 2021
1 parent 5027ae4 commit e08ce8f
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ require (
kmodules.xyz/prober v0.0.0-20210618020259-5836fb959027
kmodules.xyz/resource-metadata v0.5.8-0.20210829123359-8f6a3d706da5 // indirect
kmodules.xyz/webhook-runtime v0.0.0-20210829120758-f6ab57afa7e4
stash.appscode.dev/apimachinery v0.15.0
stash.appscode.dev/apimachinery v0.15.1-0.20210916061209-8cbe8b9ddbfb
)

replace bitbucket.org/ww/goautoneg => gomodules.xyz/goautoneg v0.0.0-20120707110453-a547fc61f48d
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1225,11 +1225,9 @@ kmodules.xyz/client-go v0.0.0-20210909114628-15cac6c74063/go.mod h1:0gkPeALtYjB2
kmodules.xyz/constants v0.0.0-20210218100002-2c304bfda278 h1:sFmqh4EaiZ4K2FkkGvrDFddstq8GSf6ogH24IAsuKew=
kmodules.xyz/constants v0.0.0-20210218100002-2c304bfda278/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY=
kmodules.xyz/crd-schema-fuzz v0.0.0-20210618002152-fae23aef5fb4/go.mod h1:IIkUctlfoptoci0BOrsUf8ya+MOG5uaeh1PE4uzaIbA=
kmodules.xyz/custom-resources v0.0.0-20210618003440-c6bb400da153/go.mod h1:/NLuNSf299U0XVuNEh2swtw3EczWFRL3Sx24WhNoWCM=
kmodules.xyz/custom-resources v0.0.0-20210829135624-c63be82e13c0 h1:sCzXaZ9wWsKjOF/j4mTd8zeAXhd6BWZrdKJ8Dr6c++U=
kmodules.xyz/custom-resources v0.0.0-20210829135624-c63be82e13c0/go.mod h1:VYtz1fgHgLqCk+sdSUGBClfZfJ6z4873wB5MYOXxpS8=
kmodules.xyz/monitoring-agent-api v0.0.0-20210618005119-a8c212adc2bf/go.mod h1:QsbPe5SefM7XmLzJgdMX/1iXxwqAC1Do1eHa98TCq3k=
kmodules.xyz/objectstore-api v0.0.0-20210618005912-71f8a80f48f9/go.mod h1:8sCfgZQImwjTLh2mDxYiim6+GecFN+DamkPSF9joyu4=
kmodules.xyz/objectstore-api v0.0.0-20210829122106-d39859fc2d56 h1:hAROzfrhdJPMDJ8tKnwSSt4WIe+OdQobS0gmSo+VhyA=
kmodules.xyz/objectstore-api v0.0.0-20210829122106-d39859fc2d56/go.mod h1:Tkcf9uTplnrJ6C8o0zlw2kpgS1SaWAiMO5P2YgLjTo8=
kmodules.xyz/offshoot-api v0.0.0-20210618005544-5217a24765da/go.mod h1:3LECbAL3FgbyK80NP3V3Pmiuo/a3hFWg/PR6SPFhTns=
Expand Down Expand Up @@ -1271,5 +1269,5 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
stash.appscode.dev/apimachinery v0.15.0 h1:vpwPKV6LP4ieZ87/2ri3ms4r3ZnE8bES24y8bbLYxqE=
stash.appscode.dev/apimachinery v0.15.0/go.mod h1:ColOw+Y5IeI3DO5bu1WZWw2AAhinz99K6fKKVLNkd2U=
stash.appscode.dev/apimachinery v0.15.1-0.20210916061209-8cbe8b9ddbfb h1:npmpqegjv1Wuf7WPqhp2p9AAp8zXrBmGacq7318qmWg=
stash.appscode.dev/apimachinery v0.15.1-0.20210916061209-8cbe8b9ddbfb/go.mod h1:iyBZuC+pUvE9q0ZH2UsvDHEhxLBjOh7/LuhQYccClcg=
6 changes: 3 additions & 3 deletions pkg/controller/backup_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func (c *StashController) EnsureBackupTriggeringCronJob(inv invoker.BackupInvoke
// ServiceAccount has been specified, so use it.
serviceAccountName = inv.RuntimeSettings.Pod.ServiceAccountName
} else {
// ServiceAccount hasn't been specified. so create new one with same name as BackupConfiguration object prefixed with stash-backup.
// ServiceAccount hasn't been specified. so create new one with same name as BackupConfiguration object prefixed with stash-trigger.
serviceAccountName = meta.Name

_, _, err := core_util.CreateOrPatchServiceAccount(
Expand Down Expand Up @@ -404,7 +404,7 @@ func (c *StashController) EnsureBackupTriggeringCronJob(inv invoker.BackupInvoke
in.Spec.JobTemplate.Spec.Template.Labels = core_util.UpsertMap(in.Spec.JobTemplate.Spec.Template.Labels, inv.Labels)

container := core.Container{
Name: apis.StashContainer,
Name: apis.StashCronJobContainer,
ImagePullPolicy: core.PullIfNotPresent,
Image: image.ToContainerImage(),
Args: []string{
Expand Down Expand Up @@ -469,7 +469,7 @@ func (c *StashController) EnsureBackupTriggeringCronJobDeleted(inv invoker.Backu
}

func getBackupCronJobName(name string) string {
return meta2.ValidCronJobNameWithPrefix(apis.PrefixStashBackup, strings.ReplaceAll(name, ".", "-"))
return meta2.ValidCronJobNameWithPrefix(apis.PrefixStashTrigger, strings.ReplaceAll(name, ".", "-"))
}

func (c *StashController) handleCronJobCreationFailure(ref *core.ObjectReference, err error) error {
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,7 @@ sigs.k8s.io/structured-merge-diff/v4/typed
sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
sigs.k8s.io/yaml
# stash.appscode.dev/apimachinery v0.15.0
# stash.appscode.dev/apimachinery v0.15.1-0.20210916061209-8cbe8b9ddbfb
## explicit
stash.appscode.dev/apimachinery/apis
stash.appscode.dev/apimachinery/apis/repositories
Expand Down
18 changes: 10 additions & 8 deletions vendor/stash.appscode.dev/apimachinery/apis/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,16 @@ const (
PrefixStashBackup = "stash-backup"
PrefixStashRestore = "stash-restore"
PrefixStashVolumeSnapshot = "stash-vs"

StashContainer = "stash"
StashInitContainer = "stash-init"
LocalVolumeName = "stash-local"
ScratchDirVolumeName = "stash-scratchdir"
TmpDirVolumeName = "tmp-dir"
TmpDirMountPath = "/tmp"
PodinfoVolumeName = "stash-podinfo"
PrefixStashTrigger = "stash-trigger"

StashContainer = "stash"
StashInitContainer = "stash-init"
StashCronJobContainer = "stash-trigger"
LocalVolumeName = "stash-local"
ScratchDirVolumeName = "stash-scratchdir"
TmpDirVolumeName = "tmp-dir"
TmpDirMountPath = "/tmp"
PodinfoVolumeName = "stash-podinfo"

RecoveryJobPrefix = "stash-recovery-"
ScaledownCronPrefix = "stash-scaledown-cron-"
Expand Down

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

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

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

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

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

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

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

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

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

0 comments on commit e08ce8f

Please sign in to comment.