diff --git a/.github/workflows/pr-ci-check.yml b/.github/workflows/pr-ci-check.yml index 4bcc28cee1..23f7a12f14 100644 --- a/.github/workflows/pr-ci-check.yml +++ b/.github/workflows/pr-ci-check.yml @@ -16,7 +16,7 @@ jobs: - name: Make ci run: make ci - name: Upload test coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.out diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a4d2371734..7b47b07773 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -47,7 +47,7 @@ jobs: - name: Test run: make test - name: Upload test coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.out @@ -68,24 +68,4 @@ jobs: # Build and push Velero image to docker registry docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} - VERSION=$(./hack/docker-push.sh | grep 'VERSION:' | awk -F: '{print $2}' | xargs) - - # Upload Velero image package to GCS - source hack/ci/build_util.sh - BIN=velero - RESTORE_HELPER_BIN=velero-restore-helper - GCS_BUCKET=velero-builds - VELERO_IMAGE=${BIN}-${VERSION} - VELERO_RESTORE_HELPER_IMAGE=${RESTORE_HELPER_BIN}-${VERSION} - VELERO_IMAGE_FILE=${VELERO_IMAGE}.tar.gz - VELERO_RESTORE_HELPER_IMAGE_FILE=${VELERO_RESTORE_HELPER_IMAGE}.tar.gz - VELERO_IMAGE_BACKUP_FILE=${VELERO_IMAGE}-'build.'${GITHUB_RUN_NUMBER}.tar.gz - VELERO_RESTORE_HELPER_IMAGE_BACKUP_FILE=${VELERO_RESTORE_HELPER_IMAGE}-'build.'${GITHUB_RUN_NUMBER}.tar.gz - - cp ${VELERO_IMAGE_FILE} ${VELERO_IMAGE_BACKUP_FILE} - cp ${VELERO_RESTORE_HELPER_IMAGE_FILE} ${VELERO_RESTORE_HELPER_IMAGE_BACKUP_FILE} - - uploader ${VELERO_IMAGE_FILE} ${GCS_BUCKET} - uploader ${VELERO_RESTORE_HELPER_IMAGE_FILE} ${GCS_BUCKET} - uploader ${VELERO_IMAGE_BACKUP_FILE} ${GCS_BUCKET} - uploader ${VELERO_RESTORE_HELPER_IMAGE_BACKUP_FILE} ${GCS_BUCKET} + ./hack/docker-push.sh diff --git a/Makefile b/Makefile index 9a5dd768ad..0efe55f846 100644 --- a/Makefile +++ b/Makefile @@ -239,12 +239,6 @@ container-windows: -f $(VELERO_DOCKERFILE) . @echo "container: $(IMAGE):$(VERSION)" -ifeq ($(BUILDX_OUTPUT_TYPE)_$(REGISTRY), registry_velero) - docker pull $(IMAGE):$(VERSION) - rm -f $(BIN)-$(VERSION).tar - docker save $(IMAGE):$(VERSION) -o $(BIN)-$(VERSION).tar - gzip -f $(BIN)-$(VERSION).tar -endif SKIP_TESTS ?= test: build-dirs diff --git a/changelogs/unreleased/8257-shubham-pampattiwar b/changelogs/unreleased/8257-shubham-pampattiwar new file mode 100644 index 0000000000..422943690f --- /dev/null +++ b/changelogs/unreleased/8257-shubham-pampattiwar @@ -0,0 +1 @@ +Add Backup warning for inclusion of NS managed by ArgoCD \ No newline at end of file diff --git a/hack/ci/build_util.sh b/hack/ci/build_util.sh deleted file mode 100644 index 599c84b638..0000000000 --- a/hack/ci/build_util.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -x - -set -e - -function uploader { - gsutil cp $1 gs://$2/$1 - gsutil -D setacl public-read gs://$2/$1 &> /dev/null -} diff --git a/pkg/backup/backup.go b/pkg/backup/backup.go index 0304e71ced..18a1f181e9 100644 --- a/pkg/backup/backup.go +++ b/pkg/backup/backup.go @@ -30,6 +30,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" + corev1api "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -71,6 +72,9 @@ const BackupVersion = 1 // BackupFormatVersion is the current backup version for Velero, including major, minor, and patch. const BackupFormatVersion = "1.1.0" +// ArgoCD managed by namespace label key +const ArgoCDManagedByNamespaceLabel = "argocd.argoproj.io/managed-by" + // Backupper performs backups. type Backupper interface { // Backup takes a backup using the specification in the velerov1api.Backup and writes backup and log data @@ -244,6 +248,18 @@ func (kb *kubernetesBackupper) BackupWithResolvers( log.Infof("Including namespaces: %s", backupRequest.NamespaceIncludesExcludes.IncludesString()) log.Infof("Excluding namespaces: %s", backupRequest.NamespaceIncludesExcludes.ExcludesString()) + // check if there are any namespaces included in the backup which are managed by argoCD + // We will check for the existence of a ArgoCD label in the includedNamespaces and add a warning + // so that users are at least aware about the existence of argoCD managed ns in their backup + // Related Issue: https://github.com/vmware-tanzu/velero/issues/7905 + if len(backupRequest.Spec.IncludedNamespaces) > 0 { + nsManagedByArgoCD := getNamespacesManagedByArgoCD(kb.kbClient, backupRequest.Spec.IncludedNamespaces, log) + + if len(nsManagedByArgoCD) > 0 { + log.Warnf("backup operation may encounter complications and potentially produce undesirable results due to the inclusion of namespaces %v managed by ArgoCD in the backup.", nsManagedByArgoCD) + } + } + if collections.UseOldResourceFilters(backupRequest.Spec) { backupRequest.ResourceIncludesExcludes = collections.GetGlobalResourceIncludesExcludes(kb.discoveryHelper, log, backupRequest.Spec.IncludedResources, @@ -1107,3 +1123,26 @@ func putVolumeInfos( return backupStore.PutBackupVolumeInfos(backupName, backupVolumeInfoBuf) } + +func getNamespacesManagedByArgoCD(kbClient kbclient.Client, includedNamespaces []string, log logrus.FieldLogger) []string { + var nsManagedByArgoCD []string + + for _, nsName := range includedNamespaces { + ns := corev1api.Namespace{} + if err := kbClient.Get(context.Background(), kbclient.ObjectKey{Name: nsName}, &ns); err != nil { + // check for only those ns that exist and are included in backup + // here we ignore cases like "" or "*" specified under includedNamespaces + if apierrors.IsNotFound(err) { + continue + } + log.WithError(err).Errorf("error getting namespace %s", nsName) + continue + } + + nsLabels := ns.GetLabels() + if len(nsLabels[ArgoCDManagedByNamespaceLabel]) > 0 { + nsManagedByArgoCD = append(nsManagedByArgoCD, nsName) + } + } + return nsManagedByArgoCD +} diff --git a/site/content/contributors/00-dave-smith-uchida.md b/site/content/contributors/00-dave-smith-uchida.md deleted file mode 100644 index 7f83b13ad8..0000000000 --- a/site/content/contributors/00-dave-smith-uchida.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -first_name: Dave -last_name: Smith-Uchida -image: /img/contributors/dave.png -github_handle: dsu-igeek ---- -Architect - diff --git a/site/content/contributors/05-abigil-mccarthy.md b/site/content/contributors/05-abigil-mccarthy.md deleted file mode 100644 index 578fcbec8c..0000000000 --- a/site/content/contributors/05-abigil-mccarthy.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -first_name: Abigail -last_name: McCarthy -image: /img/contributors/abigail-mccarthy.png -github_handle: a-mccarthy ---- -Technical Writer diff --git a/site/content/contributors/05-orlin-vasilev.md b/site/content/contributors/05-orlin-vasilev.md deleted file mode 100644 index c57a4c2d22..0000000000 --- a/site/content/contributors/05-orlin-vasilev.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -first_name: Orlin -last_name: Vasilev -image: /img/contributors/orlin-vasilev.png -github_handle: OrlinVasilev ---- -Community Manager diff --git a/site/static/img/contributors/abigail-mccarthy.png b/site/static/img/contributors/abigail-mccarthy.png deleted file mode 100644 index f71c386220..0000000000 Binary files a/site/static/img/contributors/abigail-mccarthy.png and /dev/null differ diff --git a/site/static/img/contributors/ashish-amarnath.png b/site/static/img/contributors/ashish-amarnath.png deleted file mode 100644 index d2072e5fa6..0000000000 Binary files a/site/static/img/contributors/ashish-amarnath.png and /dev/null differ diff --git a/site/static/img/contributors/dave.png b/site/static/img/contributors/dave.png deleted file mode 100644 index 4396c104ea..0000000000 Binary files a/site/static/img/contributors/dave.png and /dev/null differ diff --git a/site/static/img/contributors/eleanor-millman.jpg b/site/static/img/contributors/eleanor-millman.jpg deleted file mode 100644 index 335e1020dd..0000000000 Binary files a/site/static/img/contributors/eleanor-millman.jpg and /dev/null differ diff --git a/site/static/img/contributors/michael-michael.png b/site/static/img/contributors/michael-michael.png deleted file mode 100644 index fb8f296f6a..0000000000 Binary files a/site/static/img/contributors/michael-michael.png and /dev/null differ diff --git a/site/static/img/contributors/nolan-brubaker.png b/site/static/img/contributors/nolan-brubaker.png deleted file mode 100644 index 0e1761f0fc..0000000000 Binary files a/site/static/img/contributors/nolan-brubaker.png and /dev/null differ diff --git a/site/static/img/contributors/orlin-vasilev.png b/site/static/img/contributors/orlin-vasilev.png deleted file mode 100644 index aebd63cb60..0000000000 Binary files a/site/static/img/contributors/orlin-vasilev.png and /dev/null differ diff --git a/site/static/img/contributors/tim-hinderliter.png b/site/static/img/contributors/tim-hinderliter.png deleted file mode 100644 index b934817eb0..0000000000 Binary files a/site/static/img/contributors/tim-hinderliter.png and /dev/null differ diff --git a/site/static/img/contributors/tom-spoonemore.png b/site/static/img/contributors/tom-spoonemore.png deleted file mode 100644 index 0dd9b7cc9d..0000000000 Binary files a/site/static/img/contributors/tom-spoonemore.png and /dev/null differ