Skip to content

Commit 06bacfd

Browse files
authored
Update deps (#1534)
* Update deps /cherry-pick Signed-off-by: Tamal Saha <tamal@appscode.com> * Update conditions util Signed-off-by: Tamal Saha <tamal@appscode.com> --------- Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 93a4b4c commit 06bacfd

Some content is hidden

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

52 files changed

+2112
-654
lines changed

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
gomodules.xyz/envsubst v0.1.0
2323
gomodules.xyz/flags v0.1.3
2424
gomodules.xyz/go-sh v0.1.0
25-
gomodules.xyz/logs v0.0.6
25+
gomodules.xyz/logs v0.0.7
2626
gomodules.xyz/pointer v0.1.0
2727
gomodules.xyz/runtime v0.3.0
2828
gomodules.xyz/stow v0.2.4
@@ -35,7 +35,7 @@ require (
3535
k8s.io/klog/v2 v2.80.1
3636
k8s.io/kube-aggregator v0.25.1
3737
k8s.io/kubernetes v0.0.0-00010101000000-000000000000
38-
kmodules.xyz/client-go v0.25.23
38+
kmodules.xyz/client-go v0.25.29
3939
kmodules.xyz/constants v0.0.0-20220317041001-545c1e31a70a
4040
kmodules.xyz/csi-utils v0.25.4
4141
kmodules.xyz/custom-resources v0.25.2
@@ -45,7 +45,7 @@ require (
4545
kmodules.xyz/prober v0.25.0
4646
kmodules.xyz/webhook-runtime v0.25.0
4747
sigs.k8s.io/controller-runtime v0.13.1
48-
stash.appscode.dev/apimachinery v0.30.0
48+
stash.appscode.dev/apimachinery v0.30.1-0.20230814025143-fcb8a9106d3c
4949
)
5050

5151
require (
@@ -169,7 +169,7 @@ require (
169169
golang.org/x/time v0.1.0 // indirect
170170
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
171171
gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f // indirect
172-
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
172+
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
173173
gomodules.xyz/jsonpath v0.0.2 // indirect
174174
gomodules.xyz/mergo v0.3.13 // indirect
175175
gomodules.xyz/password-generator v0.2.9 // indirect

go.sum

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG
257257
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
258258
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
259259
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
260-
github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
261260
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
262261
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
263262
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -639,6 +638,7 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU
639638
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
640639
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
641640
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
641+
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
642642
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
643643
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
644644
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
@@ -1032,12 +1032,12 @@ gomodules.xyz/flags v0.1.3 h1:jQ06+EfmoMv5NvjXvJon03dOhLU+FF0TQMWN7I6qpzs=
10321032
gomodules.xyz/flags v0.1.3/go.mod h1:e+kvBLnqdEWGG670SKOYag1CXStM2Slrxq01OIK3tFs=
10331033
gomodules.xyz/go-sh v0.1.0 h1:1BJAuGREh2RhePt7HRrpmjnkbgfpXlCzc42SiyZ5dkc=
10341034
gomodules.xyz/go-sh v0.1.0/go.mod h1:N8IrjNiYppUI/rxENYrWD6FOrSxSyEZnIekPEWM7LP0=
1035-
gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc=
1036-
gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
1035+
gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw=
1036+
gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
10371037
gomodules.xyz/jsonpath v0.0.2 h1:taUvqxKQ9KqVl3vq/+hLg7rCZUIQjq+izhbvo6nTIkE=
10381038
gomodules.xyz/jsonpath v0.0.2/go.mod h1:du28vmLHrgEV48JqK/7rn92YHsVDoQuqrowb2w6YZmE=
1039-
gomodules.xyz/logs v0.0.6 h1:8+9Wkud5yBPtIvkVszubyTeFxNII30lWODom0+GZD8U=
1040-
gomodules.xyz/logs v0.0.6/go.mod h1:Q+fFtZFLEB5q86KmDehXCGuMP72Rv+Rwz0KuVxK+Gi4=
1039+
gomodules.xyz/logs v0.0.7 h1:dkhpdQuzj+pOS3S7VaOq+JV7BVU7f68/k3uDYufhPow=
1040+
gomodules.xyz/logs v0.0.7/go.mod h1:IEIZbRl9zua2jb35NU4KoqxUEDPmKvem3PhfRHqQI54=
10411041
gomodules.xyz/mergo v0.3.13 h1:q6cL/MMXZH/MrR2+yjSihFFq6UifXqjwaqI48B6cMEM=
10421042
gomodules.xyz/mergo v0.3.13/go.mod h1:F/2rKC7j0URTnHUKDiTiLcGdLMhdv8jK2Za3cRTUVmc=
10431043
gomodules.xyz/password-generator v0.2.9 h1:qYoXoA61+9zs9A1scffefCgcRGpi9Tw1LsTkIe4bEno=
@@ -1231,7 +1231,6 @@ k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
12311231
k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
12321232
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
12331233
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
1234-
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
12351234
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
12361235
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
12371236
k8s.io/kube-aggregator v0.25.1 h1:XJajtusVLQ13kRPFL1xeQ2cHIzGTuXgOet1lMRF89+o=
@@ -1244,8 +1243,8 @@ k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 h1:H9TCJUUx+2VA0ZiD9lvtaX8fthFsM
12441243
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
12451244
kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
12461245
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
1247-
kmodules.xyz/client-go v0.25.23 h1:qz5XJYHLVZUowqfRXEJD7JQ4iaLLzQ1O1zPMmsdrkJw=
1248-
kmodules.xyz/client-go v0.25.23/go.mod h1:wbdzLEoDYiCPI6dTW0mIAGNwkwFV4lC5BN1FJxiDsbw=
1246+
kmodules.xyz/client-go v0.25.29 h1:6CYoTJdLBqdXAaNtWJb1LLowG6KuDwb53ey8u7DS88Y=
1247+
kmodules.xyz/client-go v0.25.29/go.mod h1:r/Va2Y6t1G8X1sPRjrQC6FWB3oh/i6rjssmlfJnbCmg=
12491248
kmodules.xyz/constants v0.0.0-20220317041001-545c1e31a70a h1:wo6TxmquRJwXXX/HejI6NRyfx13UzuHGjndTumlutbc=
12501249
kmodules.xyz/constants v0.0.0-20220317041001-545c1e31a70a/go.mod h1:3C5i73Z7fcMVyu5TXtPuizGD8vWAbesXFVp1ESbIa1k=
12511250
kmodules.xyz/csi-utils v0.25.4 h1:fwTgihG/MEfjhGQylzcb0vqlsCfFT5pdYKRxdg7XrM0=
@@ -1287,5 +1286,5 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
12871286
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
12881287
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
12891288
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
1290-
stash.appscode.dev/apimachinery v0.30.0 h1:imc3OuXaCI8B9ImB1e4QtDYhZCc2VyiXQHW5gheKG/s=
1291-
stash.appscode.dev/apimachinery v0.30.0/go.mod h1:xEWpZn0wmhP0Acpq7cpebNbMXwIui8Crh4dpuE9FHSQ=
1289+
stash.appscode.dev/apimachinery v0.30.1-0.20230814025143-fcb8a9106d3c h1:/3plffjueo5ffL+XhHAtluJ9TfP+K9elbY1tyIxNeKY=
1290+
stash.appscode.dev/apimachinery v0.30.1-0.20230814025143-fcb8a9106d3c/go.mod h1:IDbssRbYLSnMwZAQOGX4Vam+hl43FofP8BuXMLXVaPQ=

pkg/backup/backupsession.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
"k8s.io/client-go/tools/record"
5050
"k8s.io/klog/v2"
5151
kmapi "kmodules.xyz/client-go/api/v1"
52+
condutil "kmodules.xyz/client-go/conditions"
5253
"kmodules.xyz/client-go/meta"
5354
"kmodules.xyz/client-go/tools/queue"
5455
v1 "kmodules.xyz/offshoot-api/api/v1"
@@ -481,7 +482,7 @@ func (c *BackupSessionController) isBackupTakenForThisHost(backupSession *api_v1
481482
if backupSession.Status.Phase == api_v1beta1.BackupSessionSucceeded ||
482483
backupSession.Status.Phase == api_v1beta1.BackupSessionFailed ||
483484
backupSession.Status.Phase == api_v1beta1.BackupSessionSkipped ||
484-
kmapi.IsConditionFalse(backupSession.Status.Conditions, api_v1beta1.GlobalPreBackupHookSucceeded) {
485+
condutil.IsConditionFalse(backupSession.Status.Conditions, api_v1beta1.GlobalPreBackupHookSucceeded) {
485486
return true
486487
}
487488

pkg/cmds/create_volumesnapshot.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (opt *VSoption) createVolumeSnapshot(bsMeta metav1.ObjectMeta, inv invoker.
170170

171171
backupOutput.BackupTargetStatus.Conditions = append(backupOutput.BackupTargetStatus.Conditions, kmapi.Condition{
172172
Type: api_v1beta1.PreBackupHookExecutionSucceeded,
173-
Status: corev1.ConditionTrue,
173+
Status: metav1.ConditionTrue,
174174
Reason: api_v1beta1.SuccessfullyExecutedPreBackupHook,
175175
Message: "Successfully executed preBackup hook.",
176176
LastTransitionTime: metav1.Now(),
@@ -236,7 +236,7 @@ func (opt *VSoption) createVolumeSnapshot(bsMeta metav1.ObjectMeta, inv invoker.
236236
}
237237
backupOutput.BackupTargetStatus.Conditions = append(backupOutput.BackupTargetStatus.Conditions, kmapi.Condition{
238238
Type: api_v1beta1.PostBackupHookExecutionSucceeded,
239-
Status: corev1.ConditionTrue,
239+
Status: metav1.ConditionTrue,
240240
Reason: api_v1beta1.SuccessfullyExecutedPostBackupHook,
241241
Message: "Successfully executed postBackup hook",
242242
LastTransitionTime: metav1.Now(),

pkg/controller/backup_session.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import (
4545
"k8s.io/klog/v2"
4646
kutil "kmodules.xyz/client-go"
4747
kmapi "kmodules.xyz/client-go/api/v1"
48+
condutil "kmodules.xyz/client-go/conditions"
4849
"kmodules.xyz/client-go/meta"
4950
"kmodules.xyz/client-go/tools/queue"
5051
"kmodules.xyz/webhook-runtime/admission"
@@ -540,7 +541,7 @@ func (r *backupSessionReconciler) initiateTargetBackup(index int) error {
540541
}
541542

542543
func (r *backupSessionReconciler) isBackupHistoryCleaned() bool {
543-
return kmapi.HasCondition(r.session.GetConditions(), api_v1beta1.BackupHistoryCleaned)
544+
return condutil.HasCondition(r.session.GetConditions(), api_v1beta1.BackupHistoryCleaned)
544545
}
545546

546547
// cleanupBackupHistory deletes old BackupSessions and theirs associate resources according to BackupHistoryLimit
@@ -623,7 +624,7 @@ func (r *backupSessionReconciler) shouldWaitForTargetPostBackupHookExecution() b
623624
func (r *backupSessionReconciler) targetPreBackupHookFailed(targetRef api_v1beta1.TargetRef) bool {
624625
for _, s := range r.session.GetTargetStatus() {
625626
if invoker.TargetMatched(s.Ref, targetRef) {
626-
return kmapi.IsConditionFalse(s.Conditions, api_v1beta1.PreBackupHookExecutionSucceeded)
627+
return condutil.IsConditionFalse(s.Conditions, api_v1beta1.PreBackupHookExecutionSucceeded)
627628
}
628629
}
629630
return false
@@ -636,7 +637,7 @@ func (r *backupSessionReconciler) postBackupHookExecutedForTarget(targetInfo inv
636637

637638
for _, s := range r.session.GetTargetStatus() {
638639
if invoker.TargetMatched(s.Ref, targetInfo.Target.Ref) {
639-
if kmapi.HasCondition(s.Conditions, api_v1beta1.PostBackupHookExecutionSucceeded) {
640+
if condutil.HasCondition(s.Conditions, api_v1beta1.PostBackupHookExecutionSucceeded) {
640641
return true
641642
}
642643
}
@@ -650,7 +651,7 @@ func (r *backupSessionReconciler) shouldExecuteGlobalPostBackupHook() bool {
650651
if r.globalPreBackupHookFailed() {
651652
return false
652653
}
653-
return !kmapi.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPostBackupHookSucceeded)
654+
return !condutil.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPostBackupHookSucceeded)
654655
}
655656
return false
656657
}
@@ -695,7 +696,7 @@ func (r *backupSessionReconciler) executeGlobalPostBackupHook() error {
695696
func (r *backupSessionReconciler) shouldExecuteGlobalPreBackupHook() bool {
696697
hook := r.invoker.GetGlobalHooks()
697698
if hook != nil && hook.PreBackup != nil {
698-
return !kmapi.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded)
699+
return !condutil.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded)
699700
}
700701
return false
701702
}
@@ -809,7 +810,7 @@ func (r *backupSessionReconciler) isSessionCompleted() bool {
809810
return true
810811
}
811812

812-
if kmapi.IsConditionTrue(r.session.GetConditions(), api_v1beta1.DeadlineExceeded) {
813+
if condutil.IsConditionTrue(r.session.GetConditions(), api_v1beta1.DeadlineExceeded) {
813814
return true
814815
}
815816

@@ -820,7 +821,7 @@ func (r *backupSessionReconciler) isSessionCompleted() bool {
820821
}
821822

822823
func (r *backupSessionReconciler) globalPreBackupHookFailed() bool {
823-
return kmapi.IsConditionFalse(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded)
824+
return condutil.IsConditionFalse(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded)
824825
}
825826

826827
func (r *backupSessionReconciler) isBackupRunning() bool {
@@ -913,7 +914,7 @@ func (r *backupSessionReconciler) getIncompleteBackupSessionForTarget(targetRef
913914
}
914915

915916
func (r *backupSessionReconciler) backupMetricPushed() bool {
916-
return kmapi.IsConditionTrue(r.session.GetConditions(), api_v1beta1.MetricsPushed)
917+
return condutil.IsConditionTrue(r.session.GetConditions(), api_v1beta1.MetricsPushed)
917918
}
918919

919920
func (r *backupSessionReconciler) sendBackupMetrics() error {

pkg/controller/restore_session.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"k8s.io/klog/v2"
4040
kutil "kmodules.xyz/client-go"
4141
kmapi "kmodules.xyz/client-go/api/v1"
42+
condutil "kmodules.xyz/client-go/conditions"
4243
core_util "kmodules.xyz/client-go/core/v1"
4344
"kmodules.xyz/client-go/meta"
4445
"kmodules.xyz/client-go/tools/queue"
@@ -392,7 +393,7 @@ func (r *restoreInvokerReconciler) isSessionCompleted() bool {
392393
return true
393394
}
394395

395-
if kmapi.IsConditionTrue(r.invoker.GetStatus().Conditions, api_v1beta1.DeadlineExceeded) {
396+
if condutil.IsConditionTrue(r.invoker.GetStatus().Conditions, api_v1beta1.DeadlineExceeded) {
396397
return true
397398
}
398399

@@ -403,7 +404,7 @@ func (r *restoreInvokerReconciler) isSessionCompleted() bool {
403404
}
404405

405406
func (r *restoreInvokerReconciler) globalPreRestoreHookFailed() bool {
406-
return kmapi.IsConditionFalse(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded)
407+
return condutil.IsConditionFalse(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded)
407408
}
408409

409410
func (r *restoreInvokerReconciler) shouldWaitForTargetPostRestoreHookExecution() bool {
@@ -423,7 +424,7 @@ func (r *restoreInvokerReconciler) shouldWaitForTargetPostRestoreHookExecution()
423424
func (r *restoreInvokerReconciler) targetPreRestoreHookFailed(targetRef api_v1beta1.TargetRef) bool {
424425
for _, s := range r.invoker.GetStatus().TargetStatus {
425426
if invoker.TargetMatched(s.Ref, targetRef) {
426-
return kmapi.IsConditionFalse(s.Conditions, api_v1beta1.PreRestoreHookExecutionSucceeded)
427+
return condutil.IsConditionFalse(s.Conditions, api_v1beta1.PreRestoreHookExecutionSucceeded)
427428
}
428429
}
429430
return false
@@ -437,7 +438,7 @@ func (r *restoreInvokerReconciler) postRestoreHookExecutedForTarget(targetInfo i
437438

438439
for _, s := range status.TargetStatus {
439440
if invoker.TargetMatched(s.Ref, targetInfo.Target.Ref) {
440-
if kmapi.HasCondition(s.Conditions, api_v1beta1.PostRestoreHookExecutionSucceeded) {
441+
if condutil.HasCondition(s.Conditions, api_v1beta1.PostRestoreHookExecutionSucceeded) {
441442
return true
442443
}
443444
}
@@ -451,7 +452,7 @@ func (r *restoreInvokerReconciler) shouldExecuteGlobalPostRestoreHook() bool {
451452
if r.globalPreRestoreHookFailed() {
452453
return false
453454
}
454-
return !kmapi.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPostRestoreHookSucceeded)
455+
return !condutil.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPostRestoreHookSucceeded)
455456
}
456457
return false
457458
}
@@ -493,7 +494,7 @@ func (r *restoreInvokerReconciler) executeGlobalPostRestoreHook() error {
493494
func (r *restoreInvokerReconciler) shouldExecuteGlobalPreRestoreHook() bool {
494495
hook := r.invoker.GetGlobalHooks()
495496
if hook != nil && hook.PreRestore != nil {
496-
return !kmapi.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded)
497+
return !condutil.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded)
497498
}
498499
return false
499500
}
@@ -524,7 +525,7 @@ func (r *restoreInvokerReconciler) targetRestoreInitiated(targetRef api_v1beta1.
524525
}
525526
for _, target := range status.TargetStatus {
526527
if invoker.TargetMatched(target.Ref, targetRef) {
527-
return kmapi.HasCondition(target.Conditions, api_v1beta1.RestoreExecutorEnsured) || target.Phase == api_v1beta1.TargetRestoreRunning
528+
return condutil.HasCondition(target.Conditions, api_v1beta1.RestoreExecutorEnsured) || target.Phase == api_v1beta1.TargetRestoreRunning
528529
}
529530
}
530531
return false
@@ -557,7 +558,7 @@ func (r *restoreInvokerReconciler) setTargetRestorePending(targetRef api_v1beta1
557558
}
558559

559560
func restoreMetricsPushed(conditions []kmapi.Condition) bool {
560-
return kmapi.IsConditionTrue(conditions, api_v1beta1.MetricsPushed)
561+
return condutil.IsConditionTrue(conditions, api_v1beta1.MetricsPushed)
561562
}
562563

563564
func (r *restoreInvokerReconciler) sendRestoreMetrics() error {

pkg/restore/restore.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
"k8s.io/client-go/tools/leaderelection/resourcelock"
4141
"k8s.io/klog/v2"
4242
kmapi "kmodules.xyz/client-go/api/v1"
43+
condutil "kmodules.xyz/client-go/conditions"
4344
"kmodules.xyz/client-go/meta"
4445
v1 "kmodules.xyz/offshoot-api/api/v1"
4546
)
@@ -254,7 +255,7 @@ func (opt *Options) isRestoredForThisHost(inv invoker.RestoreInvoker, targetInfo
254255
if phase == api_v1beta1.RestoreSucceeded ||
255256
phase == api_v1beta1.RestoreFailed ||
256257
phase == api_v1beta1.RestorePhaseUnknown ||
257-
kmapi.IsConditionFalse(inv.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) {
258+
condutil.IsConditionFalse(inv.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) {
258259
return true
259260
}
260261
for _, member := range inv.GetStatus().TargetStatus {

pkg/status/status.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242
"k8s.io/client-go/rest"
4343
"k8s.io/klog/v2"
4444
kmapi "kmodules.xyz/client-go/api/v1"
45+
condutil "kmodules.xyz/client-go/conditions"
4546
)
4647

4748
type UpdateStatusOptions struct {
@@ -311,7 +312,7 @@ func (o UpdateStatusOptions) applyRetentionPolicy(inv invoker.BackupInvoker, ses
311312
}
312313

313314
func isRetentionPolicyApplied(session *invoker.BackupSessionHandler) bool {
314-
return kmapi.HasCondition(session.GetConditions(), v1beta1.RetentionPolicyApplied)
315+
return condutil.HasCondition(session.GetConditions(), v1beta1.RetentionPolicyApplied)
315316
}
316317

317318
func (o UpdateStatusOptions) verifyRepositoryIntegrity(session *invoker.BackupSessionHandler) (*restic.RepositoryStats, error) {
@@ -331,7 +332,7 @@ func (o UpdateStatusOptions) verifyRepositoryIntegrity(session *invoker.BackupSe
331332
}
332333

333334
func isRepoIntegrityVerified(session *invoker.BackupSessionHandler) bool {
334-
return kmapi.HasCondition(session.GetConditions(), v1beta1.RepositoryIntegrityVerified)
335+
return condutil.HasCondition(session.GetConditions(), v1beta1.RepositoryIntegrityVerified)
335336
}
336337

337338
func (o *UpdateStatusOptions) sendRepositoryMetrics(inv invoker.BackupInvoker, session *invoker.BackupSessionHandler, repoStats restic.RepositoryStats) error {
@@ -347,7 +348,7 @@ func (o *UpdateStatusOptions) sendRepositoryMetrics(inv invoker.BackupInvoker, s
347348
}
348349

349350
func isRepositoryMetricSent(session *invoker.BackupSessionHandler) bool {
350-
return kmapi.HasCondition(session.GetConditions(), v1beta1.RepositoryMetricsPushed)
351+
return condutil.HasCondition(session.GetConditions(), v1beta1.RepositoryMetricsPushed)
351352
}
352353

353354
func (o *UpdateStatusOptions) updateRepositoryStatus(inv invoker.BackupInvoker, session *invoker.BackupSessionHandler, repoStats restic.RepositoryStats) error {

test/e2e/framework/conditions.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@ import (
2222
"stash.appscode.dev/apimachinery/apis/stash/v1beta1"
2323

2424
. "github.com/onsi/gomega"
25-
core "k8s.io/api/core/v1"
2625
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2726
kmapi "kmodules.xyz/client-go/api/v1"
27+
condutil "kmodules.xyz/client-go/conditions"
2828
)
2929

3030
func (f *Framework) EventuallyCondition(meta metav1.ObjectMeta, kind string, condType string) GomegaAsyncAssertion {
3131
return Eventually(
32-
func() core.ConditionStatus {
32+
func() metav1.ConditionStatus {
3333
var conditions []kmapi.Condition
3434
switch kind {
3535
case v1beta1.ResourceKindBackupConfiguration:
3636
bc, err := f.StashClient.StashV1beta1().BackupConfigurations(meta.Namespace).Get(context.TODO(), meta.Name, metav1.GetOptions{})
3737
if err != nil {
38-
return core.ConditionUnknown
38+
return metav1.ConditionUnknown
3939
}
4040
conditions = bc.Status.Conditions
4141
case v1beta1.ResourceKindRestoreSession:
4242
rs, err := f.StashClient.StashV1beta1().RestoreSessions(meta.Namespace).Get(context.TODO(), meta.Name, metav1.GetOptions{})
4343
if err != nil {
44-
return core.ConditionUnknown
44+
return metav1.ConditionUnknown
4545
}
4646
conditions = rs.Status.Conditions
4747
}
48-
_, cond := kmapi.GetCondition(conditions, condType)
48+
_, cond := condutil.GetCondition(conditions, condType)
4949
if cond == nil {
50-
return core.ConditionUnknown
50+
return metav1.ConditionUnknown
5151
}
5252
return cond.Status
5353
},

vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package jsonpatch
22

33
import (
4+
"bytes"
45
"encoding/json"
56
"fmt"
67
"reflect"
@@ -64,6 +65,9 @@ func NewOperation(op, path string, value interface{}) Operation {
6465
//
6566
// An error will be returned if any of the two documents are invalid.
6667
func CreatePatch(a, b []byte) ([]Operation, error) {
68+
if bytes.Equal(a, b) {
69+
return []Operation{}, nil
70+
}
6771
var aI interface{}
6872
var bI interface{}
6973
err := json.Unmarshal(a, &aI)

0 commit comments

Comments
 (0)