Skip to content

fix: upgrade template #1703

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ VERSION ?= $(DEFAULT_VERSION)
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
CHANNELS = "stable"
CHANNELS = "dev"
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
Expand All @@ -21,7 +21,7 @@ endif
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
DEFAULT_CHANNEL = "stable"
DEFAULT_CHANNEL = "dev"
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
Expand Down Expand Up @@ -450,9 +450,9 @@ undeploy-olm: login-required operator-sdk ## Uninstall current branch operator v
$(OPERATOR_SDK) cleanup oadp-operator --namespace $(OADP_TEST_NAMESPACE)

# A valid Git branch from https://github.com/openshift/oadp-operator
PREVIOUS_CHANNEL ?= oadp-1.4
PREVIOUS_CHANNEL ?= oadp-1.5
# Go version in go.mod in that branch
PREVIOUS_CHANNEL_GO_VERSION ?= 1.22
PREVIOUS_CHANNEL_GO_VERSION ?= 1.23

.PHONY: catalog-test-upgrade
catalog-test-upgrade: PREVIOUS_OPERATOR_IMAGE?=ttl.sh/oadp-operator-previous-$(GIT_REV):1h
Expand Down
4 changes: 2 additions & 2 deletions build/Dockerfile.bundle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=oadp-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.bundle.channels.v1=dev
LABEL operators.operatorframework.io.bundle.channel.default.v1=dev
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.34.2
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4
Expand Down
4 changes: 2 additions & 2 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=oadp-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.bundle.channels.v1=dev
LABEL operators.operatorframework.io.bundle.channel.default.v1=dev
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.34.2
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4
Expand Down
4 changes: 2 additions & 2 deletions bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ annotations:
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: oadp-operator
operators.operatorframework.io.bundle.channels.v1: stable
operators.operatorframework.io.bundle.channel.default.v1: stable
operators.operatorframework.io.bundle.channels.v1: dev
operators.operatorframework.io.bundle.channel.default.v1: dev
operators.operatorframework.io.metrics.builder: operator-sdk-v1.34.2
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v4
Expand Down
66 changes: 6 additions & 60 deletions tests/e2e/upgrade_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package e2e_test

import (
"context"
"fmt"
"log"
"time"

Expand All @@ -14,7 +13,6 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

oadpv1alpha1 "github.com/openshift/oadp-operator/api/v1alpha1"
Expand Down Expand Up @@ -89,11 +87,6 @@ var _ = ginkgo.Describe("OADP upgrade scenarios", ginkgo.Ordered, func() {
LogLevel: "debug",
DefaultPlugins: dpaCR.VeleroDefaultPlugins,
},
Restic: &oadpv1alpha1.ResticConfig{
NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{
Enable: ptr.To(true),
},
},
},
BackupLocations: []oadpv1alpha1.BackupLocation{
{
Expand Down Expand Up @@ -128,9 +121,7 @@ var _ = ginkgo.Describe("OADP upgrade scenarios", ginkgo.Ordered, func() {
log.Print("Checking if Velero Pod is running")
gomega.Eventually(lib.VeleroPodIsRunning(kubernetesClientForSuiteRun, namespace), time.Minute*3, time.Second*5).Should(gomega.BeTrue())

// check that NodeAgent Pods are running
log.Printf("Checking if Node Agent Pods are running")
gomega.Eventually(lib.AreNodeAgentPodsRunning(kubernetesClientForSuiteRun, namespace), time.Minute*3, time.Second*5).Should(gomega.BeTrue())
// TODO check NodeAgent Pod if using restic or kopia

// check if BSL is available
log.Print("Checking if BSL is available")
Expand All @@ -142,7 +133,7 @@ var _ = ginkgo.Describe("OADP upgrade scenarios", ginkgo.Ordered, func() {

// TODO backup/restore

// Update spec.channel in Subscription to stable
// Update spec.channel in Subscription to dev
log.Print("Updating Subscription oadp-operator spec.channel")
err = runTimeClientForSuiteRun.Get(context.Background(), types.NamespacedName{Namespace: subscription.Namespace, Name: subscription.Name}, &subscription)
gomega.Expect(err).To(gomega.BeNil())
Expand All @@ -161,21 +152,6 @@ var _ = ginkgo.Describe("OADP upgrade scenarios", ginkgo.Ordered, func() {
// check DPA after controller-manager Pod is running
gomega.Eventually(lib.ManagerPodIsUp(kubernetesClientForSuiteRun, namespace), time.Minute*8, time.Second*15).Should(gomega.BeTrue())

// check if updated DPA is reconciled
log.Print("Checking if DPA was reconciled after update")
gomega.Eventually(dpaCR.IsReconciledFalse("Delete restic object from spec.configuration, use spec.configuration.nodeAgent instead"), time.Minute*3, time.Second*5).Should(gomega.BeTrue())

log.Print("Updating DPA")
dpaSpec.Configuration.Restic = nil
dpaSpec.Configuration.NodeAgent = &oadpv1alpha1.NodeAgentConfig{
UploaderType: "restic",
NodeAgentCommonFields: oadpv1alpha1.NodeAgentCommonFields{
Enable: ptr.To(true),
},
}
err = dpaCR.CreateOrUpdate(dpaSpec)
gomega.Expect(err).To(gomega.BeNil())

// check if updated DPA is reconciled
log.Print("Checking if DPA was reconciled after update")
// TODO do not use Consistently, using because no field in DPA is updated telling when it was last reconciled
Expand All @@ -189,37 +165,7 @@ var _ = ginkgo.Describe("OADP upgrade scenarios", ginkgo.Ordered, func() {

timeAfterVeleroIsRunning := time.Now()

// check if updated NodeAgent Pods are running
log.Print("Checking if Node Agent Pods were recreated after update")
gomega.Eventually(func() (bool, error) {
nodeAgentDaemonSet, err := lib.GetNodeAgentDaemonSet(kubernetesClientForSuiteRun, namespace)
if err != nil {
return false, err
}

numScheduled := nodeAgentDaemonSet.Status.CurrentNumberScheduled
numDesired := nodeAgentDaemonSet.Status.DesiredNumberScheduled
// check correct number of NodeAgent Pods are initialized
if numScheduled != numDesired {
return false, fmt.Errorf("wrong number of Node Agent Pods")
}

podList, err := lib.GetAllPodsWithLabel(kubernetesClientForSuiteRun, namespace, "name=node-agent")
if err != nil {
return false, err
}
if err != nil {
return false, err
}
for _, pod := range podList.Items {
if !pod.CreationTimestamp.After(timeAfterUpgrade) {
return false, fmt.Errorf("not all Node Agent Pods were updated")
}
}
return true, nil
}, time.Minute*3, time.Second*5).Should(gomega.BeTrue())
log.Printf("Checking if Node Agent Pods are running")
gomega.Eventually(lib.AreNodeAgentPodsRunning(kubernetesClientForSuiteRun, namespace), time.Minute*3, time.Second*5).Should(gomega.BeTrue())
// TODO check NodeAgent Pod if using restic or kopia

// check if updated BSL is available
log.Print("Checking if BSL was reconciled after update")
Expand All @@ -233,9 +179,9 @@ var _ = ginkgo.Describe("OADP upgrade scenarios", ginkgo.Ordered, func() {

// TODO backup/restore
},
ginkgo.Entry("Upgrade from stable-1.4 (oadp-1.4 branch) to stable (master branch) channel", ginkgo.Label("upgrade"), channelUpgradeCase{
previous: "stable-1.4",
next: "stable",
ginkgo.Entry("Upgrade from stable (oadp-1.5 branch) to dev (master branch) channel", ginkgo.Label("upgrade"), channelUpgradeCase{
previous: "stable",
next: "dev",
// to test production
// production: true,
}),
Expand Down