Skip to content

Commit

Permalink
Refactor restore process status handling + add cross namespace tests (#…
Browse files Browse the repository at this point in the history
…1419)

Signed-off-by: Emruz Hossain <[email protected]>
  • Loading branch information
Emruz Hossain authored Feb 10, 2022
1 parent 080ebfc commit 2162c12
Show file tree
Hide file tree
Showing 26 changed files with 813 additions and 615 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
kmodules.xyz/openshift v0.0.0-20210618001443-f2507caa512f
kmodules.xyz/prober v0.0.0-20210618020259-5836fb959027
kmodules.xyz/webhook-runtime v0.0.0-20211116181908-909a755cc9d1
stash.appscode.dev/apimachinery v0.17.1-0.20220203132324-9c5287433ad7
stash.appscode.dev/apimachinery v0.17.1-0.20220210134237-79d844fbde2c
)

require (
Expand Down
7 changes: 2 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1240,16 +1240,13 @@ kmodules.xyz/client-go v0.0.0-20210617233340-13d22e91512b/go.mod h1:A6GAK6xP5zBu
kmodules.xyz/client-go v0.0.0-20211013093146-1fbfd52e78c9/go.mod h1:0gkPeALtYjB27OHt4rd6+ZmMgoVTHVLtEJQeU23/gtA=
kmodules.xyz/client-go v0.0.0-20211107190155-5bb4090d2728/go.mod h1:ENUu8pPK19xzBkVpAJHoGCI2QRvb1SqffWRt0K2sV5I=
kmodules.xyz/client-go v0.0.0-20220104114408-2a3a05dbe89f/go.mod h1:xxl1ve1Obe4xaW+XjXsNHyLTni4QPIvHn9TfnYEoQRo=
kmodules.xyz/client-go v0.0.0-20220131065336-bb3e98486e83/go.mod h1:aOwnhdxO0uh54ds1wQYRlKVtYlzLyakaesmMQeupVek=
kmodules.xyz/client-go v0.0.0-20220203031013-1de48437aaf3 h1:CWux6RrrTkplf9F0ChJwkEEQuOorbc5rzmqC7uJUUZU=
kmodules.xyz/client-go v0.0.0-20220203031013-1de48437aaf3/go.mod h1:aOwnhdxO0uh54ds1wQYRlKVtYlzLyakaesmMQeupVek=
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-20220104123914-3c036dd7c1cd/go.mod h1:/XjDeILFV2wBota5kHo21DMvOt08nSAk1vm6buCuwt4=
kmodules.xyz/custom-resources v0.0.0-20220208103158-61b298634e43 h1:mwW2DgP7sAMambZe7Met/e9nrBYnzYgM/lupbm7jgGM=
kmodules.xyz/custom-resources v0.0.0-20220208103158-61b298634e43/go.mod h1:/XjDeILFV2wBota5kHo21DMvOt08nSAk1vm6buCuwt4=
kmodules.xyz/objectstore-api v0.0.0-20211116180107-8720be0c9bf7/go.mod h1:IICnDdPFOEeGXdaPVHOGYfdwD1cyh/p1I/TWMkyNTIE=
kmodules.xyz/objectstore-api v0.0.0-20211207131029-3271069de43e h1:hbnb7Zy6pe0IwWWdIVbgfzBLM3kmppUMDpf7Sxy11d8=
kmodules.xyz/objectstore-api v0.0.0-20211207131029-3271069de43e/go.mod h1:IICnDdPFOEeGXdaPVHOGYfdwD1cyh/p1I/TWMkyNTIE=
kmodules.xyz/offshoot-api v0.0.0-20210829122105-6f4d481b0c61/go.mod h1:3LECbAL3FgbyK80NP3V3Pmiuo/a3hFWg/PR6SPFhTns=
Expand Down Expand Up @@ -1297,5 +1294,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.17.1-0.20220203132324-9c5287433ad7 h1:C3TtXd5Efy81zI2DV2o2nBYNqEK+nXW8s57gubLsUrM=
stash.appscode.dev/apimachinery v0.17.1-0.20220203132324-9c5287433ad7/go.mod h1:9EmPzpKoqgD3BZUM59kQGL7oMrjU+oEn4T3HO1whvwA=
stash.appscode.dev/apimachinery v0.17.1-0.20220210134237-79d844fbde2c h1:Lyyp0gQq9VhLIml9myRxC92VovU3oNvz/s0WsYxpxrE=
stash.appscode.dev/apimachinery v0.17.1-0.20220210134237-79d844fbde2c/go.mod h1:MDzqJ66A2QZKAHRksfHT5crOD29a0S5Hfuy/D5hHAjw=
4 changes: 2 additions & 2 deletions pkg/controller/init_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (c *StashController) handleInitContainerInjectionFailure(w *wapi.Workload,
klog.Warningf("Failed to inject stash init-container into %s %s/%s. Reason: %v", w.Kind, w.Namespace, w.Name, err)

// Set "StashInitContainerInjected" condition to "False"
cerr := conditions.SetInitContainerInjectedConditionToFalse(inv, ref, err)
cerr := conditions.SetInitContainerInjectedConditionToFalse(inv, &ref, err)

// write event to respective resource
_, err2 := eventer.CreateEvent(
Expand All @@ -175,7 +175,7 @@ func (c *StashController) handleInitContainerInjectionSuccess(w *wapi.Workload,
klog.Infof("Successfully injected stash init-container into %s %s/%s.", w.Kind, w.Namespace, w.Name)

// Set "StashInitContainerInjected" condition to "True"
cerr := conditions.SetInitContainerInjectedConditionToTrue(inv, ref)
cerr := conditions.SetInitContainerInjectedConditionToTrue(inv, &ref)

// write event to respective resource
_, err2 := eventer.CreateEvent(
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (c *StashController) requeueRepositoryReferences(repository *api.Repository
c.bcQueue.GetQueue().Add(key)

default:
return fmt.Errorf("Reference kind %q is unknown", ref.Kind)
return fmt.Errorf("reference kind %q is unknown", ref.Kind)
}
}

Expand Down
Loading

0 comments on commit 2162c12

Please sign in to comment.