Skip to content
Merged
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
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ else ifeq ($(CLUSTER_TYPE), azure4)
OADP_BUCKET_FILE = ${OADP_CRED_DIR}/azure-velero-bucket-name
endif

VELERO_PLUGIN ?= ${CLUSTER_TYPE}

ifeq ($(CLUSTER_TYPE), ibmcloud)
VELERO_PLUGIN ?= aws
endif

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.21

Expand Down Expand Up @@ -343,15 +349,17 @@ catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

OADP_BUCKET = $(shell cat $(OADP_BUCKET_FILE))
TEST_FILTER := $(shell echo '! aws && ! gcp && ! azure' | sed -r "s/[&]* [!] $(CLUSTER_TYPE)|[!] $(CLUSTER_TYPE) [&]*//")
TEST_FILTER := ($(shell echo '! aws && ! gcp && ! azure && ! ibmcloud' | \
sed -r "s/[&]* [!] $(CLUSTER_TYPE)|[!] $(CLUSTER_TYPE) [&]*//")) || $(CLUSTER_TYPE)
#TEST_FILTER := $(shell echo '! aws && ! gcp && ! azure' | sed -r "s/[&]* [!] $(CLUSTER_TYPE)|[!] $(CLUSTER_TYPE) [&]*//")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit.. probably can remove this :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove the commented line, but i think we can keep the test_filter as we can use it to run cloud specific tests in future.

SETTINGS_TMP=/tmp/test-settings

test-e2e-setup:
mkdir -p $(SETTINGS_TMP)
TARGET_CI_CRED_FILE="$(CI_CRED_FILE)" AZURE_RESOURCE_FILE="$(AZURE_RESOURCE_FILE)" CI_JSON_CRED_FILE="$(AZURE_CI_JSON_CRED_FILE)" \
OADP_JSON_CRED_FILE="$(AZURE_OADP_JSON_CRED_FILE)" OADP_CRED_FILE="$(OADP_CRED_FILE)" OPENSHIFT_CI="$(OPENSHIFT_CI)" \
PROVIDER="$(CLUSTER_TYPE)" BUCKET="$(OADP_BUCKET)" BSL_REGION="$(BSL_REGION)" SECRET="$(CREDS_SECRET_REF)" TMP_DIR=$(SETTINGS_TMP) \
VSL_REGION="$(VSL_REGION)" BSL_AWS_PROFILE="$(BSL_AWS_PROFILE)" BSL_REGION="$(BSL_REGION)" /bin/bash "tests/e2e/scripts/$(CLUSTER_TYPE)_settings.sh"
PROVIDER="$(VELERO_PLUGIN)" BUCKET="$(OADP_BUCKET)" BSL_REGION="$(BSL_REGION)" SECRET="$(CREDS_SECRET_REF)" TMP_DIR=$(SETTINGS_TMP) \
VSL_REGION="$(VSL_REGION)" BSL_AWS_PROFILE="$(BSL_AWS_PROFILE)" /bin/bash "tests/e2e/scripts/$(CLUSTER_TYPE)_settings.sh"

test-e2e: test-e2e-setup
ginkgo run -mod=mod tests/e2e/ -- -credentials=$(OADP_CRED_FILE) \
Expand Down
16 changes: 10 additions & 6 deletions tests/e2e/backup_restore_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ var _ = Describe("AWS backup restore tests", func() {
Eventually(AreResticPodsRunning(namespace), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue())
}
if brCase.BackupRestoreType == CSI {
log.Printf("Creating VolumeSnapshotClass for CSI backuprestore of %s", brCase.Name)
err = InstallApplication(dpaCR.Client, "./sample-applications/gp2-csi/volumeSnapshotClass.yaml")
Expect(err).ToNot(HaveOccurred())
if provider == "aws" || provider == "ibmcloud" {
log.Printf("Creating VolumeSnapshotClass for CSI backuprestore of %s", brCase.Name)
snapshotClassPath := fmt.Sprintf("./sample-applications/snapclass-csi/%s.yaml", provider)
err = InstallApplication(dpaCR.Client, snapshotClassPath)
Expect(err).ToNot(HaveOccurred())
}
}

if dpaCR.CustomResource.BackupImages() {
Expand Down Expand Up @@ -229,13 +232,14 @@ var _ = Describe("AWS backup restore tests", func() {

if brCase.BackupRestoreType == CSI {
log.Printf("Deleting VolumeSnapshot for CSI backuprestore of %s", brCase.Name)
err = UninstallApplication(dpaCR.Client, "./sample-applications/gp2-csi/volumeSnapshotClass.yaml")
snapshotClassPath := fmt.Sprintf("./sample-applications/snapclass-csi/%s.yaml", provider)
err = UninstallApplication(dpaCR.Client, snapshotClassPath)
Expect(err).ToNot(HaveOccurred())
}

},
Entry("MySQL application CSI", Label("aws"), BackupRestoreCase{
ApplicationTemplate: "./sample-applications/mysql-persistent/mysql-persistent-csi-template.yaml",
Entry("MySQL application CSI", Label("ibmcloud", "aws"), BackupRestoreCase{
ApplicationTemplate: fmt.Sprintf("./sample-applications/mysql-persistent/mysql-persistent-csi-%s-template.yaml", provider),
ApplicationNamespace: "mysql-persistent",
Name: "mysql-e2e",
BackupRestoreType: CSI,
Expand Down
10 changes: 4 additions & 6 deletions tests/e2e/dpa_deployment_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() {
}

awsTests := []TableEntry{
Entry("AWS Without Region No S3ForcePathStyle with BackupImages false should succeed", InstallCase{
Entry("AWS Without Region No S3ForcePathStyle with BackupImages false should succeed", Label("aws"), InstallCase{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather see this label added in a for loop instead since that's the whole point of a separate awsTests declaration. But I am aware this is not possible right now.
onsi/ginkgo#974 might allow this in the future.

Name: "default-no-region-no-s3forcepathstyle",
BRestoreType: RESTIC,
DpaSpec: &oadpv1alpha1.DataProtectionApplicationSpec{
Expand Down Expand Up @@ -412,7 +412,7 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() {
},
WantError: false,
}, nil),
Entry("AWS With Region And S3ForcePathStyle should succeed", InstallCase{
Entry("AWS With Region And S3ForcePathStyle should succeed", Label("aws"), InstallCase{
Name: "default-with-region-and-s3forcepathstyle",
BRestoreType: RESTIC,
DpaSpec: &oadpv1alpha1.DataProtectionApplicationSpec{
Expand Down Expand Up @@ -447,7 +447,7 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() {
},
WantError: false,
}, nil),
Entry("AWS Without Region And S3ForcePathStyle true should fail", InstallCase{
Entry("AWS Without Region And S3ForcePathStyle true should fail", Label("aws"), InstallCase{
Name: "default-with-region-and-s3forcepathstyle",
BRestoreType: RESTIC,
DpaSpec: &oadpv1alpha1.DataProtectionApplicationSpec{
Expand Down Expand Up @@ -481,10 +481,8 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() {
WantError: true,
}, fmt.Errorf("region for AWS backupstoragelocation cannot be empty when s3ForcePathStyle is true or when backing up images")),
}
genericTests = append(genericTests, awsTests...)

if provider == "aws" {
genericTests = append(genericTests, awsTests...)
}
var lastInstallingApplicationNamespace string
var lastInstallTime time.Time
var _ = ReportAfterEach(func(report SpecReport) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ items:
spec:
containers:
- name: todolist
image: quay.io/rhn_engineering_whayutin/todolist-mariadb-go:latest
image: quay.io/mferrato/todolist-mariadb-go:v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's happening here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wesley's image is amd64 only. I made a PR to the mig-demo-app repo konveyor/mig-demo-apps#74 to add the code enabling multiarch builds for the mariadb-based app. We discused that with @weshayutin as a temporary solution until we have a place to store the multiarch manifest. But I'd rather store it somewhere else, if you know of a better place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.. I've just opened an issue on OADP to better describe what needs to be done here and why. #666

Pretty crazy re: the issue #
7c0696e0-5c7b-48dc-a500-69be86939db9 e6557d1ec7732d827674187696a95a86

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So konveyor quay org would be one

env:
- name: foo
value: bar
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
apiVersion: v1
kind: List
items:
- kind: Namespace
apiVersion: v1
metadata:
name: mysql-persistent
labels:
app: mysql
- apiVersion: v1
kind: ServiceAccount
metadata:
name: mysql-persistent-sa
namespace: mysql-persistent
labels:
component: mysql-persistent
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql
namespace: mysql-persistent
labels:
app: mysql
spec:
accessModes:
- ReadWriteOnce
storageClassName: ocs-storagecluster-cephfs
resources:
requests:
storage: 1Gi
- kind: SecurityContextConstraints
apiVersion: security.openshift.io/v1
metadata:
name: mysql-persistent-scc
allowPrivilegeEscalation: true
allowPrivilegedContainer: true
runAsUser:
type: RunAsAny
seLinuxContext:
type: RunAsAny
fsGroup:
type: RunAsAny
supplementalGroups:
type: RunAsAny
volumes:
- '*'
users:
- system:admin
- system:serviceaccount:mysql-persistent:mysql-persistent-sa
- apiVersion: v1
kind: Service
metadata:
annotations:
template.openshift.io/expose-uri: mariadb://{.spec.clusterIP}:{.spec.ports[?(.name=="mysql")].port}
name: mysql
namespace: mysql-persistent
labels:
app: mysql
service: mysql
spec:
ports:
- protocol: TCP
name: mysql
port: 3306
selector:
app: mysql
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
template.alpha.openshift.io/wait-for-ready: 'true'
name: mysql
namespace: mysql-persistent
labels:
e2e-app: "true"
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
e2e-app: "true"
app: mysql
spec:
serviceAccountName: mysql-persistent-sa
containers:
- image: registry.redhat.io/rhel8/mariadb-105:latest
name: mysql
securityContext:
privileged: true
env:
- name: MYSQL_USER
value: changeme
- name: MYSQL_PASSWORD
value: changeme
- name: MYSQL_ROOT_PASSWORD
value: root
- name: MYSQL_DATABASE
value: todolist
ports:
- containerPort: 3306
name: mysql
resources:
limits:
memory: 512Mi
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
volumes:
- name: mysql-data
persistentVolumeClaim:
claimName: mysql
- apiVersion: v1
kind: Service
metadata:
name: todolist
namespace: mysql-persistent
labels:
app: todolist
service: todolist
e2e-app: "true"
spec:
ports:
- name: web
port: 8000
targetPort: 8000
selector:
app: todolist
service: todolist
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: todolist
namespace: mysql-persistent
labels:
app: todolist
service: todolist
e2e-app: "true"
spec:
replicas: 1
selector:
app: todolist
service: todolist
strategy:
type: Recreate
template:
metadata:
labels:
app: todolist
service: todolist
e2e-app: "true"
spec:
containers:
- name: todolist
image: quay.io/mferrato/todolist-mariadb-go:v1
env:
- name: foo
value: bar
ports:
- containerPort: 8000
protocol: TCP
initContainers:
- name: init-myservice
image: registry.access.redhat.com/ubi8/ubi:latest
command: ['sh', '-c', 'sleep 10; until getent hosts mysql; do echo waiting for mysql; sleep 5; done;']
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: todolist-route
namespace: mysql-persistent
spec:
path: "/"
to:
kind: Service
name: todolist
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ items:
spec:
containers:
- name: todolist
image: quay.io/rhn_engineering_whayutin/todolist-mariadb-go:latest
image: quay.io/mferrato/todolist-mariadb-go:v1
env:
- name: foo
value: bar
Expand Down
13 changes: 13 additions & 0 deletions tests/e2e/sample-applications/snapclass-csi/aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: List
items:
- apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: oadp-example-snapclass
labels:
velero.io/csi-volumesnapshot-class: 'true'
annotations:
snapshot.storage.kubernetes.io/is-default-class: 'true'
driver: ebs.csi.aws.com
deletionPolicy: Retain
17 changes: 17 additions & 0 deletions tests/e2e/sample-applications/snapclass-csi/ibmcloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: List
items:
- apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: oadp-example-snapclass
labels:
velero.io/csi-volumesnapshot-class: 'true'
annotations:
snapshot.storage.kubernetes.io/is-default-class: 'true'
driver: openshift-storage.cephfs.csi.ceph.com
deletionPolicy: Retain
parameters:
clusterID: openshift-storage
csi.storage.k8s.io/snapshotter-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/snapshotter-secret-namespace: openshift-storage
37 changes: 37 additions & 0 deletions tests/e2e/scripts/ibmcloud_settings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

cat > $TMP_DIR/oadpcreds <<EOF
{
"spec": {
"configuration":{
"velero":{
"defaultPlugins": [
"openshift", "$PROVIDER"
]
}
},
"backupLocations": [
{
"velero": {
"provider": "$PROVIDER",
"config": {
"profile": "$BSL_AWS_PROFILE",
"region": "$BSL_REGION",
"s3ForcePathStyle": "true",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mathieu-Ferraton @kaovilai Wont this set s3ForcePathStyle for all the SPECs that are running ? I think we explicitly set these in some tests and remove in some tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deepakraj1997 You're right, but I think these are aws specific tests, which we want to skip for ibmcloud clusters (this can be discussed further though). If we use IBM COS bucket as BSL with ibmcloud/powerVS clusters, then we need to keep this to true, or fork an ibmcloud plugin out of the aws one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deepakraj1997 This is fine. It would apply to all specs within the ibmcloud which have to use aws plugin via the s3ForcePathStyle to work.

"s3Url": "https://s3.$BSL_REGION.cloud-object-storage.appdomain.cloud"
},
"objectStorage":{
"bucket": "$BUCKET"
}
}
}
],
"credential":{
"name": "$SECRET",
"key": "cloud"
}
}
}
EOF

x=$(cat $TMP_DIR/oadpcreds); echo "$x" | grep -o '^[^#]*' > $TMP_DIR/oadpcreds