diff --git a/go.mod b/go.mod index 5bd23db82..6f5e0d418 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( gomodules.xyz/envsubst v0.1.0 gomodules.xyz/flags v0.1.3 gomodules.xyz/go-sh v0.1.0 - gomodules.xyz/logs v0.0.6 + gomodules.xyz/logs v0.0.7 gomodules.xyz/pointer v0.1.0 gomodules.xyz/runtime v0.3.0 gomodules.xyz/stow v0.2.4 @@ -35,7 +35,7 @@ require ( k8s.io/klog/v2 v2.80.1 k8s.io/kube-aggregator v0.25.1 k8s.io/kubernetes v0.0.0-00010101000000-000000000000 - kmodules.xyz/client-go v0.25.23 + kmodules.xyz/client-go v0.25.29 kmodules.xyz/constants v0.0.0-20220317041001-545c1e31a70a kmodules.xyz/csi-utils v0.25.4 kmodules.xyz/custom-resources v0.25.2 @@ -45,7 +45,7 @@ require ( kmodules.xyz/prober v0.25.0 kmodules.xyz/webhook-runtime v0.25.0 sigs.k8s.io/controller-runtime v0.13.1 - stash.appscode.dev/apimachinery v0.30.0 + stash.appscode.dev/apimachinery v0.30.1-0.20230814025143-fcb8a9106d3c ) require ( @@ -169,7 +169,7 @@ require ( golang.org/x/time v0.1.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f // indirect - gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gomodules.xyz/jsonpath v0.0.2 // indirect gomodules.xyz/mergo v0.3.13 // indirect gomodules.xyz/password-generator v0.2.9 // indirect diff --git a/go.sum b/go.sum index ced71447f..881117e3d 100644 --- a/go.sum +++ b/go.sum @@ -257,7 +257,6 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= 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 github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= 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= gomodules.xyz/flags v0.1.3/go.mod h1:e+kvBLnqdEWGG670SKOYag1CXStM2Slrxq01OIK3tFs= gomodules.xyz/go-sh v0.1.0 h1:1BJAuGREh2RhePt7HRrpmjnkbgfpXlCzc42SiyZ5dkc= gomodules.xyz/go-sh v0.1.0/go.mod h1:N8IrjNiYppUI/rxENYrWD6FOrSxSyEZnIekPEWM7LP0= -gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc= -gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= +gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= gomodules.xyz/jsonpath v0.0.2 h1:taUvqxKQ9KqVl3vq/+hLg7rCZUIQjq+izhbvo6nTIkE= gomodules.xyz/jsonpath v0.0.2/go.mod h1:du28vmLHrgEV48JqK/7rn92YHsVDoQuqrowb2w6YZmE= -gomodules.xyz/logs v0.0.6 h1:8+9Wkud5yBPtIvkVszubyTeFxNII30lWODom0+GZD8U= -gomodules.xyz/logs v0.0.6/go.mod h1:Q+fFtZFLEB5q86KmDehXCGuMP72Rv+Rwz0KuVxK+Gi4= +gomodules.xyz/logs v0.0.7 h1:dkhpdQuzj+pOS3S7VaOq+JV7BVU7f68/k3uDYufhPow= +gomodules.xyz/logs v0.0.7/go.mod h1:IEIZbRl9zua2jb35NU4KoqxUEDPmKvem3PhfRHqQI54= gomodules.xyz/mergo v0.3.13 h1:q6cL/MMXZH/MrR2+yjSihFFq6UifXqjwaqI48B6cMEM= gomodules.xyz/mergo v0.3.13/go.mod h1:F/2rKC7j0URTnHUKDiTiLcGdLMhdv8jK2Za3cRTUVmc= 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 k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= 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 k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= -kmodules.xyz/client-go v0.25.23 h1:qz5XJYHLVZUowqfRXEJD7JQ4iaLLzQ1O1zPMmsdrkJw= -kmodules.xyz/client-go v0.25.23/go.mod h1:wbdzLEoDYiCPI6dTW0mIAGNwkwFV4lC5BN1FJxiDsbw= +kmodules.xyz/client-go v0.25.29 h1:6CYoTJdLBqdXAaNtWJb1LLowG6KuDwb53ey8u7DS88Y= +kmodules.xyz/client-go v0.25.29/go.mod h1:r/Va2Y6t1G8X1sPRjrQC6FWB3oh/i6rjssmlfJnbCmg= kmodules.xyz/constants v0.0.0-20220317041001-545c1e31a70a h1:wo6TxmquRJwXXX/HejI6NRyfx13UzuHGjndTumlutbc= kmodules.xyz/constants v0.0.0-20220317041001-545c1e31a70a/go.mod h1:3C5i73Z7fcMVyu5TXtPuizGD8vWAbesXFVp1ESbIa1k= 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= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= -stash.appscode.dev/apimachinery v0.30.0 h1:imc3OuXaCI8B9ImB1e4QtDYhZCc2VyiXQHW5gheKG/s= -stash.appscode.dev/apimachinery v0.30.0/go.mod h1:xEWpZn0wmhP0Acpq7cpebNbMXwIui8Crh4dpuE9FHSQ= +stash.appscode.dev/apimachinery v0.30.1-0.20230814025143-fcb8a9106d3c h1:/3plffjueo5ffL+XhHAtluJ9TfP+K9elbY1tyIxNeKY= +stash.appscode.dev/apimachinery v0.30.1-0.20230814025143-fcb8a9106d3c/go.mod h1:IDbssRbYLSnMwZAQOGX4Vam+hl43FofP8BuXMLXVaPQ= diff --git a/pkg/backup/backupsession.go b/pkg/backup/backupsession.go index 1a435a329..5217d7175 100644 --- a/pkg/backup/backupsession.go +++ b/pkg/backup/backupsession.go @@ -49,6 +49,7 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" + condutil "kmodules.xyz/client-go/conditions" "kmodules.xyz/client-go/meta" "kmodules.xyz/client-go/tools/queue" v1 "kmodules.xyz/offshoot-api/api/v1" @@ -481,7 +482,7 @@ func (c *BackupSessionController) isBackupTakenForThisHost(backupSession *api_v1 if backupSession.Status.Phase == api_v1beta1.BackupSessionSucceeded || backupSession.Status.Phase == api_v1beta1.BackupSessionFailed || backupSession.Status.Phase == api_v1beta1.BackupSessionSkipped || - kmapi.IsConditionFalse(backupSession.Status.Conditions, api_v1beta1.GlobalPreBackupHookSucceeded) { + condutil.IsConditionFalse(backupSession.Status.Conditions, api_v1beta1.GlobalPreBackupHookSucceeded) { return true } diff --git a/pkg/cmds/create_volumesnapshot.go b/pkg/cmds/create_volumesnapshot.go index 28c818414..d8d68fc7f 100644 --- a/pkg/cmds/create_volumesnapshot.go +++ b/pkg/cmds/create_volumesnapshot.go @@ -170,7 +170,7 @@ func (opt *VSoption) createVolumeSnapshot(bsMeta metav1.ObjectMeta, inv invoker. backupOutput.BackupTargetStatus.Conditions = append(backupOutput.BackupTargetStatus.Conditions, kmapi.Condition{ Type: api_v1beta1.PreBackupHookExecutionSucceeded, - Status: corev1.ConditionTrue, + Status: metav1.ConditionTrue, Reason: api_v1beta1.SuccessfullyExecutedPreBackupHook, Message: "Successfully executed preBackup hook.", LastTransitionTime: metav1.Now(), @@ -236,7 +236,7 @@ func (opt *VSoption) createVolumeSnapshot(bsMeta metav1.ObjectMeta, inv invoker. } backupOutput.BackupTargetStatus.Conditions = append(backupOutput.BackupTargetStatus.Conditions, kmapi.Condition{ Type: api_v1beta1.PostBackupHookExecutionSucceeded, - Status: corev1.ConditionTrue, + Status: metav1.ConditionTrue, Reason: api_v1beta1.SuccessfullyExecutedPostBackupHook, Message: "Successfully executed postBackup hook", LastTransitionTime: metav1.Now(), diff --git a/pkg/controller/backup_session.go b/pkg/controller/backup_session.go index a90c08ce0..937f53d84 100644 --- a/pkg/controller/backup_session.go +++ b/pkg/controller/backup_session.go @@ -45,6 +45,7 @@ import ( "k8s.io/klog/v2" kutil "kmodules.xyz/client-go" kmapi "kmodules.xyz/client-go/api/v1" + condutil "kmodules.xyz/client-go/conditions" "kmodules.xyz/client-go/meta" "kmodules.xyz/client-go/tools/queue" "kmodules.xyz/webhook-runtime/admission" @@ -540,7 +541,7 @@ func (r *backupSessionReconciler) initiateTargetBackup(index int) error { } func (r *backupSessionReconciler) isBackupHistoryCleaned() bool { - return kmapi.HasCondition(r.session.GetConditions(), api_v1beta1.BackupHistoryCleaned) + return condutil.HasCondition(r.session.GetConditions(), api_v1beta1.BackupHistoryCleaned) } // cleanupBackupHistory deletes old BackupSessions and theirs associate resources according to BackupHistoryLimit @@ -623,7 +624,7 @@ func (r *backupSessionReconciler) shouldWaitForTargetPostBackupHookExecution() b func (r *backupSessionReconciler) targetPreBackupHookFailed(targetRef api_v1beta1.TargetRef) bool { for _, s := range r.session.GetTargetStatus() { if invoker.TargetMatched(s.Ref, targetRef) { - return kmapi.IsConditionFalse(s.Conditions, api_v1beta1.PreBackupHookExecutionSucceeded) + return condutil.IsConditionFalse(s.Conditions, api_v1beta1.PreBackupHookExecutionSucceeded) } } return false @@ -636,7 +637,7 @@ func (r *backupSessionReconciler) postBackupHookExecutedForTarget(targetInfo inv for _, s := range r.session.GetTargetStatus() { if invoker.TargetMatched(s.Ref, targetInfo.Target.Ref) { - if kmapi.HasCondition(s.Conditions, api_v1beta1.PostBackupHookExecutionSucceeded) { + if condutil.HasCondition(s.Conditions, api_v1beta1.PostBackupHookExecutionSucceeded) { return true } } @@ -650,7 +651,7 @@ func (r *backupSessionReconciler) shouldExecuteGlobalPostBackupHook() bool { if r.globalPreBackupHookFailed() { return false } - return !kmapi.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPostBackupHookSucceeded) + return !condutil.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPostBackupHookSucceeded) } return false } @@ -695,7 +696,7 @@ func (r *backupSessionReconciler) executeGlobalPostBackupHook() error { func (r *backupSessionReconciler) shouldExecuteGlobalPreBackupHook() bool { hook := r.invoker.GetGlobalHooks() if hook != nil && hook.PreBackup != nil { - return !kmapi.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded) + return !condutil.HasCondition(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded) } return false } @@ -809,7 +810,7 @@ func (r *backupSessionReconciler) isSessionCompleted() bool { return true } - if kmapi.IsConditionTrue(r.session.GetConditions(), api_v1beta1.DeadlineExceeded) { + if condutil.IsConditionTrue(r.session.GetConditions(), api_v1beta1.DeadlineExceeded) { return true } @@ -820,7 +821,7 @@ func (r *backupSessionReconciler) isSessionCompleted() bool { } func (r *backupSessionReconciler) globalPreBackupHookFailed() bool { - return kmapi.IsConditionFalse(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded) + return condutil.IsConditionFalse(r.session.GetConditions(), api_v1beta1.GlobalPreBackupHookSucceeded) } func (r *backupSessionReconciler) isBackupRunning() bool { @@ -913,7 +914,7 @@ func (r *backupSessionReconciler) getIncompleteBackupSessionForTarget(targetRef } func (r *backupSessionReconciler) backupMetricPushed() bool { - return kmapi.IsConditionTrue(r.session.GetConditions(), api_v1beta1.MetricsPushed) + return condutil.IsConditionTrue(r.session.GetConditions(), api_v1beta1.MetricsPushed) } func (r *backupSessionReconciler) sendBackupMetrics() error { diff --git a/pkg/controller/restore_session.go b/pkg/controller/restore_session.go index ef2ae28d5..ef2d777c8 100644 --- a/pkg/controller/restore_session.go +++ b/pkg/controller/restore_session.go @@ -39,6 +39,7 @@ import ( "k8s.io/klog/v2" kutil "kmodules.xyz/client-go" kmapi "kmodules.xyz/client-go/api/v1" + condutil "kmodules.xyz/client-go/conditions" core_util "kmodules.xyz/client-go/core/v1" "kmodules.xyz/client-go/meta" "kmodules.xyz/client-go/tools/queue" @@ -392,7 +393,7 @@ func (r *restoreInvokerReconciler) isSessionCompleted() bool { return true } - if kmapi.IsConditionTrue(r.invoker.GetStatus().Conditions, api_v1beta1.DeadlineExceeded) { + if condutil.IsConditionTrue(r.invoker.GetStatus().Conditions, api_v1beta1.DeadlineExceeded) { return true } @@ -403,7 +404,7 @@ func (r *restoreInvokerReconciler) isSessionCompleted() bool { } func (r *restoreInvokerReconciler) globalPreRestoreHookFailed() bool { - return kmapi.IsConditionFalse(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) + return condutil.IsConditionFalse(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) } func (r *restoreInvokerReconciler) shouldWaitForTargetPostRestoreHookExecution() bool { @@ -423,7 +424,7 @@ func (r *restoreInvokerReconciler) shouldWaitForTargetPostRestoreHookExecution() func (r *restoreInvokerReconciler) targetPreRestoreHookFailed(targetRef api_v1beta1.TargetRef) bool { for _, s := range r.invoker.GetStatus().TargetStatus { if invoker.TargetMatched(s.Ref, targetRef) { - return kmapi.IsConditionFalse(s.Conditions, api_v1beta1.PreRestoreHookExecutionSucceeded) + return condutil.IsConditionFalse(s.Conditions, api_v1beta1.PreRestoreHookExecutionSucceeded) } } return false @@ -437,7 +438,7 @@ func (r *restoreInvokerReconciler) postRestoreHookExecutedForTarget(targetInfo i for _, s := range status.TargetStatus { if invoker.TargetMatched(s.Ref, targetInfo.Target.Ref) { - if kmapi.HasCondition(s.Conditions, api_v1beta1.PostRestoreHookExecutionSucceeded) { + if condutil.HasCondition(s.Conditions, api_v1beta1.PostRestoreHookExecutionSucceeded) { return true } } @@ -451,7 +452,7 @@ func (r *restoreInvokerReconciler) shouldExecuteGlobalPostRestoreHook() bool { if r.globalPreRestoreHookFailed() { return false } - return !kmapi.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPostRestoreHookSucceeded) + return !condutil.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPostRestoreHookSucceeded) } return false } @@ -493,7 +494,7 @@ func (r *restoreInvokerReconciler) executeGlobalPostRestoreHook() error { func (r *restoreInvokerReconciler) shouldExecuteGlobalPreRestoreHook() bool { hook := r.invoker.GetGlobalHooks() if hook != nil && hook.PreRestore != nil { - return !kmapi.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) + return !condutil.HasCondition(r.invoker.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) } return false } @@ -524,7 +525,7 @@ func (r *restoreInvokerReconciler) targetRestoreInitiated(targetRef api_v1beta1. } for _, target := range status.TargetStatus { if invoker.TargetMatched(target.Ref, targetRef) { - return kmapi.HasCondition(target.Conditions, api_v1beta1.RestoreExecutorEnsured) || target.Phase == api_v1beta1.TargetRestoreRunning + return condutil.HasCondition(target.Conditions, api_v1beta1.RestoreExecutorEnsured) || target.Phase == api_v1beta1.TargetRestoreRunning } } return false @@ -557,7 +558,7 @@ func (r *restoreInvokerReconciler) setTargetRestorePending(targetRef api_v1beta1 } func restoreMetricsPushed(conditions []kmapi.Condition) bool { - return kmapi.IsConditionTrue(conditions, api_v1beta1.MetricsPushed) + return condutil.IsConditionTrue(conditions, api_v1beta1.MetricsPushed) } func (r *restoreInvokerReconciler) sendRestoreMetrics() error { diff --git a/pkg/restore/restore.go b/pkg/restore/restore.go index 850a2ba05..9f73974ca 100644 --- a/pkg/restore/restore.go +++ b/pkg/restore/restore.go @@ -40,6 +40,7 @@ import ( "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" + condutil "kmodules.xyz/client-go/conditions" "kmodules.xyz/client-go/meta" v1 "kmodules.xyz/offshoot-api/api/v1" ) @@ -254,7 +255,7 @@ func (opt *Options) isRestoredForThisHost(inv invoker.RestoreInvoker, targetInfo if phase == api_v1beta1.RestoreSucceeded || phase == api_v1beta1.RestoreFailed || phase == api_v1beta1.RestorePhaseUnknown || - kmapi.IsConditionFalse(inv.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) { + condutil.IsConditionFalse(inv.GetStatus().Conditions, api_v1beta1.GlobalPreRestoreHookSucceeded) { return true } for _, member := range inv.GetStatus().TargetStatus { diff --git a/pkg/status/status.go b/pkg/status/status.go index f103673d3..9345b623e 100644 --- a/pkg/status/status.go +++ b/pkg/status/status.go @@ -42,6 +42,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" + condutil "kmodules.xyz/client-go/conditions" ) type UpdateStatusOptions struct { @@ -311,7 +312,7 @@ func (o UpdateStatusOptions) applyRetentionPolicy(inv invoker.BackupInvoker, ses } func isRetentionPolicyApplied(session *invoker.BackupSessionHandler) bool { - return kmapi.HasCondition(session.GetConditions(), v1beta1.RetentionPolicyApplied) + return condutil.HasCondition(session.GetConditions(), v1beta1.RetentionPolicyApplied) } func (o UpdateStatusOptions) verifyRepositoryIntegrity(session *invoker.BackupSessionHandler) (*restic.RepositoryStats, error) { @@ -331,7 +332,7 @@ func (o UpdateStatusOptions) verifyRepositoryIntegrity(session *invoker.BackupSe } func isRepoIntegrityVerified(session *invoker.BackupSessionHandler) bool { - return kmapi.HasCondition(session.GetConditions(), v1beta1.RepositoryIntegrityVerified) + return condutil.HasCondition(session.GetConditions(), v1beta1.RepositoryIntegrityVerified) } 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 } func isRepositoryMetricSent(session *invoker.BackupSessionHandler) bool { - return kmapi.HasCondition(session.GetConditions(), v1beta1.RepositoryMetricsPushed) + return condutil.HasCondition(session.GetConditions(), v1beta1.RepositoryMetricsPushed) } func (o *UpdateStatusOptions) updateRepositoryStatus(inv invoker.BackupInvoker, session *invoker.BackupSessionHandler, repoStats restic.RepositoryStats) error { diff --git a/test/e2e/framework/conditions.go b/test/e2e/framework/conditions.go index d9577419e..7e1ec6567 100644 --- a/test/e2e/framework/conditions.go +++ b/test/e2e/framework/conditions.go @@ -22,32 +22,32 @@ import ( "stash.appscode.dev/apimachinery/apis/stash/v1beta1" . "github.com/onsi/gomega" - core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kmapi "kmodules.xyz/client-go/api/v1" + condutil "kmodules.xyz/client-go/conditions" ) func (f *Framework) EventuallyCondition(meta metav1.ObjectMeta, kind string, condType string) GomegaAsyncAssertion { return Eventually( - func() core.ConditionStatus { + func() metav1.ConditionStatus { var conditions []kmapi.Condition switch kind { case v1beta1.ResourceKindBackupConfiguration: bc, err := f.StashClient.StashV1beta1().BackupConfigurations(meta.Namespace).Get(context.TODO(), meta.Name, metav1.GetOptions{}) if err != nil { - return core.ConditionUnknown + return metav1.ConditionUnknown } conditions = bc.Status.Conditions case v1beta1.ResourceKindRestoreSession: rs, err := f.StashClient.StashV1beta1().RestoreSessions(meta.Namespace).Get(context.TODO(), meta.Name, metav1.GetOptions{}) if err != nil { - return core.ConditionUnknown + return metav1.ConditionUnknown } conditions = rs.Status.Conditions } - _, cond := kmapi.GetCondition(conditions, condType) + _, cond := condutil.GetCondition(conditions, condType) if cond == nil { - return core.ConditionUnknown + return metav1.ConditionUnknown } return cond.Status }, diff --git a/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go b/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go index a411d542c..0d7823b3c 100644 --- a/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go +++ b/vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go @@ -1,6 +1,7 @@ package jsonpatch import ( + "bytes" "encoding/json" "fmt" "reflect" @@ -64,6 +65,9 @@ func NewOperation(op, path string, value interface{}) Operation { // // An error will be returned if any of the two documents are invalid. func CreatePatch(a, b []byte) ([]Operation, error) { + if bytes.Equal(a, b) { + return []Operation{}, nil + } var aI interface{} var bI interface{} err := json.Unmarshal(a, &aI) diff --git a/vendor/gomodules.xyz/logs/lib.go b/vendor/gomodules.xyz/logs/lib.go index 3bec711b2..03a8214f2 100644 --- a/vendor/gomodules.xyz/logs/lib.go +++ b/vendor/gomodules.xyz/logs/lib.go @@ -37,9 +37,12 @@ const logFlushFreqFlagName = "log-flush-frequency" var logFlushFreq = pflag.Duration(logFlushFreqFlagName, 5*time.Second, "Maximum number of seconds between log flushes") -func init() { - _ = flag.Set("stderrthreshold", "INFO") -} +/* +panic: flag stderrthreshold set before being defined +*/ +// func init() { +// _ = flag.Set("stderrthreshold", "INFO") +// } // AddFlags registers this package's flags on arbitrary FlagSets, such that they point to the // same value as the global flags. diff --git a/vendor/kmodules.xyz/client-go/Makefile b/vendor/kmodules.xyz/client-go/Makefile index 441dd38e2..a54fa85d0 100644 --- a/vendor/kmodules.xyz/client-go/Makefile +++ b/vendor/kmodules.xyz/client-go/Makefile @@ -45,7 +45,7 @@ endif ### These variables should not need tweaking. ### -SRC_PKGS := admissionregistration api apiextensions apiregistration apps batch certificates client core discovery dynamic extensions meta networking openapi policy rbac storage tools +SRC_PKGS := admissionregistration api apiextensions apiregistration apps batch certificates client conditions core discovery dynamic extensions meta networking openapi policy rbac storage tools SRC_DIRS := $(SRC_PKGS) *.go DOCKER_PLATFORMS := linux/amd64 linux/arm linux/arm64 @@ -154,7 +154,7 @@ gen-crd-protos: --packages=-k8s.io/api/core/v1,kmodules.xyz/client-go/api/v1 .PHONY: gen-enum -gen-enum: +gen-enum: $(BUILD_DIRS) @docker run \ -i \ --rm \ diff --git a/vendor/kmodules.xyz/client-go/api/v1/conditions.go b/vendor/kmodules.xyz/client-go/api/v1/conditions.go index 332a460c6..148531c82 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/conditions.go +++ b/vendor/kmodules.xyz/client-go/api/v1/conditions.go @@ -1,5 +1,5 @@ /* -Copyright AppsCode Inc. and Contributors +Copyright 2020 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,190 +17,72 @@ limitations under the License. package v1 import ( - "fmt" - - core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// KEP: https://github.com/kubernetes/enhancements/blob/ced773ab59f0ff080888a912ab99474245623dad/keps/sig-api-machinery/1623-standardize-conditions/README.md +// ConditionSeverity expresses the severity of a Condition Type failing. +type ConditionSeverity string -// List of common condition types const ( - ConditionProgressing = "Progressing" - ConditionInitialized = "Initialized" - ConditionReady = "Ready" - ConditionAvailable = "Available" - ConditionFailed = "Failed" - - ConditionRequestApproved = "Approved" - ConditionRequestDenied = "Denied" + // ConditionSeverityError specifies that a condition with `Status=False` is an error. + ConditionSeverityError ConditionSeverity = "Error" + + // ConditionSeverityWarning specifies that a condition with `Status=False` is a warning. + ConditionSeverityWarning ConditionSeverity = "Warning" + + // ConditionSeverityInfo specifies that a condition with `Status=False` is informative. + ConditionSeverityInfo ConditionSeverity = "Info" + + // ConditionSeverityNone should apply only to util with `Status=True`. + ConditionSeverityNone ConditionSeverity = "" ) +// ConditionType is a valid value for Condition.Type. +type ConditionType string + +const ( + // ReadyCondition defines the Ready condition type that summarizes the operational state of an object. + ReadyCondition ConditionType = "Ready" +) + +// Condition defines an observation of a object operational state. type Condition struct { // Type of condition in CamelCase or in foo.example.com/CamelCase. - // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - // useful (see .node.status.conditions), the ability to deconflict is important. - // +required - Type string `json:"type" protobuf:"bytes,1,opt,name=type"` + // Many .condition.type values are consistent across resources like Available, but because arbitrary util + // can be useful (see .node.status.util), the ability to deconflict is important. + Type ConditionType `json:"type" protobuf:"bytes,4,opt,name=type,casttype=ConditionType"` + // Status of the condition, one of True, False, Unknown. - // +required - Status core.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` + Status metav1.ConditionStatus `json:"status" protobuf:"bytes,5,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` + // If set, this represents the .metadata.generation that the condition was set based upon. // For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date // with respect to the current state of the instance. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"` - // Last time the condition transitioned from one status to another. - // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - // +required - LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"` - // The reason for the condition's last transition in CamelCase. - // The specific API may choose whether or not this field is considered a guaranteed API. - // This field may not be empty. - // +required - Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"` - // A human readable message indicating details about the transition. - // This field may be empty. - // +required - Message string `json:"message" protobuf:"bytes,6,opt,name=message"` -} - -func NewCondition(reason string, message string, generation int64, conditionStatus ...bool) Condition { - cs := core.ConditionTrue - if len(conditionStatus) > 0 && !conditionStatus[0] { - cs = core.ConditionFalse - } - - return Condition{ - Type: reason, - Reason: reason, - Message: message, - Status: cs, - LastTransitionTime: metav1.Now(), - ObservedGeneration: generation, - } -} - -// HasCondition returns "true" if the desired condition provided in "condType" is present in the condition list. -// Otherwise, it returns "false". -func HasCondition(conditions []Condition, condType string) bool { - for i := range conditions { - if conditions[i].Type == condType { - return true - } - } - return false -} - -// GetCondition returns a pointer to the desired condition referred by "condType". Otherwise, it returns nil. -func GetCondition(conditions []Condition, condType string) (int, *Condition) { - for i := range conditions { - c := conditions[i] - if c.Type == condType { - return i, &c - } - } - return -1, nil -} -// SetCondition add/update the desired condition to the condition list. It does nothing if the condition is already in -// its desired state. -func SetCondition(conditions []Condition, newCondition Condition) []Condition { - idx, curCond := GetCondition(conditions, newCondition.Type) - // If the current condition is in its desired state, we have nothing to do. Just return the original condition list. - if curCond != nil && - curCond.Status == newCondition.Status && - curCond.Reason == newCondition.Reason && - curCond.Message == newCondition.Message && - curCond.ObservedGeneration == newCondition.ObservedGeneration { - return conditions - } - // The desired conditions is not in the condition list or is not in its desired state. - // Update it if present in the condition list, or append the new condition if it does not present. - newCondition.LastTransitionTime = metav1.Now() - if idx == -1 { - conditions = append(conditions, newCondition) - } else if newCondition.ObservedGeneration >= curCond.ObservedGeneration { - // only update if the new condition is based on observed generation at least as updated as the current condition - conditions[idx] = newCondition - } - return conditions -} - -// RemoveCondition remove a condition from the condition list referred by "condType" parameter. -func RemoveCondition(conditions []Condition, condType string) []Condition { - idx, _ := GetCondition(conditions, condType) - if idx == -1 { - // The desired condition is not present in the condition list. So, nothing to do. - return conditions - } - return append(conditions[:idx], conditions[idx+1:]...) -} - -// IsConditionTrue returns "true" if the desired condition is in true state. -// It returns "false" if the desired condition is not in "true" state or is not in the condition list. -func IsConditionTrue(conditions []Condition, condType string) bool { - for i := range conditions { - if conditions[i].Type == condType && conditions[i].Status == core.ConditionTrue { - return true - } - } - return false -} - -// IsConditionFalse returns "true" if the desired condition is in false state. -// It returns "false" if the desired condition is not in "false" state or is not in the condition list. -func IsConditionFalse(conditions []Condition, condType string) bool { - for i := range conditions { - if conditions[i].Type == condType && conditions[i].Status == core.ConditionFalse { - return true - } - } - return false -} - -// IsConditionUnknown returns "true" if the desired condition is in unknown state. -// It returns "false" if the desired condition is not in "unknown" state or is not in the condition list. -func IsConditionUnknown(conditions []Condition, condType string) bool { - for i := range conditions { - if conditions[i].Type == condType && conditions[i].Status == core.ConditionUnknown { - return true - } - } - return false -} - -// Status defines the set of statuses a resource can have. -// Based on kstatus: https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus -// +kubebuilder:validation:Enum=InProgress;Failed;Current;Terminating;NotFound;Unknown -type Status string + // Severity provides an explicit classification of Reason code, so the users or machines can immediately + // understand the current situation and act accordingly. + // The Severity field MUST be set only when Status=False. + // +optional + Severity ConditionSeverity `json:"severity,omitempty" protobuf:"bytes,6,opt,name=severity,casttype=ConditionSeverity"` -const ( - // The set of status conditions which can be assigned to resources. - InProgressStatus Status = "InProgress" - FailedStatus Status = "Failed" - CurrentStatus Status = "Current" - TerminatingStatus Status = "Terminating" - NotFoundStatus Status = "NotFound" - UnknownStatus Status = "Unknown" -) + // Last time the condition transitioned from one status to another. + // This should be when the underlying condition changed. If that is not known, then using the time when + // the API field changed is acceptable. + LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,7,opt,name=lastTransitionTime"` -var Statuses = []Status{InProgressStatus, FailedStatus, CurrentStatus, TerminatingStatus, UnknownStatus} + // The reason for the condition's last transition in CamelCase. + // The specific API may choose whether this field is considered a guaranteed API. + // This field may not be empty. + // +optional + Reason string `json:"reason,omitempty" protobuf:"bytes,8,opt,name=reason"` -// String returns the status as a string. -func (s Status) String() string { - return string(s) + // A human-readable message indicating details about the transition. + // This field may be empty. + // +optional + Message string `json:"message,omitempty" protobuf:"bytes,9,opt,name=message"` } -// StatusFromStringOrDie turns a string into a Status. Will panic if the provided string is -// not a valid status. -func StatusFromStringOrDie(text string) Status { - s := Status(text) - for _, r := range Statuses { - if s == r { - return s - } - } - panic(fmt.Errorf("string has invalid status: %s", s)) -} +// Conditions provide observations of the operational state of a object. +type Conditions []Condition diff --git a/vendor/kmodules.xyz/client-go/api/v1/generated.pb.go b/vendor/kmodules.xyz/client-go/api/v1/generated.pb.go index d369fcc48..afb785759 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/generated.pb.go +++ b/vendor/kmodules.xyz/client-go/api/v1/generated.pb.go @@ -28,8 +28,8 @@ import ( strings "strings" proto "github.com/gogo/protobuf/proto" - k8s_io_api_core_v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" + k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v11 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -540,113 +540,115 @@ func init() { } var fileDescriptor_af8e7a11c7a1ccd9 = []byte{ - // 1687 bytes of a gzipped FileDescriptorProto - 0x1f, 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xbb, 0xf2, 0xf9, 0x8b, 0x76, 0xe5, 0x93, 0x59, 0xdb, 0x78, - 0x36, 0x6b, 0x1b, 0xcf, 0x67, 0x6d, 0xe3, 0xf3, 0x59, 0xdb, 0xf8, 0xdb, 0xac, 0x6d, 0x7c, 0xfa, - 0xf7, 0x76, 0xe5, 0xa3, 0x5b, 0xaf, 0xfc, 0x17, 0xc8, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3d, - 0x8f, 0x54, 0x44, 0x22, 0x11, 0x00, 0x00, + // 1728 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcf, 0x6f, 0x23, 0x49, + 0x15, 0x76, 0xc7, 0x4e, 0xe2, 0x2e, 0x27, 0xe3, 0x49, 0xcd, 0xa0, 0x31, 0x23, 0xc6, 0x1d, 0xbc, + 0x62, 0x94, 0x01, 0xa6, 0x4d, 0x46, 0xb3, 0xb0, 0xac, 0x84, 0x20, 0xed, 0xec, 0x66, 0xbd, 0x9b, + 0x49, 0x42, 0x39, 0xc3, 0xae, 0x16, 0x04, 0xaa, 0x74, 0x3f, 0x3b, 0x45, 0xda, 0xdd, 0xad, 0xaa, + 0x6e, 0x83, 0xf7, 0xb4, 0x47, 0xb8, 0x2d, 0x37, 0x8e, 0x3b, 0x12, 0x7f, 0x02, 0x17, 0xfe, 0x02, + 0x46, 0x9c, 0x86, 0x0b, 0xda, 0x03, 0xb2, 0x18, 0x73, 0x45, 0x5c, 0x10, 0x12, 0xca, 0x09, 0x55, + 0xf5, 0x4f, 0x3b, 0xce, 0x24, 0x8b, 0x90, 0xf6, 0xe6, 0xfe, 0xde, 0xf7, 0xbe, 0xaa, 0xae, 0x7a, + 0xbf, 0xda, 0xe8, 0xe1, 0xd9, 0xd0, 0x77, 0x22, 0x17, 0x84, 0xf9, 0xcb, 0xf1, 0x47, 0x6d, 0xdb, + 0x65, 0xe0, 0x85,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, 0x14, 0x18, 0x72, 0x9f, 0x6a, 0xfc, 0xf6, 0x6c, + 0x90, 0x43, 0x73, 0xb6, 0xcf, 0xa3, 0x14, 0x24, 0xb9, 0x1d, 0x7f, 0x0f, 0xd5, 0x45, 0xc8, 0x01, + 0xc2, 0xfc, 0x7b, 0x68, 0x45, 0xb9, 0xa8, 0xd6, 0xdf, 0x9b, 0x35, 0x91, 0x79, 0xae, 0xfc, 0x3c, + 0x0b, 0x7c, 0x11, 0x52, 0xb7, 0xe3, 0x3b, 0xd9, 0xb7, 0x9c, 0xfa, 0x3c, 0x3b, 0xca, 0x61, 0x52, + 0xe4, 0xe0, 0x37, 0xd0, 0x9a, 0x00, 0xce, 0xa8, 0x7b, 0x10, 0x0d, 0x4f, 0x80, 0x27, 0xf3, 0x66, + 0x16, 0xa8, 0xbd, 0x82, 0x8d, 0xcc, 0x30, 0xad, 0xce, 0xf3, 0x97, 0xcd, 0xd2, 0x8b, 0x97, 0xcd, + 0xd2, 0x67, 0x2f, 0x9b, 0xa5, 0x8f, 0xa7, 0x4d, 0xed, 0xf9, 0xb4, 0xa9, 0xbd, 0x98, 0x36, 0xb5, + 0xcf, 0xa6, 0x4d, 0xed, 0x6f, 0xd3, 0xa6, 0xf6, 0xc9, 0xdf, 0x9b, 0xa5, 0x0f, 0xef, 0xbd, 0xf2, + 0x8f, 0x96, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x6b, 0xda, 0x16, 0x88, 0x11, 0x00, 0x00, } func (m *CertificatePrivateKey) Marshal() (dAtA []byte, err error) { @@ -873,12 +875,12 @@ func (m *Condition) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Message) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x4a i -= len(m.Reason) copy(dAtA[i:], m.Reason) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x42 { size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -888,20 +890,25 @@ func (m *Condition) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - i = encodeVarintGenerated(dAtA, i, uint64(m.ObservedGeneration)) + dAtA[i] = 0x3a + i -= len(m.Severity) + copy(dAtA[i:], m.Severity) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Severity))) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x32 i -= len(m.Status) copy(dAtA[i:], m.Status) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x2a i -= len(m.Type) copy(dAtA[i:], m.Type) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x22 + i = encodeVarintGenerated(dAtA, i, uint64(m.ObservedGeneration)) + i-- + dAtA[i] = 0x18 return len(dAtA) - i, nil } @@ -1583,11 +1590,13 @@ func (m *Condition) Size() (n int) { } var l int _ = l + n += 1 + sovGenerated(uint64(m.ObservedGeneration)) l = len(m.Type) n += 1 + l + sovGenerated(uint64(l)) l = len(m.Status) n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.ObservedGeneration)) + l = len(m.Severity) + n += 1 + l + sovGenerated(uint64(l)) l = m.LastTransitionTime.Size() n += 1 + l + sovGenerated(uint64(l)) l = len(m.Reason) @@ -1893,9 +1902,10 @@ func (this *Condition) String() string { return "nil" } s := strings.Join([]string{`&Condition{`, + `ObservedGeneration:` + fmt.Sprintf("%v", this.ObservedGeneration) + `,`, `Type:` + fmt.Sprintf("%v", this.Type) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `ObservedGeneration:` + fmt.Sprintf("%v", this.ObservedGeneration) + `,`, + `Severity:` + fmt.Sprintf("%v", this.Severity) + `,`, `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v11.Time", 1), `&`, ``, 1) + `,`, `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, `Message:` + fmt.Sprintf("%v", this.Message) + `,`, @@ -2790,7 +2800,26 @@ func (m *Condition) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Condition: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) + } + m.ObservedGeneration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ObservedGeneration |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } @@ -2820,9 +2849,9 @@ func (m *Condition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = string(dAtA[iNdEx:postIndex]) + m.Type = ConditionType(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } @@ -2852,13 +2881,13 @@ func (m *Condition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Status = k8s_io_api_core_v1.ConditionStatus(dAtA[iNdEx:postIndex]) + m.Status = k8s_io_apimachinery_pkg_apis_meta_v1.ConditionStatus(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Severity", wireType) } - m.ObservedGeneration = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2868,12 +2897,25 @@ func (m *Condition) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ObservedGeneration |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 4: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Severity = ConditionSeverity(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) } @@ -2906,7 +2948,7 @@ func (m *Condition) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) } @@ -2938,7 +2980,7 @@ func (m *Condition) Unmarshal(dAtA []byte) error { } m.Reason = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } diff --git a/vendor/kmodules.xyz/client-go/api/v1/generated.proto b/vendor/kmodules.xyz/client-go/api/v1/generated.proto index ff235455c..d8fc1a444 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/generated.proto +++ b/vendor/kmodules.xyz/client-go/api/v1/generated.proto @@ -97,16 +97,15 @@ message ClusterMetadata { optional string provider = 4; } +// Condition defines an observation of a object operational state. message Condition { // Type of condition in CamelCase or in foo.example.com/CamelCase. - // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - // useful (see .node.status.conditions), the ability to deconflict is important. - // +required - optional string type = 1; + // Many .condition.type values are consistent across resources like Available, but because arbitrary util + // can be useful (see .node.status.util), the ability to deconflict is important. + optional string type = 4; // Status of the condition, one of True, False, Unknown. - // +required - optional string status = 2; + optional string status = 5; // If set, this represents the .metadata.generation that the condition was set based upon. // For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date @@ -114,21 +113,27 @@ message Condition { // +optional optional int64 observedGeneration = 3; + // Severity provides an explicit classification of Reason code, so the users or machines can immediately + // understand the current situation and act accordingly. + // The Severity field MUST be set only when Status=False. + // +optional + optional string severity = 6; + // Last time the condition transitioned from one status to another. - // This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - // +required - optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 4; + // This should be when the underlying condition changed. If that is not known, then using the time when + // the API field changed is acceptable. + optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 7; // The reason for the condition's last transition in CamelCase. - // The specific API may choose whether or not this field is considered a guaranteed API. + // The specific API may choose whether this field is considered a guaranteed API. // This field may not be empty. - // +required - optional string reason = 5; + // +optional + optional string reason = 8; - // A human readable message indicating details about the transition. + // A human-readable message indicating details about the transition. // This field may be empty. - // +required - optional string message = 6; + // +optional + optional string message = 9; } // HealthCheckSpec defines attributes of the health check diff --git a/vendor/kmodules.xyz/client-go/api/v1/openapi_generated.go b/vendor/kmodules.xyz/client-go/api/v1/openapi_generated.go index daeb1a75a..e33f37561 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/openapi_generated.go +++ b/vendor/kmodules.xyz/client-go/api/v1/openapi_generated.go @@ -233,11 +233,12 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "Condition defines an observation of a object operational state.", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "type": { SchemaProps: spec.SchemaProps{ - Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important.", + Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary util can be useful (see .node.status.util), the ability to deconflict is important.", Default: "", Type: []string{"string"}, Format: "", @@ -258,31 +259,36 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) Format: "int64", }, }, + "severity": { + SchemaProps: spec.SchemaProps{ + Description: "Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False.", + Type: []string{"string"}, + Format: "", + }, + }, "lastTransitionTime": { SchemaProps: spec.SchemaProps{ - Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", Default: map[string]interface{}{}, Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, "reason": { SchemaProps: spec.SchemaProps{ - Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty.", - Default: "", + Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether this field is considered a guaranteed API. This field may not be empty.", Type: []string{"string"}, Format: "", }, }, "message": { SchemaProps: spec.SchemaProps{ - Description: "A human readable message indicating details about the transition. This field may be empty.", - Default: "", + Description: "A human-readable message indicating details about the transition. This field may be empty.", Type: []string{"string"}, Format: "", }, }, }, - Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + Required: []string{"type", "status", "lastTransitionTime"}, }, }, Dependencies: []string{ diff --git a/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go b/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go index dd2040bf1..85fa8084f 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go +++ b/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go @@ -136,6 +136,28 @@ func (in *Condition) DeepCopy() *Condition { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Conditions) DeepCopyInto(out *Conditions) { + { + in := &in + *out = make(Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Conditions. +func (in Conditions) DeepCopy() Conditions { + if in == nil { + return nil + } + out := new(Conditions) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HealthCheckSpec) DeepCopyInto(out *HealthCheckSpec) { *out = *in diff --git a/vendor/kmodules.xyz/client-go/apiextensions/kubernetes.go b/vendor/kmodules.xyz/client-go/apiextensions/kubernetes.go index 0316e88a2..a628ca661 100644 --- a/vendor/kmodules.xyz/client-go/apiextensions/kubernetes.go +++ b/vendor/kmodules.xyz/client-go/apiextensions/kubernetes.go @@ -58,7 +58,7 @@ func RegisterCRDs(client crd_cs.Interface, crds []*CustomResourceDefinition) err }, metav1.UpdateOptions{}, ) - if err != nil { + if err != nil && !kerr.IsAlreadyExists(err) { return err } } diff --git a/vendor/kmodules.xyz/client-go/conditions/README.md b/vendor/kmodules.xyz/client-go/conditions/README.md new file mode 100644 index 000000000..bbbd367ec --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/README.md @@ -0,0 +1,3 @@ +# conditions + +The code in this package has been copied from https://github.com/kube-bind/kube-bind/tree/main/pkg/apis/third_party/conditions diff --git a/vendor/kmodules.xyz/client-go/conditions/getter.go b/vendor/kmodules.xyz/client-go/conditions/getter.go new file mode 100644 index 000000000..86649a6d5 --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/getter.go @@ -0,0 +1,259 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + kmapi "kmodules.xyz/client-go/api/v1" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Getter interface defines methods that an object should implement in order to +// use the conditions package for getting conditions. +type Getter interface { + metav1.Object + runtime.Object + + // GetConditions returns the list of conditions for an object. + GetConditions() kmapi.Conditions +} + +// Get returns the condition with the given type, if the condition does not exist, +// it returns nil. +func Get(from Getter, t kmapi.ConditionType) *kmapi.Condition { + conditions := from.GetConditions() + if conditions == nil { + return nil + } + + for _, condition := range conditions { + if condition.Type == t { + return &condition + } + } + return nil +} + +// Has returns true if a condition with the given type exists. +func Has(from Getter, t kmapi.ConditionType) bool { + return Get(from, t) != nil +} + +// IsTrue is true if the condition with the given type is True, otherwise it returns false +// if the condition is not True or if the condition does not exist (is nil). +func IsTrue(from Getter, t kmapi.ConditionType) bool { + if c := Get(from, t); c != nil { + return c.Status == metav1.ConditionTrue + } + return false +} + +// IsFalse is true if the condition with the given type is False, otherwise it returns false +// if the condition is not False or if the condition does not exist (is nil). +func IsFalse(from Getter, t kmapi.ConditionType) bool { + if c := Get(from, t); c != nil { + return c.Status == metav1.ConditionFalse + } + return false +} + +// IsUnknown is true if the condition with the given type is Unknown or if the condition +// does not exist (is nil). +func IsUnknown(from Getter, t kmapi.ConditionType) bool { + if c := Get(from, t); c != nil { + return c.Status == metav1.ConditionUnknown + } + return true +} + +// GetReason returns a nil safe string of Reason for the condition with the given type. +func GetReason(from Getter, t kmapi.ConditionType) string { + if c := Get(from, t); c != nil { + return c.Reason + } + return "" +} + +// GetMessage returns a nil safe string of Message. +func GetMessage(from Getter, t kmapi.ConditionType) string { + if c := Get(from, t); c != nil { + return c.Message + } + return "" +} + +// GetSeverity returns the condition Severity or nil if the condition +// does not exist (is nil). +func GetSeverity(from Getter, t kmapi.ConditionType) *kmapi.ConditionSeverity { + if c := Get(from, t); c != nil { + return &c.Severity + } + return nil +} + +// GetLastTransitionTime returns the condition Severity or nil if the condition +// does not exist (is nil). +func GetLastTransitionTime(from Getter, t kmapi.ConditionType) *metav1.Time { + if c := Get(from, t); c != nil { + return &c.LastTransitionTime + } + return nil +} + +// summary returns a Ready condition with the summary of all the conditions existing +// on an object. If the object does not have other conditions, no summary condition is generated. +func summary(from Getter, options ...MergeOption) *kmapi.Condition { + conditions := from.GetConditions() + + mergeOpt := &mergeOptions{} + for _, o := range options { + o(mergeOpt) + } + + // Identifies the conditions in scope for the Summary by taking all the existing conditions except Ready, + // or, if a list of conditions types is specified, only the conditions the condition in that list. + conditionsInScope := make([]localizedCondition, 0, len(conditions)) + for i := range conditions { + c := conditions[i] + if c.Type == kmapi.ReadyCondition { + continue + } + + if mergeOpt.conditionTypes != nil { + found := false + for _, t := range mergeOpt.conditionTypes { + if c.Type == t { + found = true + break + } + } + if !found { + continue + } + } + + conditionsInScope = append(conditionsInScope, localizedCondition{ + Condition: &c, + Getter: from, + }) + } + + // If it is required to add a step counter only if a subset of condition exists, check if the conditions + // in scope are included in this subset or not. + if mergeOpt.addStepCounterIfOnlyConditionTypes != nil { + for _, c := range conditionsInScope { + found := false + for _, t := range mergeOpt.addStepCounterIfOnlyConditionTypes { + if c.Type == t { + found = true + break + } + } + if !found { + mergeOpt.addStepCounter = false + break + } + } + } + + // If it is required to add a step counter, determine the total number of conditions defaulting + // to the selected conditions or, if defined, to the total number of conditions type to be considered. + if mergeOpt.addStepCounter { + mergeOpt.stepCounter = len(conditionsInScope) + if mergeOpt.conditionTypes != nil { + mergeOpt.stepCounter = len(mergeOpt.conditionTypes) + } + if mergeOpt.addStepCounterIfOnlyConditionTypes != nil { + mergeOpt.stepCounter = len(mergeOpt.addStepCounterIfOnlyConditionTypes) + } + } + + return merge(conditionsInScope, kmapi.ReadyCondition, mergeOpt) +} + +// mirrorOptions allows to set options for the mirror operation. +type mirrorOptions struct { + fallbackTo *bool + fallbackReason string + fallbackSeverity kmapi.ConditionSeverity + fallbackMessage string +} + +// MirrorOptions defines an option for mirroring conditions. +type MirrorOptions func(*mirrorOptions) + +// WithFallbackValue specify a fallback value to use in case the mirrored condition does not exist; +// in case the fallbackValue is false, given values for reason, severity and message will be used. +func WithFallbackValue(fallbackValue bool, reason string, severity kmapi.ConditionSeverity, message string) MirrorOptions { + return func(c *mirrorOptions) { + c.fallbackTo = &fallbackValue + c.fallbackReason = reason + c.fallbackSeverity = severity + c.fallbackMessage = message + } +} + +// mirror mirrors the Ready condition from a dependent object into the target condition; +// if the Ready condition does not exist in the source object, no target conditions is generated. +func mirror(from Getter, targetCondition kmapi.ConditionType, options ...MirrorOptions) *kmapi.Condition { + mirrorOpt := &mirrorOptions{} + for _, o := range options { + o(mirrorOpt) + } + + condition := Get(from, kmapi.ReadyCondition) + + if mirrorOpt.fallbackTo != nil && condition == nil { + switch *mirrorOpt.fallbackTo { + case true: + condition = TrueCondition(targetCondition) + case false: + condition = FalseCondition(targetCondition, mirrorOpt.fallbackReason, mirrorOpt.fallbackSeverity, mirrorOpt.fallbackMessage) + } + } + + if condition != nil { + condition.Type = targetCondition + } + + return condition +} + +// Aggregates all the Ready condition from a list of dependent objects into the target object; +// if the Ready condition does not exist in one of the source object, the object is excluded from +// the aggregation; if none of the source object have ready condition, no target conditions is generated. +func aggregate(from []Getter, targetCondition kmapi.ConditionType, options ...MergeOption) *kmapi.Condition { + conditionsInScope := make([]localizedCondition, 0, len(from)) + for i := range from { + condition := Get(from[i], kmapi.ReadyCondition) + + conditionsInScope = append(conditionsInScope, localizedCondition{ + Condition: condition, + Getter: from[i], + }) + } + + mergeOpt := &mergeOptions{ + addStepCounter: true, + stepCounter: len(from), + } + for _, o := range options { + o(mergeOpt) + } + return merge(conditionsInScope, targetCondition, mergeOpt) +} diff --git a/vendor/kmodules.xyz/client-go/conditions/matcher.go b/vendor/kmodules.xyz/client-go/conditions/matcher.go new file mode 100644 index 000000000..f79d2b413 --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/matcher.go @@ -0,0 +1,103 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + "fmt" + + kmapi "kmodules.xyz/client-go/api/v1" + + "github.com/onsi/gomega" + "github.com/onsi/gomega/types" +) + +// MatchConditions returns a custom matcher to check equality of conditionsapi.Conditions. +func MatchConditions(expected kmapi.Conditions) types.GomegaMatcher { + return &matchConditions{ + expected: expected, + } +} + +type matchConditions struct { + expected kmapi.Conditions +} + +func (m matchConditions) Match(actual interface{}) (success bool, err error) { + elems := []interface{}{} + for _, condition := range m.expected { + elems = append(elems, MatchCondition(condition)) + } + + return gomega.ConsistOf(elems).Match(actual) +} + +func (m matchConditions) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("expected\n\t%#v\nto match\n\t%#v\n", actual, m.expected) +} + +func (m matchConditions) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("expected\n\t%#v\nto not match\n\t%#v\n", actual, m.expected) +} + +// MatchCondition returns a custom matcher to check equality of conditionsapi.Condition. +func MatchCondition(expected kmapi.Condition) types.GomegaMatcher { + return &matchCondition{ + expected: expected, + } +} + +type matchCondition struct { + expected kmapi.Condition +} + +func (m matchCondition) Match(actual interface{}) (success bool, err error) { + actualCondition, ok := actual.(kmapi.Condition) + if !ok { + return false, fmt.Errorf("actual should be of type Condition") + } + + ok, err = gomega.Equal(m.expected.Type).Match(actualCondition.Type) + if !ok { + return ok, err + } + ok, err = gomega.Equal(m.expected.Status).Match(actualCondition.Status) + if !ok { + return ok, err + } + ok, err = gomega.Equal(m.expected.Severity).Match(actualCondition.Severity) + if !ok { + return ok, err + } + ok, err = gomega.Equal(m.expected.Reason).Match(actualCondition.Reason) + if !ok { + return ok, err + } + ok, err = gomega.Equal(m.expected.Message).Match(actualCondition.Message) + if !ok { + return ok, err + } + + return ok, err +} + +func (m matchCondition) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("expected\n\t%#v\nto match\n\t%#v\n", actual, m.expected) +} + +func (m matchCondition) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("expected\n\t%#v\nto not match\n\t%#v\n", actual, m.expected) +} diff --git a/vendor/kmodules.xyz/client-go/conditions/matchers.go b/vendor/kmodules.xyz/client-go/conditions/matchers.go new file mode 100644 index 000000000..508932205 --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/matchers.go @@ -0,0 +1,54 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + "errors" + + kmapi "kmodules.xyz/client-go/api/v1" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/types" +) + +// HaveSameStateOf matches a condition to have the same state of another. +func HaveSameStateOf(expected *kmapi.Condition) types.GomegaMatcher { + return &conditionMatcher{ + Expected: expected, + } +} + +type conditionMatcher struct { + Expected *kmapi.Condition +} + +func (matcher *conditionMatcher) Match(actual interface{}) (success bool, err error) { + actualCondition, ok := actual.(*kmapi.Condition) + if !ok { + return false, errors.New("value should be a condition") + } + + return hasSameState(actualCondition, matcher.Expected), nil +} + +func (matcher *conditionMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to have the same state of", matcher.Expected) +} + +func (matcher *conditionMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to have the same state of", matcher.Expected) +} diff --git a/vendor/kmodules.xyz/client-go/conditions/merge.go b/vendor/kmodules.xyz/client-go/conditions/merge.go new file mode 100644 index 000000000..44290e85f --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/merge.go @@ -0,0 +1,200 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + "sort" + + kmapi "kmodules.xyz/client-go/api/v1" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// localizedCondition defines a condition with the information of the object the util +// was originated from. +type localizedCondition struct { + *kmapi.Condition + Getter +} + +// merge a list of condition into a single one. +// This operation is designed to ensure visibility of the most relevant util for defining the +// operational state of a component. E.g. If there is one error in the condition list, this one takes +// priority over the other util, and it should be reflected in the target condition. +// +// More specifically: +// 1. Conditions are grouped by status, severity +// 2. The resulting condition groups are sorted according to the following priority: +// - P0 - Status=False, Severity=Error +// - P1 - Status=False, Severity=Warning +// - P2 - Status=False, Severity=Info +// - P3 - Status=True +// - P4 - Status=Unknown +// +// 3. The group with the highest priority is used to determine status, severity and other info of the target condition. +// +// Please note that the last operation includes also the task of computing the Reason and the Message for the target +// condition; in order to complete such task some trade-off should be made, because there is no a golden rule +// for summarizing many Reason/Message into single Reason/Message. +// mergeOptions allows the user to adapt this process to the specific needs by exposing a set of merge strategies. +func merge(conditions []localizedCondition, targetCondition kmapi.ConditionType, options *mergeOptions) *kmapi.Condition { + g := getConditionGroups(conditions) + if len(g) == 0 { + return nil + } + + if g.TopGroup().status == metav1.ConditionTrue { + return TrueCondition(targetCondition) + } + + targetReason := getReason(g, options) + targetMessage := getMessage(g, options) + + if g.TopGroup().status == metav1.ConditionFalse { + return FalseCondition(targetCondition, targetReason, g.TopGroup().severity, targetMessage) + } + return UnknownCondition(targetCondition, targetReason, targetMessage) +} + +// getConditionGroups groups a list of conditions according to status, severity values. +// Additionally, the resulting groups are sorted by mergePriority. +func getConditionGroups(conditions []localizedCondition) conditionGroups { + groups := conditionGroups{} + + for _, condition := range conditions { + if condition.Condition == nil { + continue + } + + added := false + for i := range groups { + if groups[i].status == condition.Status && groups[i].severity == condition.Severity { + groups[i].conditions = append(groups[i].conditions, condition) + added = true + break + } + } + if !added { + groups = append(groups, conditionGroup{ + conditions: []localizedCondition{condition}, + status: condition.Status, + severity: condition.Severity, + }) + } + } + + // sort groups by priority + sort.Sort(groups) + + // sorts conditions in the TopGroup, so we ensure predictable result for merge strategies. + // condition are sorted using the same lexicographic order used by Set; in case two conditions + // have the same type, condition are sorted using according to the alphabetical order of the source object name. + if len(groups) > 0 { + sort.Slice(groups[0].conditions, func(i, j int) bool { + a := groups[0].conditions[i] + b := groups[0].conditions[j] + if a.Type != b.Type { + return lexicographicLess(a.Condition, b.Condition) + } + return a.GetName() < b.GetName() + }) + } + + return groups +} + +// conditionGroups provides supports for grouping a list of conditions to be +// merged into a single condition. ConditionGroups can be sorted by mergePriority. +type conditionGroups []conditionGroup + +func (g conditionGroups) Len() int { + return len(g) +} + +func (g conditionGroups) Less(i, j int) bool { + return g[i].mergePriority() < g[j].mergePriority() +} + +func (g conditionGroups) Swap(i, j int) { + g[i], g[j] = g[j], g[i] +} + +// TopGroup returns the condition group with the highest mergePriority. +func (g conditionGroups) TopGroup() *conditionGroup { + if len(g) == 0 { + return nil + } + return &g[0] +} + +// TrueGroup returns the condition group with status True, if any. +func (g conditionGroups) TrueGroup() *conditionGroup { + return g.getByStatusAndSeverity(metav1.ConditionTrue, kmapi.ConditionSeverityNone) +} + +// ErrorGroup returns the condition group with status False and severity Error, if any. +func (g conditionGroups) ErrorGroup() *conditionGroup { + return g.getByStatusAndSeverity(metav1.ConditionFalse, kmapi.ConditionSeverityError) +} + +// WarningGroup returns the condition group with status False and severity Warning, if any. +func (g conditionGroups) WarningGroup() *conditionGroup { + return g.getByStatusAndSeverity(metav1.ConditionFalse, kmapi.ConditionSeverityWarning) +} + +func (g conditionGroups) getByStatusAndSeverity(status metav1.ConditionStatus, severity kmapi.ConditionSeverity) *conditionGroup { + if len(g) == 0 { + return nil + } + for _, group := range g { + if group.status == status && group.severity == severity { + return &group + } + } + return nil +} + +// conditionGroup define a group of conditions with the same status and severity, +// and thus with the same priority when merging into a Ready condition. +type conditionGroup struct { + status metav1.ConditionStatus + severity kmapi.ConditionSeverity + conditions []localizedCondition +} + +// mergePriority provides a priority value for the status and severity tuple that identifies this +// condition group. The mergePriority value allows an easier sorting of conditions groups. +func (g conditionGroup) mergePriority() int { + switch g.status { + case metav1.ConditionFalse: + switch g.severity { + case kmapi.ConditionSeverityError: + return 0 + case kmapi.ConditionSeverityWarning: + return 1 + case kmapi.ConditionSeverityInfo: + return 2 + } + case metav1.ConditionTrue: + return 3 + case metav1.ConditionUnknown: + return 4 + } + + // this should never happen + return 99 +} diff --git a/vendor/kmodules.xyz/client-go/conditions/merge_strategies.go b/vendor/kmodules.xyz/client-go/conditions/merge_strategies.go new file mode 100644 index 000000000..7590fa234 --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/merge_strategies.go @@ -0,0 +1,169 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + "fmt" + "strings" + + kmapi "kmodules.xyz/client-go/api/v1" +) + +// mergeOptions allows to set strategies for merging a set of conditions into a single condition, +// and more specifically for computing the target Reason and the target Message. +type mergeOptions struct { + conditionTypes []kmapi.ConditionType + addSourceRef bool + addStepCounter bool + addStepCounterIfOnlyConditionTypes []kmapi.ConditionType + stepCounter int +} + +// MergeOption defines an option for computing a summary of conditions. +type MergeOption func(*mergeOptions) + +// WithConditions instructs merge about the condition types to consider when doing a merge operation; +// if this option is not specified, all the conditions (excepts Ready) will be considered. This is required, +// so we can provide some guarantees about the semantic of the target condition without worrying about +// side effects if someone or something adds custom conditions to the objects. +// +// NOTE: The order of conditions types defines the priority for determining the Reason and Message for the +// target condition. +// IMPORTANT: This options works only while generating the Summary condition. +func WithConditions(t ...kmapi.ConditionType) MergeOption { + return func(c *mergeOptions) { + c.conditionTypes = t + } +} + +// WithStepCounter instructs merge to add a "x of y completed" string to the message, +// where x is the number of conditions with Status=true and y is the number of conditions in scope. +func WithStepCounter() MergeOption { + return func(c *mergeOptions) { + c.addStepCounter = true + } +} + +// WithStepCounterIf adds a step counter if the value is true. +// This can be used e.g. to add a step counter only if the object is not being deleted. +// +// IMPORTANT: This options works only while generating the Summary condition. +func WithStepCounterIf(value bool) MergeOption { + return func(c *mergeOptions) { + c.addStepCounter = value + } +} + +// WithStepCounterIfOnly ensure a step counter is show only if a subset of condition exists. +// This applies for example on Machines, where we want to use +// the step counter notation while provisioning the machine, but then we want to move away from this notation +// as soon as the machine is provisioned and e.g. a Machine health check condition is generated +// +// IMPORTANT: This options requires WithStepCounter or WithStepCounterIf to be set. +// IMPORTANT: This options works only while generating the Summary condition. +func WithStepCounterIfOnly(t ...kmapi.ConditionType) MergeOption { + return func(c *mergeOptions) { + c.addStepCounterIfOnlyConditionTypes = t + } +} + +// AddSourceRef instructs merge to add info about the originating object to the target Reason. +func AddSourceRef() MergeOption { + return func(c *mergeOptions) { + c.addSourceRef = true + } +} + +// getReason returns the reason to be applied to the condition resulting by merging a set of condition groups. +// The reason is computed according to the given mergeOptions. +func getReason(groups conditionGroups, options *mergeOptions) string { + return getFirstReason(groups, options.conditionTypes, options.addSourceRef) +} + +// getFirstReason returns the first reason from the ordered list of conditions in the top group. +// If required, the reason gets localized with the source object reference. +func getFirstReason(g conditionGroups, order []kmapi.ConditionType, addSourceRef bool) string { + if condition := getFirstCondition(g, order); condition != nil { + reason := condition.Reason + if addSourceRef { + return localizeReason(reason, condition.Getter) + } + return reason + } + return "" +} + +// localizeReason adds info about the originating object to the target Reason. +func localizeReason(reason string, from Getter) string { + if strings.Contains(reason, "@") { + return reason + } + return fmt.Sprintf("%s @ %s/%s", reason, from.GetObjectKind().GroupVersionKind().Kind, from.GetName()) +} + +// getMessage returns the message to be applied to the condition resulting by merging a set of condition groups. +// The message is computed according to the given mergeOptions, but in case of errors or warning a +// summary of existing errors is automatically added. +func getMessage(groups conditionGroups, options *mergeOptions) string { + if options.addStepCounter { + return getStepCounterMessage(groups, options.stepCounter) + } + + return getFirstMessage(groups, options.conditionTypes) +} + +// getStepCounterMessage returns a message "x of y completed", where x is the number of conditions +// with Status=true and y is the number passed to this method. +func getStepCounterMessage(groups conditionGroups, to int) string { + ct := 0 + if trueGroup := groups.TrueGroup(); trueGroup != nil { + ct = len(trueGroup.conditions) + } + return fmt.Sprintf("%d of %d completed", ct, to) +} + +// getFirstMessage returns the message from the ordered list of conditions in the top group. +func getFirstMessage(groups conditionGroups, order []kmapi.ConditionType) string { + if condition := getFirstCondition(groups, order); condition != nil { + return condition.Message + } + return "" +} + +// getFirstCondition returns a first condition from the ordered list of conditions in the top group. +func getFirstCondition(g conditionGroups, priority []kmapi.ConditionType) *localizedCondition { + topGroup := g.TopGroup() + if topGroup == nil { + return nil + } + + switch len(topGroup.conditions) { + case 0: + return nil + case 1: + return &topGroup.conditions[0] + default: + for _, p := range priority { + for _, c := range topGroup.conditions { + if c.Type == p { + return &c + } + } + } + return &topGroup.conditions[0] + } +} diff --git a/vendor/kmodules.xyz/client-go/conditions/meta.go b/vendor/kmodules.xyz/client-go/conditions/meta.go new file mode 100644 index 000000000..a3894686a --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/meta.go @@ -0,0 +1,178 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + "fmt" + + kmapi "kmodules.xyz/client-go/api/v1" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// KEP: https://github.com/kubernetes/enhancements/blob/ced773ab59f0ff080888a912ab99474245623dad/keps/sig-api-machinery/1623-standardize-conditions/README.md + +// List of common condition types +const ( + ConditionProgressing = "Progressing" + ConditionInitialized = "Initialized" + ConditionReady = "Ready" + ConditionAvailable = "Available" + ConditionFailed = "Failed" + + ConditionRequestApproved = "Approved" + ConditionRequestDenied = "Denied" +) + +func NewCondition(reason string, message string, generation int64, conditionStatus ...bool) kmapi.Condition { + cs := metav1.ConditionTrue + if len(conditionStatus) > 0 && !conditionStatus[0] { + cs = metav1.ConditionFalse + } + + return kmapi.Condition{ + Type: kmapi.ConditionType(reason), + Reason: reason, + Message: message, + Status: cs, + LastTransitionTime: metav1.Now(), + ObservedGeneration: generation, + } +} + +// HasCondition returns "true" if the desired condition provided in "condType" is present in the condition list. +// Otherwise, it returns "false". +func HasCondition(conditions []kmapi.Condition, condType string) bool { + for i := range conditions { + if conditions[i].Type == kmapi.ConditionType(condType) { + return true + } + } + return false +} + +// GetCondition returns a pointer to the desired condition referred by "condType". Otherwise, it returns nil. +func GetCondition(conditions []kmapi.Condition, condType string) (int, *kmapi.Condition) { + for i := range conditions { + c := conditions[i] + if c.Type == kmapi.ConditionType(condType) { + return i, &c + } + } + return -1, nil +} + +// SetCondition add/update the desired condition to the condition list. It does nothing if the condition is already in +// its desired state. +func SetCondition(conditions []kmapi.Condition, newCondition kmapi.Condition) []kmapi.Condition { + idx, curCond := GetCondition(conditions, string(newCondition.Type)) + // If the current condition is in its desired state, we have nothing to do. Just return the original condition list. + if curCond != nil && + curCond.Status == newCondition.Status && + curCond.Reason == newCondition.Reason && + curCond.Message == newCondition.Message && + curCond.ObservedGeneration == newCondition.ObservedGeneration { + return conditions + } + // The desired conditions is not in the condition list or is not in its desired state. + // Update it if present in the condition list, or append the new condition if it does not present. + newCondition.LastTransitionTime = metav1.Now() + if idx == -1 { + conditions = append(conditions, newCondition) + } else if newCondition.ObservedGeneration >= curCond.ObservedGeneration { + // only update if the new condition is based on observed generation at least as updated as the current condition + conditions[idx] = newCondition + } + return conditions +} + +// RemoveCondition remove a condition from the condition list referred by "condType" parameter. +func RemoveCondition(conditions []kmapi.Condition, condType string) []kmapi.Condition { + idx, _ := GetCondition(conditions, condType) + if idx == -1 { + // The desired condition is not present in the condition list. So, nothing to do. + return conditions + } + return append(conditions[:idx], conditions[idx+1:]...) +} + +// IsConditionTrue returns "true" if the desired condition is in true state. +// It returns "false" if the desired condition is not in "true" state or is not in the condition list. +func IsConditionTrue(conditions []kmapi.Condition, condType string) bool { + for i := range conditions { + if conditions[i].Type == kmapi.ConditionType(condType) && conditions[i].Status == metav1.ConditionTrue { + return true + } + } + return false +} + +// IsConditionFalse returns "true" if the desired condition is in false state. +// It returns "false" if the desired condition is not in "false" state or is not in the condition list. +func IsConditionFalse(conditions []kmapi.Condition, condType string) bool { + for i := range conditions { + if conditions[i].Type == kmapi.ConditionType(condType) && conditions[i].Status == metav1.ConditionFalse { + return true + } + } + return false +} + +// IsConditionUnknown returns "true" if the desired condition is in unknown state. +// It returns "false" if the desired condition is not in "unknown" state or is not in the condition list. +func IsConditionUnknown(conditions []kmapi.Condition, condType string) bool { + for i := range conditions { + if conditions[i].Type == kmapi.ConditionType(condType) && conditions[i].Status == metav1.ConditionUnknown { + return true + } + } + return false +} + +// Status defines the set of statuses a resource can have. +// Based on kstatus: https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus +// +kubebuilder:validation:Enum=InProgress;Failed;Current;Terminating;NotFound;Unknown +type Status string + +const ( + // The set of status conditions which can be assigned to resources. + InProgressStatus Status = "InProgress" + FailedStatus Status = "Failed" + CurrentStatus Status = "Current" + TerminatingStatus Status = "Terminating" + NotFoundStatus Status = "NotFound" + UnknownStatus Status = "Unknown" +) + +var Statuses = []Status{InProgressStatus, FailedStatus, CurrentStatus, TerminatingStatus, UnknownStatus} + +// String returns the status as a string. +func (s Status) String() string { + return string(s) +} + +// StatusFromStringOrDie turns a string into a Status. Will panic if the provided string is +// not a valid status. +func StatusFromStringOrDie(text string) Status { + s := Status(text) + for _, r := range Statuses { + if s == r { + return s + } + } + panic(fmt.Errorf("string has invalid status: %s", s)) +} diff --git a/vendor/kmodules.xyz/client-go/conditions/patch.go b/vendor/kmodules.xyz/client-go/conditions/patch.go new file mode 100644 index 000000000..5b55e3920 --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/patch.go @@ -0,0 +1,201 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + "fmt" + "reflect" + + kmapi "kmodules.xyz/client-go/api/v1" + + "github.com/google/go-cmp/cmp" +) + +// Patch defines a list of operations to change a list of conditions into another. +type Patch []PatchOperation + +// PatchOperation define an operation that changes a single condition. +type PatchOperation struct { + Before *kmapi.Condition + After *kmapi.Condition + Op PatchOperationType +} + +// PatchOperationType defines patch operation types. +type PatchOperationType string + +const ( + // AddConditionPatch defines an add condition patch operation. + AddConditionPatch PatchOperationType = "Add" + + // ChangeConditionPatch defines a change condition patch operation. + ChangeConditionPatch PatchOperationType = "Change" + + // RemoveConditionPatch defines a remove condition patch operation. + RemoveConditionPatch PatchOperationType = "Remove" +) + +// NewPatch returns the list of Patch required to align source conditions to after conditions. +func NewPatch(before Getter, after Getter) Patch { + var patch Patch + + // Identify AddCondition and ModifyCondition changes. + targetConditions := after.GetConditions() + for i := range targetConditions { + targetCondition := targetConditions[i] + currentCondition := Get(before, targetCondition.Type) + if currentCondition == nil { + patch = append(patch, PatchOperation{Op: AddConditionPatch, After: &targetCondition}) + continue + } + + if !reflect.DeepEqual(&targetCondition, currentCondition) { + patch = append(patch, PatchOperation{Op: ChangeConditionPatch, After: &targetCondition, Before: currentCondition}) + } + } + + // Identify RemoveCondition changes. + baseConditions := before.GetConditions() + for i := range baseConditions { + baseCondition := baseConditions[i] + targetCondition := Get(after, baseCondition.Type) + if targetCondition == nil { + patch = append(patch, PatchOperation{Op: RemoveConditionPatch, Before: &baseCondition}) + } + } + return patch +} + +// applyOptions allows to set strategies for patch apply. +type applyOptions struct { + ownedConditions []kmapi.ConditionType + forceOverwrite bool +} + +func (o *applyOptions) isOwnedCondition(t kmapi.ConditionType) bool { + for _, i := range o.ownedConditions { + if i == t { + return true + } + } + return false +} + +// ApplyOption defines an option for applying a condition patch. +type ApplyOption func(*applyOptions) + +// WithOwnedConditions allows to define condition types owned by the controller. +// In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller. +func WithOwnedConditions(t ...kmapi.ConditionType) ApplyOption { + return func(c *applyOptions) { + c.ownedConditions = t + } +} + +// WithForceOverwrite In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller. +func WithForceOverwrite(v bool) ApplyOption { + return func(c *applyOptions) { + c.forceOverwrite = v + } +} + +// Apply executes a three-way merge of a list of Patch. +// When merge conflicts are detected (latest deviated from before in an incompatible way), an error is returned. +func (p Patch) Apply(latest Setter, options ...ApplyOption) error { + if len(p) == 0 { + return nil + } + + applyOpt := &applyOptions{} + for _, o := range options { + o(applyOpt) + } + + for _, conditionPatch := range p { + switch conditionPatch.Op { + case AddConditionPatch: + // If the conditions is owned, always keep the after value. + if applyOpt.forceOverwrite || applyOpt.isOwnedCondition(conditionPatch.After.Type) { + Set(latest, conditionPatch.After) + continue + } + + // If the condition is already on latest, check if latest and after agree on the change; if not, this is a conflict. + if latestCondition := Get(latest, conditionPatch.After.Type); latestCondition != nil { + // If latest and after agree on the change, then it is a conflict. + if !hasSameState(latestCondition, conditionPatch.After) { + return fmt.Errorf("error patching conditions: The condition %q was modified by a different process and this caused a merge/AddCondition conflict: %v", conditionPatch.After.Type, cmp.Diff(latestCondition, conditionPatch.After)) + } + // otherwise, the latest is already as intended. + // NOTE: We are preserving LastTransitionTime from the latest in order to avoid altering the existing value. + continue + } + // If the condition does not exist on the latest, add the new after condition. + Set(latest, conditionPatch.After) + + case ChangeConditionPatch: + // If the conditions is owned, always keep the after value. + if applyOpt.forceOverwrite || applyOpt.isOwnedCondition(conditionPatch.After.Type) { + Set(latest, conditionPatch.After) + continue + } + + latestCondition := Get(latest, conditionPatch.After.Type) + + // If the condition does not exist anymore on the latest, this is a conflict. + if latestCondition == nil { + return fmt.Errorf("error patching conditions: The condition %q was deleted by a different process and this caused a merge/ChangeCondition conflict", conditionPatch.After.Type) + } + + // If the condition on the latest is different from the base condition, check if + // the after state corresponds to the desired value. If not this is a conflict (unless we should ignore conflicts for this condition type). + if !reflect.DeepEqual(latestCondition, conditionPatch.Before) { + if !hasSameState(latestCondition, conditionPatch.After) { + return fmt.Errorf("error patching conditions: The condition %q was modified by a different process and this caused a merge/ChangeCondition conflict: %v", conditionPatch.After.Type, cmp.Diff(latestCondition, conditionPatch.After)) + } + // Otherwise the latest is already as intended. + // NOTE: We are preserving LastTransitionTime from the latest in order to avoid altering the existing value. + continue + } + // Otherwise apply the new after condition. + Set(latest, conditionPatch.After) + + case RemoveConditionPatch: + // If the conditions is owned, always keep the after value (condition should be deleted). + if applyOpt.forceOverwrite || applyOpt.isOwnedCondition(conditionPatch.Before.Type) { + Delete(latest, conditionPatch.Before.Type) + continue + } + + // If the condition is still on the latest, check if it is changed in the meantime; + // if so then this is a conflict. + if latestCondition := Get(latest, conditionPatch.Before.Type); latestCondition != nil { + if !hasSameState(latestCondition, conditionPatch.Before) { + return fmt.Errorf("error patching conditions: The condition %q was modified by a different process and this caused a merge/RemoveCondition conflict: %v", conditionPatch.Before.Type, cmp.Diff(latestCondition, conditionPatch.Before)) + } + } + // Otherwise the latest and after agreed on the delete operation, so there's nothing to change. + Delete(latest, conditionPatch.Before.Type) + } + } + return nil +} + +// IsZero returns true if the patch has no changes. +func (p Patch) IsZero() bool { + return len(p) == 0 +} diff --git a/vendor/kmodules.xyz/client-go/conditions/setter.go b/vendor/kmodules.xyz/client-go/conditions/setter.go new file mode 100644 index 000000000..eb9bf49f7 --- /dev/null +++ b/vendor/kmodules.xyz/client-go/conditions/setter.go @@ -0,0 +1,178 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package conditions + +import ( + "fmt" + "sort" + "time" + + kmapi "kmodules.xyz/client-go/api/v1" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Setter interface defines methods that an object should implement in order to +// use the conditions package for setting conditions. +type Setter interface { + Getter + SetConditions(kmapi.Conditions) +} + +// Set sets the given condition. +// +// NOTE: If a condition already exists, the LastTransitionTime is updated only if a change is detected +// in any of the following fields: Status, Reason, Severity and Message. +func Set(to Setter, condition *kmapi.Condition) { + if to == nil || condition == nil { + return + } + + // Set the ObservedGeneration field before pushing the condition into the actual status section + condition.ObservedGeneration = to.GetGeneration() + + // Check if the new conditions already exists, and change it only if there is a status + // transition (otherwise we should preserve the current last transition time)- + conditions := to.GetConditions() + exists := false + for i := range conditions { + existingCondition := conditions[i] + if existingCondition.Type == condition.Type { + exists = true + if !hasSameState(&existingCondition, condition) { + condition.LastTransitionTime = metav1.NewTime(time.Now().UTC().Truncate(time.Second)) + conditions[i] = *condition + break + } + condition.LastTransitionTime = existingCondition.LastTransitionTime + break + } + } + + // If the condition does not exist, add it, setting the transition time only if not already set + if !exists { + if condition.LastTransitionTime.IsZero() { + condition.LastTransitionTime = metav1.NewTime(time.Now().UTC().Truncate(time.Second)) + } + conditions = append(conditions, *condition) + } + + // Sorts conditions for convenience of the consumer, i.e. kubectl. + sort.Slice(conditions, func(i, j int) bool { + return lexicographicLess(&conditions[i], &conditions[j]) + }) + + to.SetConditions(conditions) +} + +// TrueCondition returns a condition with Status=True and the given type. +func TrueCondition(t kmapi.ConditionType) *kmapi.Condition { + return &kmapi.Condition{ + Type: t, + Status: metav1.ConditionTrue, + } +} + +// FalseCondition returns a condition with Status=False and the given type. +func FalseCondition(t kmapi.ConditionType, reason string, severity kmapi.ConditionSeverity, messageFormat string, messageArgs ...interface{}) *kmapi.Condition { + return &kmapi.Condition{ + Type: t, + Status: metav1.ConditionFalse, + Reason: reason, + Severity: severity, + Message: fmt.Sprintf(messageFormat, messageArgs...), + } +} + +// UnknownCondition returns a condition with Status=Unknown and the given type. +func UnknownCondition(t kmapi.ConditionType, reason string, messageFormat string, messageArgs ...interface{}) *kmapi.Condition { + return &kmapi.Condition{ + Type: t, + Status: metav1.ConditionUnknown, + Reason: reason, + Message: fmt.Sprintf(messageFormat, messageArgs...), + } +} + +// MarkTrue sets Status=True for the condition with the given type. +func MarkTrue(to Setter, t kmapi.ConditionType) { + Set(to, TrueCondition(t)) +} + +// MarkUnknown sets Status=Unknown for the condition with the given type. +func MarkUnknown(to Setter, t kmapi.ConditionType, reason, messageFormat string, messageArgs ...interface{}) { + Set(to, UnknownCondition(t, reason, messageFormat, messageArgs...)) +} + +// MarkFalse sets Status=False for the condition with the given type. +func MarkFalse(to Setter, t kmapi.ConditionType, reason string, severity kmapi.ConditionSeverity, messageFormat string, messageArgs ...interface{}) { + Set(to, FalseCondition(t, reason, severity, messageFormat, messageArgs...)) +} + +// SetSummary sets a Ready condition with the summary of all the conditions existing +// on an object. If the object does not have other conditions, no summary condition is generated. +func SetSummary(to Setter, options ...MergeOption) { + Set(to, summary(to, options...)) +} + +// SetMirror creates a new condition by mirroring the Ready condition from a dependent object; +// if the Ready condition does not exist in the source object, no target conditions is generated. +func SetMirror(to Setter, targetCondition kmapi.ConditionType, from Getter, options ...MirrorOptions) { + Set(to, mirror(from, targetCondition, options...)) +} + +// SetAggregate creates a new condition with the aggregation of all the Ready condition +// from a list of dependent objects; if the Ready condition does not exist in one of the source object, +// the object is excluded from the aggregation; if none of the source object have ready condition, +// no target conditions is generated. +func SetAggregate(to Setter, targetCondition kmapi.ConditionType, from []Getter, options ...MergeOption) { + Set(to, aggregate(from, targetCondition, options...)) +} + +// Delete deletes the condition with the given type. +func Delete(to Setter, t kmapi.ConditionType) { + if to == nil { + return + } + + conditions := to.GetConditions() + newConditions := make(kmapi.Conditions, 0, len(conditions)) + for _, condition := range conditions { + if condition.Type != t { + newConditions = append(newConditions, condition) + } + } + to.SetConditions(newConditions) +} + +// lexicographicLess returns true if a condition is less than another in regard to the +// to order of conditions designed for convenience of the consumer, i.e. kubectl. +// According to this order the Ready condition always goes first, followed by all the other +// conditions sorted by Type. +func lexicographicLess(i, j *kmapi.Condition) bool { + return (i.Type == kmapi.ReadyCondition || i.Type < j.Type) && j.Type != kmapi.ReadyCondition +} + +// hasSameState returns true if a condition has the same state of another; state is defined +// by the union of following fields: Type, Status, Reason, Severity and Message (it excludes LastTransitionTime). +func hasSameState(i, j *kmapi.Condition) bool { + return i.Type == j.Type && + i.Status == j.Status && + i.Reason == j.Reason && + i.Severity == j.Severity && + i.Message == j.Message +} diff --git a/vendor/kmodules.xyz/client-go/tools/clientcmd/rest_config.go b/vendor/kmodules.xyz/client-go/tools/clientcmd/rest_config.go new file mode 100644 index 000000000..833e7b953 --- /dev/null +++ b/vendor/kmodules.xyz/client-go/tools/clientcmd/rest_config.go @@ -0,0 +1,74 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package clientcmd + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/rest" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest" +) + +// https://github.com/kubernetes/client-go/issues/711#issuecomment-730112049 +func GenerateKubeConfiguration(cfg *rest.Config, namespace string) ([]byte, error) { + if err := rest.LoadTLSFiles(cfg); err != nil { + return nil, err + } + + clusters := make(map[string]*clientcmdapi.Cluster) + clusters["default-cluster"] = &clientcmdapi.Cluster{ + Server: cfg.Host, + CertificateAuthorityData: cfg.CAData, + } + + contexts := make(map[string]*clientcmdapi.Context) + contexts["default-context"] = &clientcmdapi.Context{ + Cluster: "default-cluster", + Namespace: namespace, + AuthInfo: "default-user", + } + + authinfos := make(map[string]*clientcmdapi.AuthInfo) + authinfos["default-user"] = &clientcmdapi.AuthInfo{ + LocationOfOrigin: "", + ClientCertificate: "", + ClientCertificateData: cfg.CertData, + ClientKey: "", + ClientKeyData: cfg.KeyData, + Token: cfg.BearerToken, + TokenFile: "", + Impersonate: cfg.Impersonate.UserName, + ImpersonateUID: cfg.Impersonate.UID, + ImpersonateGroups: cfg.Impersonate.Groups, + ImpersonateUserExtra: cfg.Impersonate.Extra, + Username: cfg.Username, + Password: cfg.Password, + AuthProvider: cfg.AuthProvider, + Exec: cfg.ExecProvider, + Extensions: nil, + } + + clientConfig := clientcmdapi.Config{ + Kind: "Config", + APIVersion: "v1", + Clusters: clusters, + Contexts: contexts, + CurrentContext: "default-context", + AuthInfos: authinfos, + } + return runtime.Encode(clientcmdlatest.Codec, &clientConfig) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 776597fc2..675fc1eef 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -706,14 +706,14 @@ gomodules.xyz/flags # gomodules.xyz/go-sh v0.1.0 ## explicit; go 1.15 gomodules.xyz/go-sh -# gomodules.xyz/jsonpatch/v2 v2.3.0 +# gomodules.xyz/jsonpatch/v2 v2.4.0 ## explicit; go 1.20 gomodules.xyz/jsonpatch/v2 # gomodules.xyz/jsonpath v0.0.2 ## explicit; go 1.16 gomodules.xyz/jsonpath gomodules.xyz/jsonpath/third_party/forked/golang/template -# gomodules.xyz/logs v0.0.6 +# gomodules.xyz/logs v0.0.7 ## explicit; go 1.16 gomodules.xyz/logs # gomodules.xyz/mergo v0.3.13 @@ -1541,7 +1541,7 @@ k8s.io/utils/trace # kmodules.xyz/apiversion v0.2.0 ## explicit; go 1.14 kmodules.xyz/apiversion -# kmodules.xyz/client-go v0.25.23 +# kmodules.xyz/client-go v0.25.29 ## explicit; go 1.18 kmodules.xyz/client-go kmodules.xyz/client-go/admissionregistration @@ -1554,6 +1554,7 @@ kmodules.xyz/client-go/apps/v1 kmodules.xyz/client-go/batch kmodules.xyz/client-go/batch/v1 kmodules.xyz/client-go/batch/v1beta1 +kmodules.xyz/client-go/conditions kmodules.xyz/client-go/core/v1 kmodules.xyz/client-go/discovery kmodules.xyz/client-go/dynamic @@ -1777,7 +1778,7 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.3.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# stash.appscode.dev/apimachinery v0.30.0 +# stash.appscode.dev/apimachinery v0.30.1-0.20230814025143-fcb8a9106d3c ## explicit; go 1.18 stash.appscode.dev/apimachinery/apis stash.appscode.dev/apimachinery/apis/repositories diff --git a/vendor/stash.appscode.dev/apimachinery/apis/repositories/v1alpha1/openapi_generated.go b/vendor/stash.appscode.dev/apimachinery/apis/repositories/v1alpha1/openapi_generated.go index 7b4d7fb7d..cf3986cdf 100644 --- a/vendor/stash.appscode.dev/apimachinery/apis/repositories/v1alpha1/openapi_generated.go +++ b/vendor/stash.appscode.dev/apimachinery/apis/repositories/v1alpha1/openapi_generated.go @@ -17028,11 +17028,12 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "Condition defines an observation of a object operational state.", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "type": { SchemaProps: spec.SchemaProps{ - Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important.", + Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary util can be useful (see .node.status.util), the ability to deconflict is important.", Default: "", Type: []string{"string"}, Format: "", @@ -17053,31 +17054,36 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) Format: "int64", }, }, + "severity": { + SchemaProps: spec.SchemaProps{ + Description: "Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False.", + Type: []string{"string"}, + Format: "", + }, + }, "lastTransitionTime": { SchemaProps: spec.SchemaProps{ - Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", Default: map[string]interface{}{}, Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, "reason": { SchemaProps: spec.SchemaProps{ - Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty.", - Default: "", + Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether this field is considered a guaranteed API. This field may not be empty.", Type: []string{"string"}, Format: "", }, }, "message": { SchemaProps: spec.SchemaProps{ - Description: "A human readable message indicating details about the transition. This field may be empty.", - Default: "", + Description: "A human-readable message indicating details about the transition. This field may be empty.", Type: []string{"string"}, Format: "", }, }, }, - Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + Required: []string{"type", "status", "lastTransitionTime"}, }, }, Dependencies: []string{ diff --git a/vendor/stash.appscode.dev/apimachinery/apis/stash/v1alpha1/openapi_generated.go b/vendor/stash.appscode.dev/apimachinery/apis/stash/v1alpha1/openapi_generated.go index dea554dc8..86188812a 100644 --- a/vendor/stash.appscode.dev/apimachinery/apis/stash/v1alpha1/openapi_generated.go +++ b/vendor/stash.appscode.dev/apimachinery/apis/stash/v1alpha1/openapi_generated.go @@ -17033,11 +17033,12 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "Condition defines an observation of a object operational state.", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "type": { SchemaProps: spec.SchemaProps{ - Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important.", + Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary util can be useful (see .node.status.util), the ability to deconflict is important.", Default: "", Type: []string{"string"}, Format: "", @@ -17058,31 +17059,36 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) Format: "int64", }, }, + "severity": { + SchemaProps: spec.SchemaProps{ + Description: "Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False.", + Type: []string{"string"}, + Format: "", + }, + }, "lastTransitionTime": { SchemaProps: spec.SchemaProps{ - Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", Default: map[string]interface{}{}, Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, "reason": { SchemaProps: spec.SchemaProps{ - Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty.", - Default: "", + Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether this field is considered a guaranteed API. This field may not be empty.", Type: []string{"string"}, Format: "", }, }, "message": { SchemaProps: spec.SchemaProps{ - Description: "A human readable message indicating details about the transition. This field may be empty.", - Default: "", + Description: "A human-readable message indicating details about the transition. This field may be empty.", Type: []string{"string"}, Format: "", }, }, }, - Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + Required: []string{"type", "status", "lastTransitionTime"}, }, }, Dependencies: []string{ diff --git a/vendor/stash.appscode.dev/apimachinery/apis/stash/v1beta1/openapi_generated.go b/vendor/stash.appscode.dev/apimachinery/apis/stash/v1beta1/openapi_generated.go index 82831d334..9e6f736a4 100644 --- a/vendor/stash.appscode.dev/apimachinery/apis/stash/v1beta1/openapi_generated.go +++ b/vendor/stash.appscode.dev/apimachinery/apis/stash/v1beta1/openapi_generated.go @@ -17079,11 +17079,12 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "Condition defines an observation of a object operational state.", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "type": { SchemaProps: spec.SchemaProps{ - Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important.", + Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary util can be useful (see .node.status.util), the ability to deconflict is important.", Default: "", Type: []string{"string"}, Format: "", @@ -17104,31 +17105,36 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) Format: "int64", }, }, + "severity": { + SchemaProps: spec.SchemaProps{ + Description: "Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False.", + Type: []string{"string"}, + Format: "", + }, + }, "lastTransitionTime": { SchemaProps: spec.SchemaProps{ - Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", Default: map[string]interface{}{}, Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, "reason": { SchemaProps: spec.SchemaProps{ - Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty.", - Default: "", + Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether this field is considered a guaranteed API. This field may not be empty.", Type: []string{"string"}, Format: "", }, }, "message": { SchemaProps: spec.SchemaProps{ - Description: "A human readable message indicating details about the transition. This field may be empty.", - Default: "", + Description: "A human-readable message indicating details about the transition. This field may be empty.", Type: []string{"string"}, Format: "", }, }, }, - Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + Required: []string{"type", "status", "lastTransitionTime"}, }, }, Dependencies: []string{ diff --git a/vendor/stash.appscode.dev/apimachinery/apis/ui/v1alpha1/openapi_generated.go b/vendor/stash.appscode.dev/apimachinery/apis/ui/v1alpha1/openapi_generated.go index df9f12f5b..db743fddd 100644 --- a/vendor/stash.appscode.dev/apimachinery/apis/ui/v1alpha1/openapi_generated.go +++ b/vendor/stash.appscode.dev/apimachinery/apis/ui/v1alpha1/openapi_generated.go @@ -17028,11 +17028,12 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "Condition defines an observation of a object operational state.", + Type: []string{"object"}, Properties: map[string]spec.Schema{ "type": { SchemaProps: spec.SchemaProps{ - Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important.", + Description: "Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary util can be useful (see .node.status.util), the ability to deconflict is important.", Default: "", Type: []string{"string"}, Format: "", @@ -17053,31 +17054,36 @@ func schema_kmodulesxyz_client_go_api_v1_Condition(ref common.ReferenceCallback) Format: "int64", }, }, + "severity": { + SchemaProps: spec.SchemaProps{ + Description: "Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False.", + Type: []string{"string"}, + Format: "", + }, + }, "lastTransitionTime": { SchemaProps: spec.SchemaProps{ - Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Description: "Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", Default: map[string]interface{}{}, Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, "reason": { SchemaProps: spec.SchemaProps{ - Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty.", - Default: "", + Description: "The reason for the condition's last transition in CamelCase. The specific API may choose whether this field is considered a guaranteed API. This field may not be empty.", Type: []string{"string"}, Format: "", }, }, "message": { SchemaProps: spec.SchemaProps{ - Description: "A human readable message indicating details about the transition. This field may be empty.", - Default: "", + Description: "A human-readable message indicating details about the transition. This field may be empty.", Type: []string{"string"}, Format: "", }, }, }, - Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + Required: []string{"type", "status", "lastTransitionTime"}, }, }, Dependencies: []string{ diff --git a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupbatches.yaml b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupbatches.yaml index 1e55812c8..b1266369f 100644 --- a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupbatches.yaml +++ b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupbatches.yaml @@ -6149,16 +6149,18 @@ spec: description: Conditions shows current backup setup condition of the BackupBatch. items: + description: Condition defines an observation of a object operational + state. properties: lastTransitionTime: description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. If - that is not known, then using the time when the API field + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -6171,9 +6173,14 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + in CamelCase. The specific API may choose whether this field + is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. @@ -6181,14 +6188,11 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + like Available, but because arbitrary util can be useful (see + .node.status.util), the ability to deconflict is important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object @@ -6202,16 +6206,18 @@ spec: description: Conditions shows current backup setup condition of this member. items: + description: Condition defines an observation of a object + operational state. properties: lastTransitionTime: description: Last time the condition transitioned from one status to another. This should be when the underlying - condition changed. If that is not known, then using + condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -6224,9 +6230,15 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or - not this field is considered a guaranteed API. This - field may not be empty. + in CamelCase. The specific API may choose whether this + field is considered a guaranteed API. This field may + not be empty. + type: string + severity: + description: Severity provides an explicit classification + of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, @@ -6235,14 +6247,12 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can - be useful (see .node.status.conditions), the ability - to deconflict is important. + like Available, but because arbitrary util can be useful + (see .node.status.util), the ability to deconflict is + important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object diff --git a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupconfigurations.yaml b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupconfigurations.yaml index 815d62659..8f2feed33 100644 --- a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupconfigurations.yaml +++ b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupconfigurations.yaml @@ -3312,16 +3312,18 @@ spec: description: Conditions shows current backup setup condition of the BackupConfiguration. items: + description: Condition defines an observation of a object operational + state. properties: lastTransitionTime: description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. If - that is not known, then using the time when the API field + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -3334,9 +3336,14 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + in CamelCase. The specific API may choose whether this field + is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. @@ -3344,14 +3351,11 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + like Available, but because arbitrary util can be useful (see + .node.status.util), the ability to deconflict is important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object diff --git a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupsessions.yaml b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupsessions.yaml index 51bfa6527..e4183625b 100644 --- a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupsessions.yaml +++ b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_backupsessions.yaml @@ -82,16 +82,18 @@ spec: description: Conditions shows condition of different operations/steps of the backup process items: + description: Condition defines an observation of a object operational + state. properties: lastTransitionTime: description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. If - that is not known, then using the time when the API field + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -104,9 +106,14 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + in CamelCase. The specific API may choose whether this field + is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. @@ -114,14 +121,11 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + like Available, but because arbitrary util can be useful (see + .node.status.util), the ability to deconflict is important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object @@ -168,16 +172,18 @@ spec: description: Conditions shows condition of different operations/steps of the backup process for this target items: + description: Condition defines an observation of a object + operational state. properties: lastTransitionTime: description: Last time the condition transitioned from one status to another. This should be when the underlying - condition changed. If that is not known, then using + condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -190,9 +196,15 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or - not this field is considered a guaranteed API. This - field may not be empty. + in CamelCase. The specific API may choose whether this + field is considered a guaranteed API. This field may + not be empty. + type: string + severity: + description: Severity provides an explicit classification + of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, @@ -201,14 +213,12 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can - be useful (see .node.status.conditions), the ability - to deconflict is important. + like Available, but because arbitrary util can be useful + (see .node.status.util), the ability to deconflict is + important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object diff --git a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restorebatches.yaml b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restorebatches.yaml index e1cc9d40b..d6e72cb6f 100644 --- a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restorebatches.yaml +++ b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restorebatches.yaml @@ -4225,16 +4225,18 @@ spec: description: Conditions shows the condition of different steps for the RestoreBatch. items: + description: Condition defines an observation of a object operational + state. properties: lastTransitionTime: description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. If - that is not known, then using the time when the API field + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -4247,9 +4249,14 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + in CamelCase. The specific API may choose whether this field + is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. @@ -4257,14 +4264,11 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + like Available, but because arbitrary util can be useful (see + .node.status.util), the ability to deconflict is important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object @@ -4278,16 +4282,18 @@ spec: description: Conditions shows the condition of different steps to restore this member. items: + description: Condition defines an observation of a object + operational state. properties: lastTransitionTime: description: Last time the condition transitioned from one status to another. This should be when the underlying - condition changed. If that is not known, then using + condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -4300,9 +4306,15 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or - not this field is considered a guaranteed API. This - field may not be empty. + in CamelCase. The specific API may choose whether this + field is considered a guaranteed API. This field may + not be empty. + type: string + severity: + description: Severity provides an explicit classification + of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, @@ -4311,14 +4323,12 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can - be useful (see .node.status.conditions), the ability - to deconflict is important. + like Available, but because arbitrary util can be useful + (see .node.status.util), the ability to deconflict is + important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object diff --git a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restoresessions.yaml b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restoresessions.yaml index 7584a675e..b899c90cc 100644 --- a/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restoresessions.yaml +++ b/vendor/stash.appscode.dev/apimachinery/crds/stash.appscode.com_restoresessions.yaml @@ -3721,16 +3721,18 @@ spec: conditions: description: Conditions shows current restore condition of the RestoreSession. items: + description: Condition defines an observation of a object operational + state. properties: lastTransitionTime: description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. If - that is not known, then using the time when the API field + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -3743,9 +3745,14 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + in CamelCase. The specific API may choose whether this field + is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. @@ -3753,14 +3760,11 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + like Available, but because arbitrary util can be useful (see + .node.status.util), the ability to deconflict is important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object diff --git a/vendor/stash.appscode.dev/apimachinery/crds/ui.stash.appscode.com_backupoverviews.yaml b/vendor/stash.appscode.dev/apimachinery/crds/ui.stash.appscode.com_backupoverviews.yaml index e523f449b..3d1737c5c 100644 --- a/vendor/stash.appscode.dev/apimachinery/crds/ui.stash.appscode.com_backupoverviews.yaml +++ b/vendor/stash.appscode.dev/apimachinery/crds/ui.stash.appscode.com_backupoverviews.yaml @@ -62,16 +62,18 @@ spec: description: Conditions shows current backup setup condition of the BackupConfiguration. items: + description: Condition defines an observation of a object operational + state. properties: lastTransitionTime: description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. If - that is not known, then using the time when the API field + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. This field may be empty. type: string observedGeneration: @@ -84,9 +86,14 @@ spec: type: integer reason: description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + in CamelCase. The specific API may choose whether this field + is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. @@ -94,14 +101,11 @@ spec: type: description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + like Available, but because arbitrary util can be useful (see + .node.status.util), the ability to deconflict is important. type: string required: - lastTransitionTime - - message - - reason - status - type type: object diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backup_invoker.go b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backup_invoker.go index 1ae9d1f61..603eceb6b 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backup_invoker.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backup_invoker.go @@ -22,7 +22,6 @@ import ( "stash.appscode.dev/apimachinery/apis/stash/v1beta1" "stash.appscode.dev/apimachinery/pkg/invoker" - core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kmapi "kmodules.xyz/client-go/api/v1" ) @@ -30,7 +29,7 @@ import ( func SetBackupTargetFoundConditionToUnknown(invoker invoker.BackupInvoker, tref v1beta1.TargetRef, err error) error { return invoker.SetCondition(&tref, kmapi.Condition{ Type: v1beta1.BackupTargetFound, - Status: core.ConditionUnknown, + Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckTargetAvailability, Message: fmt.Sprintf("Failed to check whether backup target %s %s/%s exist or not. Reason: %v", tref.Kind, @@ -46,7 +45,7 @@ func SetBackupTargetFoundConditionToFalse(invoker invoker.BackupInvoker, tref v1 return invoker.SetCondition(&tref, kmapi.Condition{ // Set the "BackupTargetFound" condition to "False" Type: v1beta1.BackupTargetFound, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.TargetNotAvailable, Message: fmt.Sprintf("Backup target %s %s/%s does not exist.", tref.Kind, @@ -60,7 +59,7 @@ func SetBackupTargetFoundConditionToFalse(invoker invoker.BackupInvoker, tref v1 func SetBackupTargetFoundConditionToTrue(invoker invoker.BackupInvoker, tref v1beta1.TargetRef) error { return invoker.SetCondition(&tref, kmapi.Condition{ Type: v1beta1.BackupTargetFound, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.TargetAvailable, Message: fmt.Sprintf("Backup target %s %s/%s found.", tref.Kind, @@ -74,7 +73,7 @@ func SetBackupTargetFoundConditionToTrue(invoker invoker.BackupInvoker, tref v1b func SetCronJobCreatedConditionToFalse(invoker invoker.BackupInvoker, err error) error { return invoker.SetCondition(nil, kmapi.Condition{ Type: v1beta1.CronJobCreated, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.CronJobCreationFailed, Message: fmt.Sprintf("Failed to create backup triggering CronJob. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -84,7 +83,7 @@ func SetCronJobCreatedConditionToFalse(invoker invoker.BackupInvoker, err error) func SetCronJobCreatedConditionToTrue(invoker invoker.BackupInvoker) error { return invoker.SetCondition(nil, kmapi.Condition{ Type: v1beta1.CronJobCreated, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.CronJobCreationSucceeded, Message: "Successfully created backup triggering CronJob.", LastTransitionTime: metav1.Now(), @@ -94,7 +93,7 @@ func SetCronJobCreatedConditionToTrue(invoker invoker.BackupInvoker) error { func SetSidecarInjectedConditionToTrue(invoker invoker.BackupInvoker, tref v1beta1.TargetRef) error { return invoker.SetCondition(&tref, kmapi.Condition{ Type: v1beta1.StashSidecarInjected, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SidecarInjectionSucceeded, Message: fmt.Sprintf("Successfully injected stash sidecar into %s %s/%s", tref.Kind, @@ -108,7 +107,7 @@ func SetSidecarInjectedConditionToTrue(invoker invoker.BackupInvoker, tref v1bet func SetSidecarInjectedConditionToFalse(invoker invoker.BackupInvoker, tref v1beta1.TargetRef, err error) error { return invoker.SetCondition(&tref, kmapi.Condition{ Type: v1beta1.StashSidecarInjected, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.SidecarInjectionFailed, Message: fmt.Sprintf("Failed to inject stash sidecar into %s %s/%s. Reason: %v", tref.Kind, diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backupsession.go b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backupsession.go index 08a789850..9ea885874 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backupsession.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/backupsession.go @@ -22,7 +22,6 @@ import ( "stash.appscode.dev/apimachinery/apis/stash/v1beta1" "stash.appscode.dev/apimachinery/pkg/invoker" - core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kmapi "kmodules.xyz/client-go/api/v1" ) @@ -32,7 +31,7 @@ func SetBackendRepositoryInitializedConditionToFalse(session *invoker.BackupSess Conditions: []kmapi.Condition{ { Type: v1beta1.BackendRepositoryInitialized, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToInitializeBackendRepository, Message: fmt.Sprintf("Failed to initialize backend repository. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -46,7 +45,7 @@ func SetBackendRepositoryInitializedConditionToTrue(session *invoker.BackupSessi Conditions: []kmapi.Condition{ { Type: v1beta1.BackendRepositoryInitialized, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.BackendRepositoryFound, Message: "Repository exist in the backend.", LastTransitionTime: metav1.Now(), @@ -63,7 +62,7 @@ func SetBackupExecutorEnsuredToFalse(session *invoker.BackupSessionHandler, targ Conditions: []kmapi.Condition{ { Type: v1beta1.BackupExecutorEnsured, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToEnsureBackupExecutor, Message: fmt.Sprintf("Failed to ensure backup executor. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -82,7 +81,7 @@ func SetBackupExecutorEnsuredToTrue(session *invoker.BackupSessionHandler, targe Conditions: []kmapi.Condition{ { Type: v1beta1.BackupExecutorEnsured, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyEnsuredBackupExecutor, Message: "Successfully ensured backup executor.", LastTransitionTime: metav1.Now(), @@ -101,7 +100,7 @@ func SetPreBackupHookExecutionSucceededToFalse(session *invoker.BackupSessionHan Conditions: []kmapi.Condition{ { Type: v1beta1.PreBackupHookExecutionSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToExecutePreBackupHook, Message: fmt.Sprintf("Failed to execute preBackup hook. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -120,7 +119,7 @@ func SetPreBackupHookExecutionSucceededToTrue(session *invoker.BackupSessionHand Conditions: []kmapi.Condition{ { Type: v1beta1.PreBackupHookExecutionSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyExecutedPreBackupHook, Message: "Successfully executed preBackup hook.", LastTransitionTime: metav1.Now(), @@ -139,7 +138,7 @@ func SetPostBackupHookExecutionSucceededToFalse(session *invoker.BackupSessionHa Conditions: []kmapi.Condition{ { Type: v1beta1.PostBackupHookExecutionSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToExecutePostBackupHook, Message: fmt.Sprintf("Failed to execute postBackup hook. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -162,7 +161,7 @@ func SetPostBackupHookExecutionSucceededToTrueWithMsg(session *invoker.BackupSes Conditions: []kmapi.Condition{ { Type: v1beta1.PostBackupHookExecutionSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyExecutedPostBackupHook, Message: msg, LastTransitionTime: metav1.Now(), @@ -178,7 +177,7 @@ func SetGlobalPreBackupHookSucceededConditionToFalse(session *invoker.BackupSess Conditions: []kmapi.Condition{ { Type: v1beta1.GlobalPreBackupHookSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.GlobalPreBackupHookExecutionFailed, Message: fmt.Sprintf("Failed to execute global PreBackup Hook. Reason: %v.", hookErr), LastTransitionTime: metav1.Now(), @@ -192,7 +191,7 @@ func SetGlobalPreBackupHookSucceededConditionToTrue(session *invoker.BackupSessi Conditions: []kmapi.Condition{ { Type: v1beta1.GlobalPreBackupHookSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.GlobalPreBackupHookExecutedSuccessfully, Message: "Global PreBackup hook has been executed successfully", LastTransitionTime: metav1.Now(), @@ -206,7 +205,7 @@ func SetGlobalPostBackupHookSucceededConditionToFalse(session *invoker.BackupSes Conditions: []kmapi.Condition{ { Type: v1beta1.GlobalPostBackupHookSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.GlobalPostBackupHookExecutionFailed, Message: fmt.Sprintf("Failed to execute global PostBackup Hook. Reason: %v.", hookErr), LastTransitionTime: metav1.Now(), @@ -224,7 +223,7 @@ func SetGlobalPostBackupHookSucceededConditionToTrueWithMsg(session *invoker.Bac Conditions: []kmapi.Condition{ { Type: v1beta1.GlobalPostBackupHookSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.GlobalPostBackupHookExecutedSuccessfully, Message: msg, LastTransitionTime: metav1.Now(), @@ -238,7 +237,7 @@ func SetRetentionPolicyAppliedConditionToFalse(session *invoker.BackupSessionHan Conditions: []kmapi.Condition{ { Type: v1beta1.RetentionPolicyApplied, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToApplyRetentionPolicy, Message: fmt.Sprintf("Failed to apply retention policy. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -252,7 +251,7 @@ func SetRetentionPolicyAppliedConditionToTrue(session *invoker.BackupSessionHand Conditions: []kmapi.Condition{ { Type: v1beta1.RetentionPolicyApplied, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyAppliedRetentionPolicy, Message: "Successfully applied retention policy.", LastTransitionTime: metav1.Now(), @@ -266,7 +265,7 @@ func SetRepositoryIntegrityVerifiedConditionToFalse(session *invoker.BackupSessi Conditions: []kmapi.Condition{ { Type: v1beta1.RepositoryIntegrityVerified, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToVerifyRepositoryIntegrity, Message: fmt.Sprintf("Repository integrity verification failed. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -280,7 +279,7 @@ func SetRepositoryIntegrityVerifiedConditionToTrue(session *invoker.BackupSessio Conditions: []kmapi.Condition{ { Type: v1beta1.RepositoryIntegrityVerified, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyVerifiedRepositoryIntegrity, Message: "Repository integrity verification succeeded.", LastTransitionTime: metav1.Now(), @@ -294,7 +293,7 @@ func SetRepositoryMetricsPushedConditionToFalse(session *invoker.BackupSessionHa Conditions: []kmapi.Condition{ { Type: v1beta1.RepositoryMetricsPushed, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToPushRepositoryMetrics, Message: fmt.Sprintf("Failed to push repository metrics. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -308,7 +307,7 @@ func SetRepositoryMetricsPushedConditionToTrue(session *invoker.BackupSessionHan Conditions: []kmapi.Condition{ { Type: v1beta1.RepositoryMetricsPushed, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyPushedRepositoryMetrics, Message: "Successfully pushed repository metrics.", LastTransitionTime: metav1.Now(), @@ -322,7 +321,7 @@ func SetBackupSkippedConditionToTrue(session *invoker.BackupSessionHandler, msg Conditions: []kmapi.Condition{ { Type: v1beta1.BackupSkipped, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SkippedTakingNewBackup, Message: msg, LastTransitionTime: metav1.Now(), @@ -336,7 +335,7 @@ func SetBackupMetricsPushedConditionToFalse(session *invoker.BackupSessionHandle Conditions: []kmapi.Condition{ { Type: v1beta1.MetricsPushed, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToPushMetrics, Message: fmt.Sprintf("Failed to push metrics. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -350,7 +349,7 @@ func SetBackupMetricsPushedConditionToTrue(session *invoker.BackupSessionHandler Conditions: []kmapi.Condition{ { Type: v1beta1.MetricsPushed, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyPushedMetrics, Message: "Successfully pushed metrics.", LastTransitionTime: metav1.Now(), @@ -364,7 +363,7 @@ func SetBackupHistoryCleanedConditionToFalse(session *invoker.BackupSessionHandl Conditions: []kmapi.Condition{ { Type: v1beta1.BackupHistoryCleaned, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToCleanBackupHistory, Message: fmt.Sprintf("Failed to cleanup old BackupSessions. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -378,7 +377,7 @@ func SetBackupHistoryCleanedConditionToTrue(session *invoker.BackupSessionHandle Conditions: []kmapi.Condition{ { Type: v1beta1.BackupHistoryCleaned, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyCleanedBackupHistory, Message: "Successfully cleaned up backup history according to backupHistoryLimit.", LastTransitionTime: metav1.Now(), @@ -392,7 +391,7 @@ func SetBackupDeadlineExceededConditionToTrue(session *invoker.BackupSessionHand Conditions: []kmapi.Condition{ { Type: v1beta1.DeadlineExceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.FailedToCompleteWithinDeadline, Message: fmt.Sprintf("Failed to complete backup within %s.", timeOut), LastTransitionTime: metav1.Now(), diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/repository.go b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/repository.go index 24408f3fd..2cbc2b6c4 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/repository.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/repository.go @@ -22,7 +22,6 @@ import ( "stash.appscode.dev/apimachinery/apis/stash/v1beta1" "stash.appscode.dev/apimachinery/pkg/invoker" - core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kmapi "kmodules.xyz/client-go/api/v1" ) @@ -32,7 +31,7 @@ func SetRepositoryFoundConditionToUnknown(i interface{}, err error) error { case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.RepositoryFound, - Status: core.ConditionUnknown, + Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckRepositoryAvailability, Message: fmt.Sprintf("Failed to check whether the Repository %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, @@ -44,7 +43,7 @@ func SetRepositoryFoundConditionToUnknown(i interface{}, err error) error { case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.RepositoryFound, - Status: core.ConditionUnknown, + Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckRepositoryAvailability, Message: fmt.Sprintf("Failed to check whether the Repository %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, @@ -63,7 +62,7 @@ func SetRepositoryFoundConditionToFalse(i interface{}) error { case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.RepositoryFound, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.RepositoryNotAvailable, Message: fmt.Sprintf("Repository %s/%s does not exist.", in.GetRepoRef().Namespace, @@ -74,7 +73,7 @@ func SetRepositoryFoundConditionToFalse(i interface{}) error { case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.RepositoryFound, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.RepositoryNotAvailable, Message: fmt.Sprintf("Repository %s/%s does not exist.", in.GetRepoRef().Namespace, @@ -92,7 +91,7 @@ func SetRepositoryFoundConditionToTrue(i interface{}) error { case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.RepositoryFound, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.RepositoryAvailable, Message: fmt.Sprintf("Repository %s/%s exist.", in.GetRepoRef().Namespace, @@ -103,7 +102,7 @@ func SetRepositoryFoundConditionToTrue(i interface{}) error { case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.RepositoryFound, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.RepositoryAvailable, Message: fmt.Sprintf("Repository %s/%s exist.", in.GetRepoRef().Namespace, @@ -121,7 +120,7 @@ func SetValidationPassedToTrue(i interface{}) error { case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.ValidationPassed, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.ResourceValidationPassed, Message: "Successfully validated.", LastTransitionTime: metav1.Now(), @@ -129,7 +128,7 @@ func SetValidationPassedToTrue(i interface{}) error { case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.ValidationPassed, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.ResourceValidationPassed, Message: "Successfully validated.", LastTransitionTime: metav1.Now(), @@ -144,7 +143,7 @@ func SetValidationPassedToFalse(i interface{}, err error) error { case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.ValidationPassed, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.ResourceValidationFailed, Message: err.Error(), LastTransitionTime: metav1.Now(), @@ -152,7 +151,7 @@ func SetValidationPassedToFalse(i interface{}, err error) error { case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.ValidationPassed, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.ResourceValidationFailed, Message: err.Error(), LastTransitionTime: metav1.Now(), @@ -167,7 +166,7 @@ func SetBackendSecretFoundConditionToUnknown(i interface{}, secretName string, e case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.BackendSecretFound, - Status: core.ConditionUnknown, + Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckBackendSecretAvailability, Message: fmt.Sprintf("Failed to check whether the backend Secret %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, @@ -179,7 +178,7 @@ func SetBackendSecretFoundConditionToUnknown(i interface{}, secretName string, e case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.BackendSecretFound, - Status: core.ConditionUnknown, + Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckBackendSecretAvailability, Message: fmt.Sprintf("Failed to check whether the backend Secret %s/%s exist or not. Reason: %v", in.GetRepoRef().Namespace, @@ -198,7 +197,7 @@ func SetBackendSecretFoundConditionToFalse(i interface{}, secretName string) err case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.BackendSecretFound, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.BackendSecretNotAvailable, Message: fmt.Sprintf("Backend Secret %s/%s does not exist.", in.GetRepoRef().Namespace, @@ -209,7 +208,7 @@ func SetBackendSecretFoundConditionToFalse(i interface{}, secretName string) err case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.BackendSecretFound, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.BackendSecretNotAvailable, Message: fmt.Sprintf("Backend Secret %s/%s does not exist.", in.GetRepoRef().Namespace, @@ -227,7 +226,7 @@ func SetBackendSecretFoundConditionToTrue(i interface{}, secretName string) erro case invoker.BackupInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.BackendSecretFound, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.BackendSecretAvailable, Message: fmt.Sprintf("Backend Secret %s/%s exist.", in.GetRepoRef().Namespace, @@ -238,7 +237,7 @@ func SetBackendSecretFoundConditionToTrue(i interface{}, secretName string) erro case invoker.RestoreInvoker: return in.SetCondition(nil, kmapi.Condition{ Type: v1beta1.BackendSecretFound, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.BackendSecretAvailable, Message: fmt.Sprintf("Backend Secret %s/%s exist.", in.GetRepoRef().Namespace, diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/restore_invoker.go b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/restore_invoker.go index 01a1bf634..5ea9284f8 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/conditions/restore_invoker.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/conditions/restore_invoker.go @@ -22,7 +22,6 @@ import ( "stash.appscode.dev/apimachinery/apis/stash/v1beta1" "stash.appscode.dev/apimachinery/pkg/invoker" - core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kmapi "kmodules.xyz/client-go/api/v1" ) @@ -31,7 +30,7 @@ func SetRestoreTargetFoundConditionToTrue(inv invoker.RestoreInvoker, index int) target := inv.GetTargetInfo()[index].Target return inv.SetCondition(&target.Ref, kmapi.Condition{ Type: v1beta1.RestoreTargetFound, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.TargetAvailable, Message: fmt.Sprintf("Restore target %s %s/%s found.", target.Ref.Kind, @@ -46,7 +45,7 @@ func SetRestoreTargetFoundConditionToFalse(inv invoker.RestoreInvoker, index int target := inv.GetTargetInfo()[index].Target return inv.SetCondition(&target.Ref, kmapi.Condition{ Type: v1beta1.RestoreTargetFound, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.TargetNotAvailable, Message: fmt.Sprintf("Restore target %s %s/%s does not exist.", target.Ref.Kind, @@ -61,7 +60,7 @@ func SetRestoreTargetFoundConditionToUnknown(inv invoker.RestoreInvoker, index i target := inv.GetTargetInfo()[index].Target return inv.SetCondition(&target.Ref, kmapi.Condition{ Type: v1beta1.RestoreTargetFound, - Status: core.ConditionUnknown, + Status: metav1.ConditionUnknown, Reason: v1beta1.UnableToCheckTargetAvailability, Message: fmt.Sprintf("Failed to check whether restore target %s %s/%s exist or not. Reason: %v", target.Ref.Kind, @@ -76,7 +75,7 @@ func SetRestoreTargetFoundConditionToUnknown(inv invoker.RestoreInvoker, index i func SetRestoreJobCreatedConditionToTrue(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.RestoreJobCreated, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.RestoreJobCreationSucceeded, Message: "Successfully created restore job.", LastTransitionTime: metav1.Now(), @@ -86,7 +85,7 @@ func SetRestoreJobCreatedConditionToTrue(inv invoker.RestoreInvoker, tref *v1bet func SetRestoreJobCreatedConditionToFalse(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef, err error) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.RestoreJobCreated, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.RestoreJobCreationFailed, Message: fmt.Sprintf("Failed to create restore job. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -96,7 +95,7 @@ func SetRestoreJobCreatedConditionToFalse(inv invoker.RestoreInvoker, tref *v1be func SetInitContainerInjectedConditionToTrue(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.StashInitContainerInjected, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.InitContainerInjectionSucceeded, Message: "Successfully injected stash init-container.", LastTransitionTime: metav1.Now(), @@ -106,7 +105,7 @@ func SetInitContainerInjectedConditionToTrue(inv invoker.RestoreInvoker, tref *v func SetInitContainerInjectedConditionToFalse(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef, err error) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.StashInitContainerInjected, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.InitContainerInjectionFailed, Message: fmt.Sprintf("Failed to inject Stash init-container. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -116,7 +115,7 @@ func SetInitContainerInjectedConditionToFalse(inv invoker.RestoreInvoker, tref * func SetRestoreCompletedConditionToTrue(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef, msg string) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.RestoreCompleted, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.PostRestoreTasksExecuted, Message: msg, LastTransitionTime: metav1.Now(), @@ -126,7 +125,7 @@ func SetRestoreCompletedConditionToTrue(inv invoker.RestoreInvoker, tref *v1beta func SetRestoreCompletedConditionToFalse(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef, msg string) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.RestoreCompleted, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.PostRestoreTasksNotExecuted, Message: msg, LastTransitionTime: metav1.Now(), @@ -136,7 +135,7 @@ func SetRestoreCompletedConditionToFalse(inv invoker.RestoreInvoker, tref *v1bet func SetRestoreExecutorEnsuredToTrue(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef, msg string) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.RestoreExecutorEnsured, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyEnsuredRestoreExecutor, Message: msg, LastTransitionTime: metav1.Now(), @@ -146,7 +145,7 @@ func SetRestoreExecutorEnsuredToTrue(inv invoker.RestoreInvoker, tref *v1beta1.T func SetRestoreExecutorEnsuredToFalse(inv invoker.RestoreInvoker, tref *v1beta1.TargetRef, msg string) error { return inv.SetCondition(tref, kmapi.Condition{ Type: v1beta1.RestoreExecutorEnsured, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToEnsureRestoreExecutor, Message: msg, LastTransitionTime: metav1.Now(), @@ -156,7 +155,7 @@ func SetRestoreExecutorEnsuredToFalse(inv invoker.RestoreInvoker, tref *v1beta1. func SetRestoreMetricsPushedConditionToFalse(inv invoker.RestoreInvoker, err error) error { return inv.SetCondition(nil, kmapi.Condition{ Type: v1beta1.MetricsPushed, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToPushMetrics, Message: fmt.Sprintf("Failed to push metrics. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -166,7 +165,7 @@ func SetRestoreMetricsPushedConditionToFalse(inv invoker.RestoreInvoker, err err func SetRestoreMetricsPushedConditionToTrue(inv invoker.RestoreInvoker) error { return inv.SetCondition(nil, kmapi.Condition{ Type: v1beta1.MetricsPushed, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyPushedMetrics, Message: "Successfully pushed metrics.", LastTransitionTime: metav1.Now(), @@ -176,7 +175,7 @@ func SetRestoreMetricsPushedConditionToTrue(inv invoker.RestoreInvoker) error { func SetPreRestoreHookExecutionSucceededToFalse(inv invoker.RestoreInvoker, err error) error { return inv.SetCondition(nil, kmapi.Condition{ Type: v1beta1.PreRestoreHookExecutionSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToExecutePreRestoreHook, Message: fmt.Sprintf("Failed to execute preRestore hook. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -186,7 +185,7 @@ func SetPreRestoreHookExecutionSucceededToFalse(inv invoker.RestoreInvoker, err func SetPreRestoreHookExecutionSucceededToTrue(inv invoker.RestoreInvoker) error { return inv.SetCondition(nil, kmapi.Condition{ Type: v1beta1.PreRestoreHookExecutionSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyExecutedPreRestoreHook, Message: "Successfully executed preRestore hook.", LastTransitionTime: metav1.Now(), @@ -196,7 +195,7 @@ func SetPreRestoreHookExecutionSucceededToTrue(inv invoker.RestoreInvoker) error func SetPostRestoreHookExecutionSucceededToFalse(inv invoker.RestoreInvoker, err error) error { return inv.SetCondition(nil, kmapi.Condition{ Type: v1beta1.PostRestoreHookExecutionSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.FailedToExecutePostRestoreHook, Message: fmt.Sprintf("Failed to execute postRestore hook. Reason: %v", err.Error()), LastTransitionTime: metav1.Now(), @@ -210,7 +209,7 @@ func SetPostRestoreHookExecutionSucceededToTrue(inv invoker.RestoreInvoker) erro func SetPostRestoreHookExecutionSucceededToTrueWithMsg(inv invoker.RestoreInvoker, msg string) error { return inv.SetCondition(nil, kmapi.Condition{ Type: v1beta1.PostRestoreHookExecutionSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.SuccessfullyExecutedPostRestoreHook, Message: msg, LastTransitionTime: metav1.Now(), @@ -220,7 +219,7 @@ func SetPostRestoreHookExecutionSucceededToTrueWithMsg(inv invoker.RestoreInvoke func SetGlobalPreRestoreHookSucceededConditionToFalse(invoker invoker.RestoreInvoker, hookErr error) error { return invoker.SetCondition(nil, kmapi.Condition{ Type: v1beta1.GlobalPreRestoreHookSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.GlobalPreRestoreHookExecutionFailed, Message: fmt.Sprintf("Failed to execute global PreRestore Hook. Reason: %v.", hookErr), LastTransitionTime: metav1.Now(), @@ -230,7 +229,7 @@ func SetGlobalPreRestoreHookSucceededConditionToFalse(invoker invoker.RestoreInv func SetGlobalPreRestoreHookSucceededConditionToTrue(invoker invoker.RestoreInvoker) error { return invoker.SetCondition(nil, kmapi.Condition{ Type: v1beta1.GlobalPreRestoreHookSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.GlobalPreRestoreHookExecutedSuccessfully, Message: "Global PreRestore hook has been executed successfully", LastTransitionTime: metav1.Now(), @@ -240,7 +239,7 @@ func SetGlobalPreRestoreHookSucceededConditionToTrue(invoker invoker.RestoreInvo func SetGlobalPostRestoreHookSucceededConditionToFalse(invoker invoker.RestoreInvoker, hookErr error) error { return invoker.SetCondition(nil, kmapi.Condition{ Type: v1beta1.GlobalPostRestoreHookSucceeded, - Status: core.ConditionFalse, + Status: metav1.ConditionFalse, Reason: v1beta1.GlobalPostRestoreHookExecutionFailed, Message: fmt.Sprintf("Failed to execute global PostRestore Hook. Reason: %v.", hookErr), LastTransitionTime: metav1.Now(), @@ -254,7 +253,7 @@ func SetGlobalPostRestoreHookSucceededConditionToTrue(invoker invoker.RestoreInv func SetGlobalPostRestoreHookSucceededConditionToTrueWithMsg(invoker invoker.RestoreInvoker, msg string) error { return invoker.SetCondition(nil, kmapi.Condition{ Type: v1beta1.GlobalPostRestoreHookSucceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.GlobalPostRestoreHookExecutedSuccessfully, Message: msg, LastTransitionTime: metav1.Now(), @@ -264,7 +263,7 @@ func SetGlobalPostRestoreHookSucceededConditionToTrueWithMsg(invoker invoker.Res func SetRestoreDeadlineExceededConditionToTrue(invoker invoker.RestoreInvoker, timeOut metav1.Duration) error { return invoker.SetCondition(nil, kmapi.Condition{ Type: v1beta1.DeadlineExceeded, - Status: core.ConditionTrue, + Status: metav1.ConditionTrue, Reason: v1beta1.FailedToCompleteWithinDeadline, Message: fmt.Sprintf("Failed to complete restore within %s.", timeOut), LastTransitionTime: metav1.Now(), diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/hooks/hook.go b/vendor/stash.appscode.dev/apimachinery/pkg/hooks/hook.go index 2ce369b92..b8c805bd8 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/hooks/hook.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/hooks/hook.go @@ -30,11 +30,12 @@ import ( "stash.appscode.dev/apimachinery/pkg/invoker" sprig "github.com/Masterminds/sprig/v3" - corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/rest" "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" prober "kmodules.xyz/prober/api/v1" "kmodules.xyz/prober/probe" ) @@ -155,9 +156,9 @@ func getTargetPhase(summary *v1beta1.Summary) string { func (e *BackupHookExecutor) alreadyExecuted(session *invoker.BackupSessionHandler) bool { if e.HookType == apis.PreBackupHook { - return kmapi.HasCondition(session.GetTargetConditions(e.Target), v1beta1.PreBackupHookExecutionSucceeded) + return cutil.HasCondition(session.GetTargetConditions(e.Target), v1beta1.PreBackupHookExecutionSucceeded) } - return kmapi.HasCondition(session.GetTargetConditions(e.Target), v1beta1.PostBackupHookExecutionSucceeded) + return cutil.HasCondition(session.GetTargetConditions(e.Target), v1beta1.PostBackupHookExecutionSucceeded) } func (e *BackupHookExecutor) skipHookExecution(session *invoker.BackupSessionHandler, reason string) error { @@ -172,11 +173,11 @@ func (e *BackupHookExecutor) skipHookReExecution(session *invoker.BackupSessionH targetConditions := session.GetTargetConditions(e.Target) if e.HookType == apis.PreBackupHook { - _, cond = kmapi.GetCondition(targetConditions, v1beta1.PreBackupHookExecutionSucceeded) + _, cond = cutil.GetCondition(targetConditions, v1beta1.PreBackupHookExecutionSucceeded) } else { - _, cond = kmapi.GetCondition(targetConditions, v1beta1.PostBackupHookExecutionSucceeded) + _, cond = cutil.GetCondition(targetConditions, v1beta1.PostBackupHookExecutionSucceeded) } - if cond != nil && cond.Status == corev1.ConditionFalse { + if cond != nil && cond.Status == metav1.ConditionFalse { return fmt.Errorf("%s hook failed to execute. Reason: ", cond.Reason) } return nil @@ -270,7 +271,7 @@ func (e *RestoreHookExecutor) skipHookReExecution() error { } cond = c } - if cond != nil && cond.Status == corev1.ConditionFalse { + if cond != nil && cond.Status == metav1.ConditionFalse { return fmt.Errorf("%s hook failed to execute. Reason: ", cond.Reason) } return nil diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backup_invoker.go b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backup_invoker.go index 5c1de87fc..137bc0d2e 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backup_invoker.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backup_invoker.go @@ -27,6 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" ofst "kmodules.xyz/offshoot-api/api/v1" ) @@ -101,7 +102,7 @@ func hasMemberCondition(conditions []v1beta1.MemberConditions, target v1beta1.Ta // If the target is present in the list, then return the respective value for i := range conditions { if TargetMatched(conditions[i].Target, target) { - return kmapi.HasCondition(conditions[i].Conditions, condType) + return cutil.HasCondition(conditions[i].Conditions, condType) } } // Member is not present in the list, so the condition is not there too @@ -112,7 +113,7 @@ func getMemberCondition(conditions []v1beta1.MemberConditions, target v1beta1.Ta // If the target is present in the list, then return the respective condition for i := range conditions { if TargetMatched(conditions[i].Target, target) { - return kmapi.GetCondition(conditions[i].Conditions, condType) + return cutil.GetCondition(conditions[i].Conditions, condType) } } // Member is not present in the list @@ -130,14 +131,14 @@ func setMemberCondition(conditions []v1beta1.MemberConditions, target v1beta1.Ta // If the target is already exist in the list, update its condition for i := range conditions { if TargetMatched(conditions[i].Target, target) { - conditions[i].Conditions = kmapi.SetCondition(conditions[i].Conditions, newCondition) + conditions[i].Conditions = cutil.SetCondition(conditions[i].Conditions, newCondition) return conditions } } // The target does not exist in the list. So, add a new entry. memberConditions := v1beta1.MemberConditions{ Target: target, - Conditions: kmapi.SetCondition(nil, newCondition), + Conditions: cutil.SetCondition(nil, newCondition), } return append(conditions, memberConditions) } @@ -146,7 +147,7 @@ func isMemberConditionTrue(conditions []v1beta1.MemberConditions, target v1beta1 // If the target is present in the list, then return the respective value for i := range conditions { if TargetMatched(conditions[i].Target, target) { - return kmapi.IsConditionTrue(conditions[i].Conditions, condType) + return cutil.IsConditionTrue(conditions[i].Conditions, condType) } } // Member is not present in the list, so the condition is false @@ -156,7 +157,7 @@ func isMemberConditionTrue(conditions []v1beta1.MemberConditions, target v1beta1 func TargetBackupInitiated(ref v1beta1.TargetRef, targetStatus []v1beta1.BackupTargetStatus) bool { for i := range targetStatus { if TargetMatched(ref, targetStatus[i].Ref) { - return kmapi.HasCondition(targetStatus[i].Conditions, v1beta1.BackupExecutorEnsured) || + return cutil.HasCondition(targetStatus[i].Conditions, v1beta1.BackupExecutorEnsured) || targetStatus[i].Phase == v1beta1.TargetBackupRunning || targetStatus[i].Phase == v1beta1.TargetBackupSucceeded || targetStatus[i].Phase == v1beta1.TargetBackupFailed @@ -176,7 +177,7 @@ func TargetBackupCompleted(ref v1beta1.TargetRef, targetStatus []v1beta1.BackupT } func isConditionSatisfied(conditions []kmapi.Condition, condType string) bool { - if kmapi.IsConditionFalse(conditions, condType) || kmapi.IsConditionUnknown(conditions, condType) { + if cutil.IsConditionFalse(conditions, condType) || cutil.IsConditionUnknown(conditions, condType) { return false } @@ -189,12 +190,12 @@ func CalculateBackupInvokerPhase(driver v1beta1.Snapshotter, conditions []kmapi. return v1beta1.BackupInvokerNotReady } - if kmapi.IsConditionFalse(conditions, v1beta1.ValidationPassed) { + if cutil.IsConditionFalse(conditions, v1beta1.ValidationPassed) { return v1beta1.BackupInvokerInvalid } - if kmapi.IsConditionTrue(conditions, v1beta1.ValidationPassed) && - kmapi.IsConditionTrue(conditions, v1beta1.CronJobCreated) && + if cutil.IsConditionTrue(conditions, v1beta1.ValidationPassed) && + cutil.IsConditionTrue(conditions, v1beta1.CronJobCreated) && backendRequirementsSatisfied(driver, conditions) { return v1beta1.BackupInvokerReady } @@ -204,7 +205,7 @@ func CalculateBackupInvokerPhase(driver v1beta1.Snapshotter, conditions []kmapi. func backendRequirementsSatisfied(driver v1beta1.Snapshotter, conditions []kmapi.Condition) bool { if driver == v1beta1.ResticSnapshotter { - return kmapi.IsConditionTrue(conditions, v1beta1.RepositoryFound) && kmapi.IsConditionTrue(conditions, v1beta1.BackendSecretFound) + return cutil.IsConditionTrue(conditions, v1beta1.RepositoryFound) && cutil.IsConditionTrue(conditions, v1beta1.BackendSecretFound) } return true } diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupbatch.go b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupbatch.go index e7a4bd742..3198b6bc3 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupbatch.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupbatch.go @@ -35,6 +35,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/reference" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" core_util "kmodules.xyz/client-go/core/v1" "kmodules.xyz/client-go/meta" ofst "kmodules.xyz/offshoot-api/api/v1" @@ -108,7 +109,7 @@ func (inv *BackupBatchInvoker) HasCondition(target *v1beta1.TargetRef, condition if target != nil { return hasMemberCondition(backupBatch.Status.MemberConditions, *target, conditionType), nil } - return kmapi.HasCondition(backupBatch.Status.Conditions, conditionType), nil + return cutil.HasCondition(backupBatch.Status.Conditions, conditionType), nil } func (inv *BackupBatchInvoker) GetCondition(target *v1beta1.TargetRef, conditionType string) (int, *kmapi.Condition, error) { @@ -120,7 +121,7 @@ func (inv *BackupBatchInvoker) GetCondition(target *v1beta1.TargetRef, condition idx, cond := getMemberCondition(backupBatch.Status.MemberConditions, *target, conditionType) return idx, cond, nil } - idx, cond := kmapi.GetCondition(backupBatch.Status.Conditions, conditionType) + idx, cond := cutil.GetCondition(backupBatch.Status.Conditions, conditionType) return idx, cond, nil } @@ -129,7 +130,7 @@ func (inv *BackupBatchInvoker) SetCondition(target *v1beta1.TargetRef, newCondit if target != nil { in.MemberConditions = setMemberCondition(in.MemberConditions, *target, newCondition) } else { - in.Conditions = kmapi.SetCondition(in.Conditions, newCondition) + in.Conditions = cutil.SetCondition(in.Conditions, newCondition) } in.Phase = CalculateBackupInvokerPhase(inv.GetDriver(), in.Conditions) return inv.backupBatch.UID, in @@ -149,7 +150,7 @@ func (inv *BackupBatchInvoker) IsConditionTrue(target *v1beta1.TargetRef, condit if target != nil { return isMemberConditionTrue(backupBatch.Status.MemberConditions, *target, conditionType), nil } - return kmapi.IsConditionTrue(backupBatch.Status.Conditions, conditionType), nil + return cutil.IsConditionTrue(backupBatch.Status.Conditions, conditionType), nil } func (inv *BackupBatchInvoker) GetTargetInfo() []BackupTargetInfo { diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupconfiguration.go b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupconfiguration.go index 7929ffe27..612748cf2 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupconfiguration.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupconfiguration.go @@ -35,6 +35,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/reference" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" core_util "kmodules.xyz/client-go/core/v1" "kmodules.xyz/client-go/meta" ofst "kmodules.xyz/offshoot-api/api/v1" @@ -105,7 +106,7 @@ func (inv *BackupConfigurationInvoker) HasCondition(target *v1beta1.TargetRef, c if err != nil { return false, err } - return kmapi.HasCondition(backupConfig.Status.Conditions, conditionType), nil + return cutil.HasCondition(backupConfig.Status.Conditions, conditionType), nil } func (inv *BackupConfigurationInvoker) GetCondition(target *v1beta1.TargetRef, conditionType string) (int, *kmapi.Condition, error) { @@ -113,13 +114,13 @@ func (inv *BackupConfigurationInvoker) GetCondition(target *v1beta1.TargetRef, c if err != nil { return -1, nil, err } - idx, cond := kmapi.GetCondition(backupConfig.Status.Conditions, conditionType) + idx, cond := cutil.GetCondition(backupConfig.Status.Conditions, conditionType) return idx, cond, nil } func (inv *BackupConfigurationInvoker) SetCondition(target *v1beta1.TargetRef, newCondition kmapi.Condition) error { updatedBackupConfig, err := v1beta1_util.UpdateBackupConfigurationStatus(context.TODO(), inv.stashClient.StashV1beta1(), inv.backupConfig.ObjectMeta, func(in *v1beta1.BackupConfigurationStatus) (types.UID, *v1beta1.BackupConfigurationStatus) { - in.Conditions = kmapi.SetCondition(in.Conditions, newCondition) + in.Conditions = cutil.SetCondition(in.Conditions, newCondition) in.Phase = CalculateBackupInvokerPhase(inv.GetDriver(), in.Conditions) return inv.backupConfig.UID, in }, metav1.UpdateOptions{}) @@ -135,7 +136,7 @@ func (inv *BackupConfigurationInvoker) IsConditionTrue(target *v1beta1.TargetRef if err != nil { return false, err } - return kmapi.IsConditionTrue(backupConfig.Status.Conditions, conditionType), nil + return cutil.IsConditionTrue(backupConfig.Status.Conditions, conditionType), nil } func (inv *BackupConfigurationInvoker) GetTargetInfo() []BackupTargetInfo { diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupsession.go b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupsession.go index e737b63f3..18a7275a1 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupsession.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/backupsession.go @@ -28,6 +28,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" ) type BackupSessionHandler struct { @@ -207,9 +208,9 @@ func upsertBackupHostStatus(cur, new []v1beta1.HostBackupStats) []v1beta1.HostBa } func calculateBackupTargetPhase(status v1beta1.BackupTargetStatus) v1beta1.TargetPhase { - if kmapi.IsConditionFalse(status.Conditions, v1beta1.BackupExecutorEnsured) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.PreBackupHookExecutionSucceeded) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.PostBackupHookExecutionSucceeded) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.BackupExecutorEnsured) || + cutil.IsConditionFalse(status.Conditions, v1beta1.PreBackupHookExecutionSucceeded) || + cutil.IsConditionFalse(status.Conditions, v1beta1.PostBackupHookExecutionSucceeded) { return v1beta1.TargetBackupFailed } @@ -239,19 +240,19 @@ func calculateBackupTargetPhase(status v1beta1.BackupTargetStatus) v1beta1.Targe } func calculateBackupSessionPhase(status *v1beta1.BackupSessionStatus) v1beta1.BackupSessionPhase { - if kmapi.IsConditionFalse(status.Conditions, v1beta1.MetricsPushed) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.MetricsPushed) { return v1beta1.BackupSessionFailed } - if kmapi.IsConditionTrue(status.Conditions, v1beta1.BackupSkipped) { + if cutil.IsConditionTrue(status.Conditions, v1beta1.BackupSkipped) { return v1beta1.BackupSessionSkipped } - if kmapi.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) && - (kmapi.IsConditionTrue(status.Conditions, v1beta1.DeadlineExceeded) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.BackupHistoryCleaned) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.GlobalPreBackupHookSucceeded) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.GlobalPostBackupHookSucceeded)) { + if cutil.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) && + (cutil.IsConditionTrue(status.Conditions, v1beta1.DeadlineExceeded) || + cutil.IsConditionFalse(status.Conditions, v1beta1.BackupHistoryCleaned) || + cutil.IsConditionFalse(status.Conditions, v1beta1.GlobalPreBackupHookSucceeded) || + cutil.IsConditionFalse(status.Conditions, v1beta1.GlobalPostBackupHookSucceeded)) { return v1beta1.BackupSessionFailed } @@ -272,11 +273,11 @@ func calculateBackupSessionPhase(status *v1beta1.BackupSessionStatus) v1beta1.Ba } completedTargets := successfulTargetCount + failedTargetCount - if completedTargets == len(status.Targets) && kmapi.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) { // Pushing metrics is the last step. + if completedTargets == len(status.Targets) && cutil.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) { // Pushing metrics is the last step. if failedTargetCount > 0 || - kmapi.IsConditionFalse(status.Conditions, v1beta1.RetentionPolicyApplied) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.RepositoryMetricsPushed) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.RepositoryIntegrityVerified) { + cutil.IsConditionFalse(status.Conditions, v1beta1.RetentionPolicyApplied) || + cutil.IsConditionFalse(status.Conditions, v1beta1.RepositoryMetricsPushed) || + cutil.IsConditionFalse(status.Conditions, v1beta1.RepositoryIntegrityVerified) { return v1beta1.BackupSessionFailed } return v1beta1.BackupSessionSucceeded diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restore_invoker.go b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restore_invoker.go index 442c26624..68268ff6f 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restore_invoker.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restore_invoker.go @@ -27,6 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" "kmodules.xyz/client-go/meta" ofst "kmodules.xyz/offshoot-api/api/v1" ) @@ -106,7 +107,7 @@ func hasRestoreMemberCondition(status []v1beta1.RestoreMemberStatus, target v1be // If the target is present in the list, then return the respective value for i := range status { if TargetMatched(status[i].Ref, target) { - return kmapi.HasCondition(status[i].Conditions, condType) + return cutil.HasCondition(status[i].Conditions, condType) } } // Member is not present in the list, so the condition is not there too @@ -117,7 +118,7 @@ func getRestoreMemberCondition(status []v1beta1.RestoreMemberStatus, target v1be // If the target is present in the list, then return the respective condition for i := range status { if TargetMatched(status[i].Ref, target) { - return kmapi.GetCondition(status[i].Conditions, condType) + return cutil.GetCondition(status[i].Conditions, condType) } } // Member is not present in the list @@ -128,14 +129,14 @@ func setRestoreMemberCondition(status []v1beta1.RestoreMemberStatus, target v1be // If the target is already exist in the list, update its condition for i := range status { if TargetMatched(status[i].Ref, target) { - status[i].Conditions = kmapi.SetCondition(status[i].Conditions, newCondition) + status[i].Conditions = cutil.SetCondition(status[i].Conditions, newCondition) return status } } // The target does not exist in the list. So, add a new entry. memberStatus := v1beta1.RestoreMemberStatus{ Ref: target, - Conditions: kmapi.SetCondition(nil, newCondition), + Conditions: cutil.SetCondition(nil, newCondition), } return upsertRestoreMemberStatus(status, memberStatus) } @@ -144,7 +145,7 @@ func isRestoreMemberConditionTrue(status []v1beta1.RestoreMemberStatus, target v // If the target is present in the list, then return the respective value for i := range status { if TargetMatched(status[i].Ref, target) { - return kmapi.IsConditionTrue(status[i].Conditions, condType) + return cutil.IsConditionTrue(status[i].Conditions, condType) } } // Member is not present in the list, so the condition is false @@ -153,7 +154,7 @@ func isRestoreMemberConditionTrue(status []v1beta1.RestoreMemberStatus, target v func upsertConditions(cur []kmapi.Condition, new []kmapi.Condition) []kmapi.Condition { for i := range new { - cur = kmapi.SetCondition(cur, new[i]) + cur = cutil.SetCondition(cur, new[i]) } return cur } @@ -275,15 +276,15 @@ func upsertRestoreTargetStatus(cur, new v1beta1.RestoreMemberStatus) v1beta1.Res } func calculateRestoreTargetPhase(status v1beta1.RestoreMemberStatus) v1beta1.RestoreTargetPhase { - if kmapi.IsConditionFalse(status.Conditions, v1beta1.RestoreExecutorEnsured) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.PreRestoreHookExecutionSucceeded) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.PostRestoreHookExecutionSucceeded) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.RestoreExecutorEnsured) || + cutil.IsConditionFalse(status.Conditions, v1beta1.PreRestoreHookExecutionSucceeded) || + cutil.IsConditionFalse(status.Conditions, v1beta1.PostRestoreHookExecutionSucceeded) { return v1beta1.TargetRestoreFailed } if status.TotalHosts == nil || len(status.Conditions) == 0 || - kmapi.IsConditionFalse(status.Conditions, v1beta1.RestoreTargetFound) { + cutil.IsConditionFalse(status.Conditions, v1beta1.RestoreTargetFound) { return v1beta1.TargetRestorePending } diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restorebatch.go b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restorebatch.go index 75d0064e0..c55d28bc1 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restorebatch.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restorebatch.go @@ -36,6 +36,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/reference" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" core_util "kmodules.xyz/client-go/core/v1" "kmodules.xyz/client-go/meta" appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" @@ -111,7 +112,7 @@ func (inv *RestoreBatchInvoker) HasCondition(target *v1beta1.TargetRef, conditio if target != nil { return hasRestoreMemberCondition(restoreBatch.Status.Members, *target, conditionType), nil } - return kmapi.HasCondition(restoreBatch.Status.Conditions, conditionType), nil + return cutil.HasCondition(restoreBatch.Status.Conditions, conditionType), nil } func (inv *RestoreBatchInvoker) GetCondition(target *v1beta1.TargetRef, conditionType string) (int, *kmapi.Condition, error) { @@ -123,7 +124,7 @@ func (inv *RestoreBatchInvoker) GetCondition(target *v1beta1.TargetRef, conditio idx, cond := getRestoreMemberCondition(restoreBatch.Status.Members, *target, conditionType) return idx, cond, nil } - idx, cond := kmapi.GetCondition(restoreBatch.Status.Conditions, conditionType) + idx, cond := cutil.GetCondition(restoreBatch.Status.Conditions, conditionType) return idx, cond, nil } @@ -133,7 +134,7 @@ func (inv *RestoreBatchInvoker) SetCondition(target *v1beta1.TargetRef, newCondi if target != nil { status.TargetStatus = setRestoreMemberCondition(status.TargetStatus, *target, newCondition) } else { - status.Conditions = kmapi.SetCondition(status.Conditions, newCondition) + status.Conditions = cutil.SetCondition(status.Conditions, newCondition) } return inv.UpdateStatus(status) } @@ -146,7 +147,7 @@ func (inv *RestoreBatchInvoker) IsConditionTrue(target *v1beta1.TargetRef, condi if target != nil { return isRestoreMemberConditionTrue(restoreBatch.Status.Members, *target, conditionType), nil } - return kmapi.IsConditionTrue(restoreBatch.Status.Conditions, conditionType), nil + return cutil.IsConditionTrue(restoreBatch.Status.Conditions, conditionType), nil } func (inv *RestoreBatchInvoker) GetTargetInfo() []RestoreTargetInfo { @@ -361,14 +362,14 @@ func upsertRestoreMemberStatus(cur []v1beta1.RestoreMemberStatus, new v1beta1.Re } func calculateRestoreBatchPhase(status *v1beta1.RestoreBatchStatus, totalTargets int) v1beta1.RestorePhase { - if kmapi.IsConditionFalse(status.Conditions, v1beta1.MetricsPushed) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.MetricsPushed) { return v1beta1.RestoreFailed } - if kmapi.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) && - (kmapi.IsConditionFalse(status.Conditions, v1beta1.GlobalPreRestoreHookSucceeded) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.GlobalPostRestoreHookSucceeded) || - kmapi.IsConditionTrue(status.Conditions, v1beta1.DeadlineExceeded)) { + if cutil.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) && + (cutil.IsConditionFalse(status.Conditions, v1beta1.GlobalPreRestoreHookSucceeded) || + cutil.IsConditionFalse(status.Conditions, v1beta1.GlobalPostRestoreHookSucceeded) || + cutil.IsConditionTrue(status.Conditions, v1beta1.DeadlineExceeded)) { return v1beta1.RestoreFailed } @@ -376,8 +377,8 @@ func calculateRestoreBatchPhase(status *v1beta1.RestoreBatchStatus, totalTargets return v1beta1.RestorePending } - if kmapi.IsConditionFalse(status.Conditions, v1beta1.RepositoryFound) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.BackendSecretFound) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.RepositoryFound) || + cutil.IsConditionFalse(status.Conditions, v1beta1.BackendSecretFound) { return v1beta1.RestorePending } @@ -406,12 +407,12 @@ func calculateRestoreBatchPhase(status *v1beta1.RestoreBatchStatus, totalTargets return v1beta1.RestoreFailed } - if kmapi.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) { + if cutil.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) { return v1beta1.RestoreSucceeded } } - if kmapi.IsConditionFalse(status.Conditions, v1beta1.ValidationPassed) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.ValidationPassed) { return v1beta1.RestorePhaseInvalid } diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restoresession.go b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restoresession.go index 5f744c398..ccf378b82 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restoresession.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/invoker/restoresession.go @@ -36,6 +36,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/reference" kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" core_util "kmodules.xyz/client-go/core/v1" "kmodules.xyz/client-go/meta" appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" @@ -108,7 +109,7 @@ func (inv *RestoreSessionInvoker) HasCondition(target *v1beta1.TargetRef, condit if err != nil { return false, err } - return kmapi.HasCondition(restoreSession.Status.Conditions, conditionType), nil + return cutil.HasCondition(restoreSession.Status.Conditions, conditionType), nil } func (inv *RestoreSessionInvoker) GetCondition(target *v1beta1.TargetRef, conditionType string) (int, *kmapi.Condition, error) { @@ -116,13 +117,13 @@ func (inv *RestoreSessionInvoker) GetCondition(target *v1beta1.TargetRef, condit if err != nil { return -1, nil, err } - idx, cond := kmapi.GetCondition(restoreSession.Status.Conditions, conditionType) + idx, cond := cutil.GetCondition(restoreSession.Status.Conditions, conditionType) return idx, cond, nil } func (inv *RestoreSessionInvoker) SetCondition(target *v1beta1.TargetRef, newCondition kmapi.Condition) error { status := inv.GetStatus() - status.Conditions = kmapi.SetCondition(status.Conditions, newCondition) + status.Conditions = cutil.SetCondition(status.Conditions, newCondition) status.TargetStatus[0].Conditions = status.Conditions return inv.UpdateStatus(status) } @@ -132,7 +133,7 @@ func (inv *RestoreSessionInvoker) IsConditionTrue(target *v1beta1.TargetRef, con if err != nil { return false, err } - return kmapi.IsConditionTrue(restoreSession.Status.Conditions, conditionType), nil + return cutil.IsConditionTrue(restoreSession.Status.Conditions, conditionType), nil } func (inv *RestoreSessionInvoker) GetTargetInfo() []RestoreTargetInfo { @@ -376,7 +377,7 @@ func checkRestoreFailureInHostStatus(status []v1beta1.HostRestoreStats) (bool, s func checkFailureInConditions(conditions []kmapi.Condition) (bool, string) { for _, c := range conditions { - if c.Status == core.ConditionFalse || c.Type == v1beta1.DeadlineExceeded { + if c.Status == metav1.ConditionFalse || c.Type == v1beta1.DeadlineExceeded { return true, c.Message } } @@ -385,12 +386,12 @@ func checkFailureInConditions(conditions []kmapi.Condition) (bool, string) { } func calculateRestoreSessionPhase(status v1beta1.RestoreMemberStatus) v1beta1.RestorePhase { - if kmapi.IsConditionFalse(status.Conditions, v1beta1.MetricsPushed) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.MetricsPushed) { return v1beta1.RestoreFailed } - if kmapi.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) && - kmapi.IsConditionTrue(status.Conditions, v1beta1.DeadlineExceeded) { + if cutil.IsConditionTrue(status.Conditions, v1beta1.MetricsPushed) && + cutil.IsConditionTrue(status.Conditions, v1beta1.DeadlineExceeded) { return v1beta1.RestoreFailed } @@ -399,14 +400,14 @@ func calculateRestoreSessionPhase(status v1beta1.RestoreMemberStatus) v1beta1.Re } if status.Phase == v1beta1.TargetRestorePending || - kmapi.IsConditionFalse(status.Conditions, v1beta1.RepositoryFound) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.BackendSecretFound) || - kmapi.IsConditionFalse(status.Conditions, v1beta1.RestoreTargetFound) { + cutil.IsConditionFalse(status.Conditions, v1beta1.RepositoryFound) || + cutil.IsConditionFalse(status.Conditions, v1beta1.BackendSecretFound) || + cutil.IsConditionFalse(status.Conditions, v1beta1.RestoreTargetFound) { return v1beta1.RestorePending } if RestoreCompletedForAllTargets([]v1beta1.RestoreMemberStatus{status}, 1) { - if !kmapi.HasCondition(status.Conditions, v1beta1.MetricsPushed) { + if !cutil.HasCondition(status.Conditions, v1beta1.MetricsPushed) { return v1beta1.RestoreRunning } @@ -420,7 +421,7 @@ func calculateRestoreSessionPhase(status v1beta1.RestoreMemberStatus) v1beta1.Re return v1beta1.RestoreSucceeded } - if kmapi.IsConditionFalse(status.Conditions, v1beta1.ValidationPassed) { + if cutil.IsConditionFalse(status.Conditions, v1beta1.ValidationPassed) { return v1beta1.RestorePhaseInvalid } diff --git a/vendor/stash.appscode.dev/apimachinery/pkg/util/backup.go b/vendor/stash.appscode.dev/apimachinery/pkg/util/backup.go index e207666d9..50acb69b4 100644 --- a/vendor/stash.appscode.dev/apimachinery/pkg/util/backup.go +++ b/vendor/stash.appscode.dev/apimachinery/pkg/util/backup.go @@ -30,7 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/klog/v2" - kmapi "kmodules.xyz/client-go/api/v1" + cutil "kmodules.xyz/client-go/conditions" ) type ActionOptions struct { @@ -75,7 +75,7 @@ func (opt *ActionOptions) executePreBackupActions(session *invoker.BackupSession } func repoAlreadyInitialized(session *invoker.BackupSessionHandler) bool { - return kmapi.HasCondition(session.GetConditions(), v1beta1.BackendRepositoryInitialized) + return cutil.HasCondition(session.GetConditions(), v1beta1.BackendRepositoryInitialized) } // IsRepositoryInitialized check whether the backend restic repository has been initialized or not @@ -85,12 +85,12 @@ func IsRepositoryInitialized(opt ActionOptions) (bool, error) { return false, err } // If the condition is not present, then the repository hasn't been initialized - if !kmapi.HasCondition(backupSession.Status.Conditions, v1beta1.BackendRepositoryInitialized) { + if !cutil.HasCondition(backupSession.Status.Conditions, v1beta1.BackendRepositoryInitialized) { return false, nil } // If the condition is present but it is set to "False", then the repository initialization has failed. Possibly due to invalid backend / storage secret. - if !kmapi.IsConditionTrue(backupSession.Status.Conditions, v1beta1.BackendRepositoryInitialized) { - _, cnd := kmapi.GetCondition(backupSession.Status.Conditions, v1beta1.BackendRepositoryInitialized) + if !cutil.IsConditionTrue(backupSession.Status.Conditions, v1beta1.BackendRepositoryInitialized) { + _, cnd := cutil.GetCondition(backupSession.Status.Conditions, v1beta1.BackendRepositoryInitialized) return false, fmt.Errorf(cnd.Reason) } return true, nil