Skip to content

Commit

Permalink
Add velero self test
Browse files Browse the repository at this point in the history
Work in progress:

- backup succeeds, and files are stored in the bucket.

- restore complete successfully - but has warning:

    Warnings:
      Velero:     <none>
      Cluster:    <none>
      Namespaces:
        nginx-example:  could not restore, Endpoints "my-nginx" already
        exists. Warning: the in-cluster version is different than the
        backed-up version.

After the restore, the nginx-deployment is missing:

    $ kubectl get all -n nginx-example
    NAME                                    READY   STATUS    RESTARTS   AGE
    pod/nginx-deployment-7c89967545-n2fdb   1/1     Running   0          2m40s
    pod/nginx-deployment-7c89967545-nmznz   1/1     Running   0          2m40s

    NAME               TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
    service/my-nginx   LoadBalancer   10.103.20.188   <pending>     80:32439/TCP   2m40s

    NAME                                          DESIRED   CURRENT   READY   AGE
    replicaset.apps/nginx-deployment-7c89967545   2         2         2       2m40s

- Need to detect and log the warning after the restore. I could not find
  away to get the restore name programmatically for querying the
  restore.

- Need to cleanup up after the test - delete the deployment and the
  backup.

- Code for using velero is too complicated for a test, I think we need a
  simple `drenv.velero` helper.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Jun 1, 2023
1 parent 41319fa commit 681c3fb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/addons/velero/credentials.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default]
aws_access_key_id = minio
aws_secret_access_key = minio123
48 changes: 48 additions & 0 deletions test/addons/velero/nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# SPDX-FileCopyrightText: 2017 the Velero contributors
# SPDX-License-Identifier: Apache-2.0

---
apiVersion: v1
kind: Namespace
metadata:
name: nginx-example
labels:
app: nginx

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: nginx-example
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx:1.17.6
name: nginx
ports:
- containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx
name: my-nginx
namespace: nginx-example
spec:
ports:
- port: 80
targetPort: 80
selector:
app: nginx
type: LoadBalancer

0 comments on commit 681c3fb

Please sign in to comment.