Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmware-main to konveyor-dev #80

Merged
merged 36 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f17df00
delete unused shcema package and parms. (#6716)
Sep 4, 2023
3b3e56c
Add anshulahuja98 maintainer details (#6737)
anshulahuja98 Sep 4, 2023
269933d
Add license notes for velero-helper.
Aug 31, 2023
894b7ed
fix issue 6753 (#6757)
Lyndon-Li Sep 5, 2023
dc8b52f
fix issue 6647
Lyndon-Li Aug 28, 2023
b2b7cf5
Update restore controller logic for restore deletion
ywk253100 Sep 5, 2023
c4f2731
Fix #6752: add namespace exclude check.
Sep 5, 2023
885958e
add csi snapshot data mover doc (#6637)
Lyndon-Li Sep 8, 2023
0bbfe29
code clean for repository (#6768)
Sep 12, 2023
0fa314e
Keep the logs info ns/name is the same with other modules.
Sep 6, 2023
4fcf585
Fix some wrong logs and code clean.
Sep 8, 2023
58c1e96
check pod status before hook (#5211)
cleverhu Sep 13, 2023
9a7870d
issue 6786:always delete VSC regardless of the deletion policy
Lyndon-Li Sep 13, 2023
b248121
Typo: remove double space
AgustinRamiroDiaz Sep 13, 2023
e64fb74
Fix some typos about the docs.
Sep 13, 2023
ebba802
Handle 1.27 k8s job label changes
kaovilai Aug 28, 2023
a36cab7
changelog
kaovilai Aug 28, 2023
d54962d
Remove legacy label version check, to be added back when version is k…
kaovilai Aug 28, 2023
5b9bfa3
bump kopia to v0.14 (#6833)
Lyndon-Li Sep 18, 2023
5fa185b
Make Kopia support Azure AD
ywk253100 Jun 19, 2023
75af9b3
Support setting CA cert for BSL
ywk253100 Sep 6, 2023
a59cfd0
Fix the metrics backup_last_status not report right value when the sc…
Sep 19, 2023
8ea22cd
Add some description of update existing policy to state it works in a…
blackpiglet Sep 22, 2023
77e7657
Remove schedule-related metrics on schedule delete
nilesh-akhade Aug 1, 2023
bca9097
Move Dave Smith-Uchida to Emeritus Maintainer
Sep 26, 2023
ef9892b
issue: move plugin depdending podvolume functions to util pkg
Lyndon-Li Sep 26, 2023
9171a97
Add 'orLabelSelector' for backup, restore command
nilesh-akhade Jul 7, 2023
0169376
issue 6861: fill repoIdentifier only for restic repo (#6872)
Lyndon-Li Sep 27, 2023
f954a34
issue 6880: set ParallelUploadAboveSize as MaxInt64
Lyndon-Li Sep 28, 2023
b8e5342
fix CI out of disk space problem
Lyndon-Li Sep 28, 2023
3736a9a
Create the backup repository only when it doesn't exist
ywk253100 Sep 28, 2023
710db0a
Add go clean in Dockerfile and action.
Sep 28, 2023
ad4a937
Add support for block volumes (#6680)
dzaninovic Sep 28, 2023
e11f737
Replace the base image with paketobuildpacks image (#6883)
ywk253100 Sep 29, 2023
8cfda14
Code clean for backup cmd client. (#6750)
Sep 29, 2023
5f20a79
Document pod volume host path setting for Nutanix. (#6902)
draghuram Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/auto-assignees.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ reviewers:
- qiuming-best
- shubham-pampattiwar
- Lyndon-Li
- anshulahuja98

tech-writer:
- sseago
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ jobs:
version: latest

- name: Build
run: make local
run: |
make local
# Clean go cache to ease the build environment storage pressure.
go clean -modcache -cache

- name: Test
run: make test
Expand All @@ -73,7 +76,7 @@ jobs:
run: |
sudo swapoff -a
sudo rm -f /mnt/swapfile
docker image prune -a --force
docker system prune -a --force

# Build and push Velero image to docker registry
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ RUN mkdir -p /output/usr/bin && \
go build -o /output/${BIN} \
-ldflags "${LDFLAGS}" ${PKG}/cmd/${BIN} && \
go build -o /output/velero-helper \
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper && \
go clean -modcache -cache

# Restic binary build section
FROM --platform=$BUILDPLATFORM golang:1.20.7-bullseye as restic-builder
Expand All @@ -65,16 +66,17 @@ COPY . /go/src/github.com/vmware-tanzu/velero

RUN mkdir -p /output/usr/bin && \
export GOARM=$(echo "${GOARM}" | cut -c2-) && \
/go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh
/go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh && \
go clean -modcache -cache

# Velero image packing section
FROM gcr.io/distroless/base-nossl-debian11@sha256:f10e1fbf558c630a4b74a987e6c754d45bf59f9ddcefce090f6b111925996767
FROM paketobuildpacks/run-jammy-tiny:latest

LABEL maintainer="Xun Jiang <[email protected]>"

COPY --from=velero-builder /output /

COPY --from=restic-builder /output /

USER nonroot:nonroot
USER cnb:cnb

24 changes: 12 additions & 12 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

## Maintainers

| Maintainer | GitHub ID | Affiliation |
|---------------------|---------------------------------------------------------------|-------------------------------------------|
| Dave Smith-Uchida | [dsu-igeek](https://github.com/dsu-igeek) | [Kasten](https://github.com/kastenhq/) |
| Scott Seago | [sseago](https://github.com/sseago) | [OpenShift](https://github.com/openshift) |
| Daniel Jiang | [reasonerjt](https://github.com/reasonerjt) | [VMware](https://www.github.com/vmware/) |
| Wenkai Yin | [ywk253100](https://github.com/ywk253100) | [VMware](https://www.github.com/vmware/) |
| Xun Jiang | [blackpiglet](https://github.com/blackpiglet) | [VMware](https://www.github.com/vmware/) |
| Ming Qiu | [qiuming-best](https://github.com/qiuming-best) | [VMware](https://www.github.com/vmware/) |
| Shubham Pampattiwar | [shubham-pampattiwar](https://github.com/shubham-pampattiwar) | [OpenShift](https://github.com/openshift) |
| Yonghui Li | [Lyndon-Li](https://github.com/Lyndon-Li) | [VMware](https://www.github.com/vmware/) |
| Maintainer | GitHub ID | Affiliation |
|---------------------|---------------------------------------------------------------|--------------------------------------------------|
| Scott Seago | [sseago](https://github.com/sseago) | [OpenShift](https://github.com/openshift) |
| Daniel Jiang | [reasonerjt](https://github.com/reasonerjt) | [VMware](https://www.github.com/vmware/) |
| Wenkai Yin | [ywk253100](https://github.com/ywk253100) | [VMware](https://www.github.com/vmware/) |
| Xun Jiang | [blackpiglet](https://github.com/blackpiglet) | [VMware](https://www.github.com/vmware/) |
| Ming Qiu | [qiuming-best](https://github.com/qiuming-best) | [VMware](https://www.github.com/vmware/) |
| Shubham Pampattiwar | [shubham-pampattiwar](https://github.com/shubham-pampattiwar) | [OpenShift](https://github.com/openshift) |
| Yonghui Li | [Lyndon-Li](https://github.com/Lyndon-Li) | [VMware](https://www.github.com/vmware/) |
| Anshul Ahuja | [anshulahuja98](https://github.com/anshulahuja98) | [Microsoft Azure](https://www.github.com/azure/) |

## Emeritus Maintainers
* Adnan Abdulhussein ([prydonius](https://github.com/prydonius))
Expand All @@ -25,12 +25,12 @@
* Carlisia Thompson ([carlisia](https://github.com/carlisia))
* Bridget McErlean ([zubron](https://github.com/zubron))
* JenTing Hsiao ([jenting](https://github.com/jenting))

* Dave Smith-Uchida ([dsu-igeek](https://github.com/dsu-igeek))

## Velero Contributors & Stakeholders

| Feature Area | Lead |
|------------------------|:------------------------------------------------------------------------------------:|
| Architect | Dave Smith-Uchida [dsu-igeek](https://github.com/dsu-igeek) |
| Technical Lead | Daniel Jiang [reasonerjt](https://github.com/reasonerjt) |
| Kubernetes CSI Liaison | |
| Deployment | |
Expand Down
1 change: 1 addition & 0 deletions changelogs/unreleased/5211-cleverhu
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix run preHook and postHook on completed pods
1 change: 1 addition & 0 deletions changelogs/unreleased/6475-nilesh-akhade
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `orLabelSelectors` for backup, restore commands
1 change: 1 addition & 0 deletions changelogs/unreleased/6637-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add CSI snapshot data movement doc
1 change: 1 addition & 0 deletions changelogs/unreleased/6680-dzaninovic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for block volumes with Kopia
1 change: 1 addition & 0 deletions changelogs/unreleased/6686-ywk253100
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make Kopia support Azure AD
1 change: 1 addition & 0 deletions changelogs/unreleased/6712-kaovilai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Kubernetes 1.27 new job label batch.kubernetes.io/controller-uid are deleted during restore per https://github.com/kubernetes/kubernetes/pull/114930
1 change: 1 addition & 0 deletions changelogs/unreleased/6715-nilesh-akhade
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove schedule-related metrics on schedule delete
1 change: 1 addition & 0 deletions changelogs/unreleased/6751-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #6647, add the --default-snapshot-move-data parameter to Velero install, so that users don't need to specify --snapshot-move-data per backup when they want to move snapshot data for all backups
1 change: 1 addition & 0 deletions changelogs/unreleased/6757-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #6753, remove the check for read-only BSL in restore async operation controller since Velero cannot fully support read-only mode BSL in restore at present
1 change: 1 addition & 0 deletions changelogs/unreleased/6760-blackpiglet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix #6752: add namespace exclude check.
1 change: 1 addition & 0 deletions changelogs/unreleased/6770-ywk253100
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update restore controller logic for restore deletion
1 change: 1 addition & 0 deletions changelogs/unreleased/6827-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #6786, always delete VSC regardless of the deletion policy
1 change: 1 addition & 0 deletions changelogs/unreleased/6833-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump kopia to v0.14
1 change: 1 addition & 0 deletions changelogs/unreleased/6838-yanggangtony
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
change the metrics backup_attempt_total default value to 1.
1 change: 1 addition & 0 deletions changelogs/unreleased/6872-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix #6861. Only Restic path requires repoIdentifier, so for non-restic path, set the repoIdentifier fields as empty in PVB and PVR and also remove the RepoIdentifier column in the get output of PVBs and PVRs
1 change: 1 addition & 0 deletions changelogs/unreleased/6875-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #6859, move plugin depending podvolume functions to util pkg, so as to remove the dependencies to unnecessary repository packages like kopia, azure, etc.
1 change: 1 addition & 0 deletions changelogs/unreleased/6883-ywk253100
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace the base image with paketobuildpacks image
1 change: 1 addition & 0 deletions changelogs/unreleased/6885-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set ParallelUploadAboveSize as MaxInt64 and flush repo after setting up policy so that policy is retrieved correctly by TreeForSource
16 changes: 16 additions & 0 deletions cmd/velero-helper/velero-helper.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright The Velero 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 main

import (
Expand Down
4 changes: 0 additions & 4 deletions config/crd/v1/bases/velero.io_podvolumebackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ spec:
jsonPath: .spec.volume
name: Volume
type: string
- description: Backup repository identifier for this backup
jsonPath: .spec.repoIdentifier
name: Repository ID
type: string
- description: The type of the uploader to handle data transfer
jsonPath: .spec.uploaderType
name: Uploader Type
Expand Down
2 changes: 1 addition & 1 deletion config/crd/v1/crds/crds.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions design/CLI/PoC/overlays/plugins/node-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ spec:
- mountPath: /host_pods
mountPropagation: HostToContainer
name: host-pods
- mountPath: /var/lib/kubelet/plugins
mountPropagation: HostToContainer
name: host-plugins
- mountPath: /scratch
name: scratch
- mountPath: /credentials
Expand All @@ -60,6 +63,9 @@ spec:
- hostPath:
path: /var/lib/kubelet/pods
name: host-pods
- hostPath:
path: /var/lib/kubelet/plugins
name: host-plugins
- emptyDir: {}
name: scratch
- name: cloud-credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,33 +703,38 @@ type Provider interface {
In this case, we will extend the default kopia uploader to add the ability, when a given volume is for a block mode and is mapped as a device, we will use the [StreamingFile](https://pkg.go.dev/github.com/kopia/[email protected]/fs#StreamingFile) to stream the device and backup to the kopia repository.

```go
func getLocalBlockEntry(kopiaEntry fs.Entry, log logrus.FieldLogger) (fs.Entry, error) {
path := kopiaEntry.LocalFilesystemPath()
func getLocalBlockEntry(sourcePath string) (fs.Entry, error) {
source, err := resolveSymlink(sourcePath)
if err != nil {
return nil, errors.Wrap(err, "resolveSymlink")
}

fileInfo, err := os.Lstat(path)
fileInfo, err := os.Lstat(source)
if err != nil {
return nil, errors.Wrapf(err, "Unable to get the source device information %s", path)
return nil, errors.Wrapf(err, "unable to get the source device information %s", source)
}

if (fileInfo.Sys().(*syscall.Stat_t).Mode & syscall.S_IFMT) != syscall.S_IFBLK {
return nil, errors.Errorf("Source path %s is not a block device", path)
return nil, errors.Errorf("source path %s is not a block device", source)
}
device, err := os.Open(path)

device, err := os.Open(source)
if err != nil {
if os.IsPermission(err) || err.Error() == ErrNotPermitted {
return nil, errors.Wrapf(err, "No permission to open the source device %s, make sure that node agent is running in privileged mode", path)
return nil, errors.Wrapf(err, "no permission to open the source device %s, make sure that node agent is running in privileged mode", source)
}
return nil, errors.Wrapf(err, "Unable to open the source device %s", path)
return nil, errors.Wrapf(err, "unable to open the source device %s", source)
}
return virtualfs.StreamingFileFromReader(kopiaEntry.Name(), device), nil

sf := virtualfs.StreamingFileFromReader(source, device)
return virtualfs.NewStaticDirectory(source, []fs.Entry{sf}), nil
}
```

In the `pkg/uploader/kopia/snapshot.go` this is used in the Backup call like

```go
if volMode == PersistentVolumeFilesystem {
if volMode == uploader.PersistentVolumeFilesystem {
// to be consistent with restic when backup empty dir returns one error for upper logic handle
dirs, err := os.ReadDir(source)
if err != nil {
Expand All @@ -742,15 +747,17 @@ In the `pkg/uploader/kopia/snapshot.go` this is used in the Backup call like
source = filepath.Clean(source)
...

sourceEntry, err := getLocalFSEntry(source)
if err != nil {
return nil, false, errors.Wrap(err, "Unable to get local filesystem entry")
}
var sourceEntry fs.Entry

if volMode == PersistentVolumeBlock {
sourceEntry, err = getLocalBlockEntry(sourceEntry, log)
if volMode == uploader.PersistentVolumeBlock {
sourceEntry, err = getLocalBlockEntry(source)
if err != nil {
return nil, false, errors.Wrap(err, "unable to get local block device entry")
}
} else {
sourceEntry, err = getLocalFSEntry(source)
if err != nil {
return nil, false, errors.Wrap(err, "Unable to get local block device entry")
return nil, false, errors.Wrap(err, "unable to get local filesystem entry")
}
}

Expand All @@ -766,37 +773,24 @@ We only need to extend two functions the rest will be passed through.
```go
type BlockOutput struct {
*restore.FilesystemOutput

targetFileName string
}

var _ restore.Output = &BlockOutput{}

const bufferSize = 128 * 1024

func (o *BlockOutput) WriteFile(ctx context.Context, relativePath string, remoteFile fs.File) error {

targetFileName, err := filepath.EvalSymlinks(o.TargetPath)
if err != nil {
return errors.Wrapf(err, "Unable to evaluate symlinks for %s", targetFileName)
}

fileInfo, err := os.Lstat(targetFileName)
if err != nil {
return errors.Wrapf(err, "Unable to get the target device information for %s", targetFileName)
}

if (fileInfo.Sys().(*syscall.Stat_t).Mode & syscall.S_IFMT) != syscall.S_IFBLK {
return errors.Errorf("Target file %s is not a block device", targetFileName)
}

remoteReader, err := remoteFile.Open(ctx)
if err != nil {
return errors.Wrapf(err, "Failed to open remote file %s", remoteFile.Name())
return errors.Wrapf(err, "failed to open remote file %s", remoteFile.Name())
}
defer remoteReader.Close()

targetFile, err := os.Create(targetFileName)
targetFile, err := os.Create(o.targetFileName)
if err != nil {
return errors.Wrapf(err, "Failed to open file %s", targetFileName)
return errors.Wrapf(err, "failed to open file %s", o.targetFileName)
}
defer targetFile.Close()

Expand All @@ -807,7 +801,7 @@ func (o *BlockOutput) WriteFile(ctx context.Context, relativePath string, remote
bytesToWrite, err := remoteReader.Read(buffer)
if err != nil {
if err != io.EOF {
return errors.Wrapf(err, "Failed to read data from remote file %s", targetFileName)
return errors.Wrapf(err, "failed to read data from remote file %s", o.targetFileName)
}
readData = false
}
Expand All @@ -819,7 +813,7 @@ func (o *BlockOutput) WriteFile(ctx context.Context, relativePath string, remote
bytesToWrite -= bytesWritten
offset += bytesWritten
} else {
return errors.Wrapf(err, "Failed to write data to file %s", targetFileName)
return errors.Wrapf(err, "failed to write data to file %s", o.targetFileName)
}
}
}
Expand All @@ -829,42 +823,43 @@ func (o *BlockOutput) WriteFile(ctx context.Context, relativePath string, remote
}

func (o *BlockOutput) BeginDirectory(ctx context.Context, relativePath string, e fs.Directory) error {
targetFileName, err := filepath.EvalSymlinks(o.TargetPath)
var err error
o.targetFileName, err = filepath.EvalSymlinks(o.TargetPath)
if err != nil {
return errors.Wrapf(err, "Unable to evaluate symlinks for %s", targetFileName)
return errors.Wrapf(err, "unable to evaluate symlinks for %s", o.targetFileName)
}

fileInfo, err := os.Lstat(targetFileName)
fileInfo, err := os.Lstat(o.targetFileName)
if err != nil {
return errors.Wrapf(err, "Unable to get the target device information for %s", o.TargetPath)
return errors.Wrapf(err, "unable to get the target device information for %s", o.TargetPath)
}

if (fileInfo.Sys().(*syscall.Stat_t).Mode & syscall.S_IFMT) != syscall.S_IFBLK {
return errors.Errorf("Target file %s is not a block device", o.TargetPath)
return errors.Errorf("target file %s is not a block device", o.TargetPath)
}

return nil
}
```

Of note, we do need to add root access to the daemon set node agent to access the new mount.
Additional mount is required in the node-agent specification to resolve symlinks to the block devices from /host_pods/POD_ID/volumeDevices/kubernetes.io~csi directory.

```yaml
...
- mountPath: /var/lib/kubelet/plugins
mountPropagation: HostToContainer
name: host-plugins

....
- hostPath:
path: /var/lib/kubelet/plugins
name: host-plugins
```

Privileged mode is required to access the block devices in /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/publish directory as confirmed by testing on EKS and Minikube.

...
```yaml
SecurityContext: &corev1.SecurityContext{
Privileged: &c.privilegedAgent,
Privileged: &c.privilegedNodeAgent,
},

```

## Plugin Data Movers
Expand Down
Loading
Loading