diff --git a/go.sum b/go.sum index 3f7a72e9cb..9713e49bb7 100644 --- a/go.sum +++ b/go.sum @@ -2446,13 +2446,12 @@ github.com/libopenstorage/openstorage v0.0.0-20230511212757-41751b27d69f/go.mod github.com/libopenstorage/openstorage-sdk-clients v0.109.0/go.mod h1:vo0c/nLG2HIyQva4Avwx61U1kWcw4HGQh3sjzV2DEEs= github.com/libopenstorage/operator v0.0.0-20230323034810-8853b151f594/go.mod h1:0S4k1ouTScuVS3rxPukfEFvc5bMasmI1wpAAM0NejWQ= github.com/libopenstorage/operator v0.0.0-20230801044606-e27dec4914d4/go.mod h1:Lc0sagIlgkrXHn+vwR9JfZkAkSsdedtbrRx42qF0vMc= -github.com/libopenstorage/operator v0.0.0-20230814210648-7843b18f6ab0/go.mod h1:rzxe/bUCAJVZM41Xza6fqHw6T7gXkCnkbVGMlRITmPQ= github.com/libopenstorage/operator v0.0.0-20231004002935-494c2edc384a h1:RIw6gTpw0wbYHxTM2sB/LYgtRP0TLPQSJvPVGy07Lw4= github.com/libopenstorage/operator v0.0.0-20231004002935-494c2edc384a/go.mod h1:pMNY6LzUPynOLB+CEKksLTm8UvvCfeBFN0Leu8evN7U= github.com/libopenstorage/secrets v0.0.0-20220413195519-57d1c446c5e9 h1:pZQ5uaWky7KerHX2saBO971ti+IBDJRorHwcHwc+0aM= github.com/libopenstorage/secrets v0.0.0-20220413195519-57d1c446c5e9/go.mod h1:gE8rSd6lwLNXNbiW3DrRZjFMs+y4fDHy/6uiOO9cdzY= github.com/libopenstorage/stork v1.4.1-0.20230610103146-72cf75320066/go.mod h1:Yst+fnOYjWk6SA5pXZBKm19wtiinjxQ/vgYTXI3k80Q= -github.com/libopenstorage/stork v1.4.1-0.20231003165010-29f495ef07e2/go.mod h1:ccfbJni2ECyq6ukcs9Q1d4wN5u2+zngRl/FVTk6Lcsw= +github.com/libopenstorage/stork v1.4.1-0.20231129051608-5cf733dbfd9e/go.mod h1:wowq0fd8NQyqDvLiKmGky+C2GtN8m7hjixOrQpYLtok= github.com/libopenstorage/systemutils v0.0.0-20160208220149-44ac83be3ce1 h1:5vqfYYWm4b+lbkMtvvWtWBiqLbmLN6dNvWaa7wVsz/Q= github.com/libopenstorage/systemutils v0.0.0-20160208220149-44ac83be3ce1/go.mod h1:xwNGC7xiz/BQ/wbMkvHujL8Gjgseg+x41xMek7sKRRQ= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= diff --git a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiabackup/kopiabackup.go b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiabackup/kopiabackup.go index 1c29b69288..5292f7c41d 100644 --- a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiabackup/kopiabackup.go +++ b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiabackup/kopiabackup.go @@ -287,6 +287,8 @@ func jobFor( "/data", }, " ") + cmd = utils.CheckAndAddKopiaDebugModeAnnotationsCommand(cmd, jobOption) + if jobOption.Compression != "" { splitCmd := strings.Split(cmd, " ") splitCmd = append(splitCmd, "--compression", jobOption.Compression) @@ -507,7 +509,7 @@ func roleFor(live bool) *rbacv1.Role { Rules: []rbacv1.PolicyRule{ { APIGroups: []string{"kdmp.portworx.com"}, - Resources: []string{"volumebackups"}, + Resources: []string{"volumebackups", "dataexports"}, Verbs: []string{rbacv1.VerbAll}, }, }, diff --git a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiadelete/kopiadelete.go b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiadelete/kopiadelete.go index 7ee70c20f4..4d9ff778c2 100644 --- a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiadelete/kopiadelete.go +++ b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiadelete/kopiadelete.go @@ -201,6 +201,8 @@ func jobFor( jobOption.VolumeBackupDeleteNamespace, }, " ") + cmd = utils.CheckAndAddKopiaDebugModeAnnotationsCommand(cmd, jobOption) + kopiaExecutorImage, imageRegistrySecret, err := utils.GetExecutorImageAndSecret(drivers.KopiaExecutorImage, jobOption.KopiaImageExecutorSource, jobOption.KopiaImageExecutorSourceNs, diff --git a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiamaintenance/kopiamaintenance.go b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiamaintenance/kopiamaintenance.go index 8bb46e4d20..d8a6ddfc55 100644 --- a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiamaintenance/kopiamaintenance.go +++ b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiamaintenance/kopiamaintenance.go @@ -204,6 +204,8 @@ func jobFor( jobOption.MaintenanceType, }, " ") + cmd = utils.CheckAndAddKopiaDebugModeAnnotationsCommand(cmd, jobOption) + kopiaExecutorImage, imageRegistrySecret, err := utils.GetExecutorImageAndSecret(drivers.KopiaExecutorImage, jobOption.KopiaImageExecutorSource, jobOption.KopiaImageExecutorSourceNs, diff --git a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiarestore/kopiarestore.go b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiarestore/kopiarestore.go index ba0b7c7e30..43b6462993 100644 --- a/vendor/github.com/portworx/kdmp/pkg/drivers/kopiarestore/kopiarestore.go +++ b/vendor/github.com/portworx/kdmp/pkg/drivers/kopiarestore/kopiarestore.go @@ -206,6 +206,8 @@ func jobFor( vb.Status.SnapshotID, }, " ") + cmd = utils.CheckAndAddKopiaDebugModeAnnotationsCommand(cmd, jobOption) + kopiaExecutorImage, imageRegistrySecret, err := utils.GetExecutorImageAndSecret(drivers.KopiaExecutorImage, jobOption.KopiaImageExecutorSource, jobOption.KopiaImageExecutorSourceNs, @@ -369,7 +371,7 @@ func roleFor() *rbacv1.Role { }, { APIGroups: []string{"kdmp.portworx.com"}, - Resources: []string{"volumebackups"}, + Resources: []string{"volumebackups", "dataexports"}, Verbs: []string{rbacv1.VerbAll}, }, }, diff --git a/vendor/github.com/portworx/kdmp/pkg/drivers/options.go b/vendor/github.com/portworx/kdmp/pkg/drivers/options.go index 61d597c866..2cd3386799 100644 --- a/vendor/github.com/portworx/kdmp/pkg/drivers/options.go +++ b/vendor/github.com/portworx/kdmp/pkg/drivers/options.go @@ -19,6 +19,7 @@ type JobOpts struct { VolumeBackupName string VolumeBackupNamespace string VolumeBackupDeleteName string + KopiaDebugMode bool VolumeBackupDeleteNamespace string DataExportName string SnapshotID string @@ -395,6 +396,14 @@ func WithVolumeBackupDeleteName(name string) JobOption { } } +// WithKopiaDebugMode is job parameter +func WithKopiaDebugMode(debugMode bool) JobOption { + return func(opts *JobOpts) error { + opts.KopiaDebugMode = debugMode + return nil + } +} + // WithVolumeBackupDeleteNamespace is job parameter. func WithVolumeBackupDeleteNamespace(ns string) JobOption { return func(opts *JobOpts) error { diff --git a/vendor/github.com/portworx/kdmp/pkg/drivers/utils/utils.go b/vendor/github.com/portworx/kdmp/pkg/drivers/utils/utils.go index 170ab9efd3..f94e159b27 100644 --- a/vendor/github.com/portworx/kdmp/pkg/drivers/utils/utils.go +++ b/vendor/github.com/portworx/kdmp/pkg/drivers/utils/utils.go @@ -1,6 +1,7 @@ package utils import ( + "context" "errors" "fmt" "os" @@ -12,6 +13,7 @@ import ( storkapi "github.com/libopenstorage/stork/pkg/apis/stork/v1alpha1" "github.com/libopenstorage/stork/pkg/k8sutils" "github.com/portworx/kdmp/pkg/drivers" + kdmpops "github.com/portworx/kdmp/pkg/util/ops" "github.com/portworx/kdmp/pkg/version" "github.com/portworx/sched-ops/k8s/apps" "github.com/portworx/sched-ops/k8s/core" @@ -63,6 +65,8 @@ const ( PvcBoundSuccessMsg = "pvc bounded successfully" // PvcBoundFailedMsg pvc not bounded msg PvcBoundFailedMsg = "pvc not bounded" + // KopiaDebugModeEnabled - debug level log messages are enabled for kopia + KopiaDebugModeEnabled = "kopia-debug-mode" ) var ( @@ -876,3 +880,26 @@ func IsJobPodMountFailed(job *batchv1.Job, namespace string) bool { } return false } + +func IsKopiaDebugModeAnnotationsEnabled(jobOption drivers.JobOpts) bool { + dataExportCR, err := kdmpops.Instance().GetDataExport(context.Background(), jobOption.DataExportName, jobOption.Namespace) + if err != nil { + logrus.Tracef("error reading data export job: %v", err) + return false + } + + if _, ok := dataExportCR.Annotations[KopiaDebugModeEnabled]; ok { + logrus.Infof("annotation %v found in the data export CR.", KopiaDebugModeEnabled) + return true + } + return false +} + +func CheckAndAddKopiaDebugModeAnnotationsCommand(cmd string, jobOption drivers.JobOpts) string { + if IsKopiaDebugModeAnnotationsEnabled(jobOption) { + splitCmd := strings.Split(cmd, " ") + splitCmd = append(splitCmd, "--log-level", "debug") + cmd = strings.Join(splitCmd, " ") + } + return cmd +} diff --git a/vendor/kubevirt.io/client-go/kubecli/kubevirt_test_utils.go b/vendor/kubevirt.io/client-go/kubecli/kubevirt_test_utils.go index 3d01b19f95..0566827c29 100644 --- a/vendor/kubevirt.io/client-go/kubecli/kubevirt_test_utils.go +++ b/vendor/kubevirt.io/client-go/kubecli/kubevirt_test_utils.go @@ -1,5 +1,3 @@ -// +build skipcompile - package kubecli import (