Skip to content

Commit

Permalink
Merge branch 'main' into issue-fix-7535
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyndon-Li committed May 6, 2024
2 parents 0a5c6db + 4d48273 commit 55f47c8
Show file tree
Hide file tree
Showing 43 changed files with 216 additions and 276 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-linter-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v5
with:
version: v1.57.2
args: --out-format=colored-line-number
3 changes: 0 additions & 3 deletions pkg/cmd/cli/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ func NewInstallOptions() *Options {
DefaultSnapshotMoveData: false,
DisableInformerCache: false,
ScheduleSkipImmediately: false,
MaintenanceCfg: repository.MaintenanceConfig{
KeepLatestMaitenanceJobs: repository.DefaultKeepLatestMaitenanceJobs,
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/backup_repository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (r *BackupRepoReconciler) SetupWithManager(mgr ctrl.Manager) error {
s := kube.NewPeriodicalEnqueueSource(r.logger, mgr.GetClient(), &velerov1api.BackupRepositoryList{}, repoSyncPeriod, kube.PeriodicalEnqueueSourceOption{})

return ctrl.NewControllerManagedBy(mgr).
For(&velerov1api.BackupRepository{}).
For(&velerov1api.BackupRepository{}, builder.WithPredicates(kube.SpecChangePredicate{})).
WatchesRawSource(s, nil).
Watches(&velerov1api.BackupStorageLocation{}, kube.EnqueueRequestsFromMapUpdateFunc(r.invalidateBackupReposForBSL),
builder.WithPredicates(
Expand Down
2 changes: 1 addition & 1 deletion site/content/community/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ You can follow the work we do, see our milestones, and our backlog on our [GitHu
Bi-weekly community meeting alternating every week between Beijing Friendly timezone and EST/Europe Friendly Timezone
* Beijing/US friendly - we start at 8am Beijing Time(bound to CST) / 8pm EDT(7pm EST) / 5pm PDT(4pm PST) / 2am CEST(1am CET) - [Convert to your time zone](https://dateful.com/convert/beijing-china?t=8am)
* US/Europe friendly - we start at 10am ET(bound to ET) / 7am PT / 3pm CET / 10pm(11pm) CST - [Convert to your time zone](https://dateful.com/convert/est-edt-eastern-time?t=10)
* Read and comment on the [meeting notes](https://hackmd.io/Jq6F5zqZR7S80CeDWUklkA?view)
* Read and comment on the [meeting notes](https://hackmd.io/bxrvgewUQ5ORH10BKUFpxw)
* See previous community meetings on our [YouTube Channel](https://www.youtube.com/playlist?list=PL7bmigfV0EqQRysvqvqOtRNk4L5S7uqwM)
* Have a question to discuss in the community meeting? Please add it to our [Q&A Discussion board](https://github.com/vmware-tanzu/velero/discussions/categories/community-support-q-a)
2 changes: 2 additions & 0 deletions site/content/docs/main/api-types/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ metadata:
namespace: velero
# Parameters about the scheduled backup. Required.
spec:
# Paused specifies whether the schedule is paused or not
paused: false
# Schedule is a Cron expression defining when to run the Backup
schedule: 0 7 * * *
# Specifies whether to use OwnerReferences on backups created by this Schedule.
Expand Down
2 changes: 2 additions & 0 deletions site/content/docs/v1.10/api-types/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ metadata:
namespace: velero
# Parameters about the scheduled backup. Required.
spec:
# Paused specifies whether the schedule is paused or not
paused: false
# Schedule is a Cron expression defining when to run the Backup
schedule: 0 7 * * *
# Specifies whether to use OwnerReferences on backups created by this Schedule.
Expand Down
2 changes: 2 additions & 0 deletions site/content/docs/v1.11/api-types/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ metadata:
namespace: velero
# Parameters about the scheduled backup. Required.
spec:
# Paused specifies whether the schedule is paused or not
paused: false
# Schedule is a Cron expression defining when to run the Backup
schedule: 0 7 * * *
# Specifies whether to use OwnerReferences on backups created by this Schedule.
Expand Down
2 changes: 2 additions & 0 deletions site/content/docs/v1.12/api-types/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ metadata:
namespace: velero
# Parameters about the scheduled backup. Required.
spec:
# Paused specifies whether the schedule is paused or not
paused: false
# Schedule is a Cron expression defining when to run the Backup
schedule: 0 7 * * *
# Specifies whether to use OwnerReferences on backups created by this Schedule.
Expand Down
2 changes: 2 additions & 0 deletions site/content/docs/v1.13/api-types/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ metadata:
namespace: velero
# Parameters about the scheduled backup. Required.
spec:
# Paused specifies whether the schedule is paused or not
paused: false
# Schedule is a Cron expression defining when to run the Backup
schedule: 0 7 * * *
# Specifies whether to use OwnerReferences on backups created by this Schedule.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/backups/ttl.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TTLTest() {
fmt.Sprintf("Failed to delete namespace %s", BackupCfg.BackupName))
})

if veleroCfg.CloudProvider == Aws && useVolumeSnapshots {
if veleroCfg.CloudProvider == AWS && useVolumeSnapshots {
fmt.Println("Waiting 7 minutes to make sure the snapshots are ready...")
time.Sleep(7 * time.Minute)
}
Expand Down
42 changes: 20 additions & 22 deletions test/e2e/basic/backup-volume-info/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package basic

import (
"context"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -45,26 +44,6 @@ type BackupVolumeInfo struct {

func (v *BackupVolumeInfo) Init() error {
v.TestCase.Init()

BeforeEach(func() {
if v.VeleroCfg.CloudProvider == Vsphere && (!strings.Contains(v.CaseBaseName, "fs-upload") && !strings.Contains(v.CaseBaseName, "skipped")) {
fmt.Printf("Skip snapshot case %s for vsphere environment.\n", v.CaseBaseName)
Skip("Skip snapshot case due to vsphere environment doesn't cover the CSI test, and it doesn't have a Velero native snapshot plugin.")
}

if strings.Contains(v.VeleroCfg.Features, FeatureCSI) {
if strings.Contains(v.CaseBaseName, "native-snapshot") {
fmt.Printf("Skip native snapshot case %s when the CSI feature is enabled.\n", v.CaseBaseName)
Skip("Skip native snapshot case due to CSI feature is enabled.")
}
} else {
if strings.Contains(v.CaseBaseName, "csi") {
fmt.Printf("Skip CSI related case %s when the CSI feature is not enabled.\n", v.CaseBaseName)
Skip("Skip CSI cases due to CSI feature is not enabled.")
}
}
})

v.CaseBaseName = v.CaseBaseName + v.UUIDgen
v.BackupName = "backup-" + v.CaseBaseName
v.RestoreName = "restore-" + v.CaseBaseName
Expand Down Expand Up @@ -98,8 +77,27 @@ func (v *BackupVolumeInfo) Init() error {
return nil
}

func (v *BackupVolumeInfo) Start() error {
if v.VeleroCfg.CloudProvider == Vsphere && (!strings.Contains(v.CaseBaseName, "fs-upload") && !strings.Contains(v.CaseBaseName, "skipped")) {
fmt.Printf("Skip snapshot case %s for vsphere environment.\n", v.CaseBaseName)
Skip("Skip snapshot case due to vsphere environment doesn't cover the CSI test, and it doesn't have a Velero native snapshot plugin.")
}

if strings.Contains(v.VeleroCfg.Features, FeatureCSI) {
if strings.Contains(v.CaseBaseName, "native-snapshot") {
fmt.Printf("Skip native snapshot case %s when the CSI feature is enabled.\n", v.CaseBaseName)
Skip("Skip native snapshot case due to CSI feature is enabled.")
}
} else {
if strings.Contains(v.CaseBaseName, "csi") {
fmt.Printf("Skip CSI related case %s when the CSI feature is not enabled.\n", v.CaseBaseName)
Skip("Skip CSI cases due to CSI feature is not enabled.")
}
}
v.TestCase.Start()
return nil
}
func (v *BackupVolumeInfo) CreateResources() error {
v.Ctx, v.CtxCancel = context.WithTimeout(context.Background(), v.TimeoutDuration)
labels := map[string]string{
"volume-info": "true",
}
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/basic/backup-volume-info/native_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ var NativeSnapshotVolumeInfoTest func() = TestFunc(&NativeSnapshotVolumeInfo{
BackupVolumeInfo{
SnapshotVolumes: true,
TestCase: TestCase{
CaseBaseName: "native-snapshot-volumeinfo",
UseVolumeSnapshots: true,
CaseBaseName: "native-snapshot-volumeinfo",
TestMsg: &TestMSG{
Desc: "Test backup's VolumeInfo metadata content for native snapshot case.",
Text: "The VolumeInfo should be generated, and the NativeSnapshotInfo structure should not be nil.",
Expand All @@ -54,7 +55,7 @@ func (n *NativeSnapshotVolumeInfo) Verify() error {
BackupObjectsPrefix+"/"+n.BackupName,
)

Expect(err).ShouldNot(HaveOccurred(), fmt.Sprintf("Fail to get VolumeInfo metadata in the Backup Repository."))
Expect(err).ShouldNot(HaveOccurred(), "Fail to get VolumeInfo metadata in the Backup Repository.")

fmt.Printf("The VolumeInfo metadata content: %+v\n", *volumeInfo[0])
Expect(len(volumeInfo) > 0).To(BeIdenticalTo(true))
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/basic/namespace-mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -86,7 +85,6 @@ func (n *NamespaceMapping) Init() error {
}

func (n *NamespaceMapping) CreateResources() error {
n.Ctx, n.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)
for index, ns := range *n.NSIncluded {
n.kibishiiData.Levels = len(*n.NSIncluded) + index
By(fmt.Sprintf("Creating namespaces ...%s\n", ns), func() {
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/basic/nodeport.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -61,9 +60,8 @@ func (n *NodePort) Init() error {
}
return nil
}
func (n *NodePort) CreateResources() error {
n.Ctx, n.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)

func (n *NodePort) CreateResources() error {
for _, ns := range *n.NSIncluded {
By(fmt.Sprintf("Creating service %s in namespaces %s ......\n", n.serviceName, ns), func() {
Expect(CreateNamespace(n.Ctx, n.Client, ns)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns))
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/basic/pvc-selected-node-changing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package basic
import (
"context"
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -64,7 +63,6 @@ func (p *PVCSelectedNodeChanging) Init() error {
}

func (p *PVCSelectedNodeChanging) CreateResources() error {
p.Ctx, p.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)
By(fmt.Sprintf("Create namespace %s", p.namespace), func() {
Expect(CreateNamespace(p.Ctx, p.Client, p.namespace)).To(Succeed(),
fmt.Sprintf("Failed to create namespace %s", p.namespace))
Expand Down
1 change: 0 additions & 1 deletion test/e2e/basic/resources-check/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func (m *MultiNSBackup) Init() error {
}

func (m *MultiNSBackup) CreateResources() error {
m.Ctx, m.CtxCancel = context.WithTimeout(context.Background(), m.TimeoutDuration)
fmt.Printf("Creating namespaces ...\n")
labels := map[string]string{
"ns-test": "true",
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/basic/resources-check/namespaces_annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ limitations under the License.
package basic

import (
"context"
"fmt"
"strings"
"time"

"github.com/pkg/errors"

Expand Down Expand Up @@ -63,7 +61,6 @@ func (n *NSAnnotationCase) Init() error {
}

func (n *NSAnnotationCase) CreateResources() error {
n.Ctx, n.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)
for nsNum := 0; nsNum < n.NamespacesTotal; nsNum++ {
createNSName := fmt.Sprintf("%s-%00000d", n.CaseBaseName, nsNum)
createAnnotationName := fmt.Sprintf("annotation-%s-%00000d", n.CaseBaseName, nsNum)
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/basic/resources-check/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ limitations under the License.
package basic

import (
"context"
"fmt"
"strings"
"time"

"github.com/pkg/errors"

Expand Down Expand Up @@ -79,7 +77,6 @@ func (r *RBACCase) Init() error {
}

func (r *RBACCase) CreateResources() error {
r.Ctx, r.CtxCancel = context.WithTimeout(context.Background(), 10*time.Minute)
for nsNum := 0; nsNum < r.NamespacesTotal; nsNum++ {
createNSName := fmt.Sprintf("%s-%00000d", r.CaseBaseName, nsNum)
fmt.Printf("Creating namespaces ...%s\n", createNSName)
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/basic/storage-class-changing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package basic
import (
"context"
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -67,11 +66,11 @@ func (s *StorageClasssChanging) Init() error {
}
return nil
}

func (s *StorageClasssChanging) CreateResources() error {
label := map[string]string{
"app": "test",
}
s.Ctx, s.CtxCancel = context.WithTimeout(context.Background(), 10*time.Minute)

By(("Installing storage class..."), func() {
Expect(InstallTestStorageClasses(fmt.Sprintf("../testdata/storage-class/%s.yaml", s.VeleroCfg.CloudProvider))).To(Succeed(), "Failed to install storage class")
Expand Down
Loading

0 comments on commit 55f47c8

Please sign in to comment.