Skip to content

Commit

Permalink
[ADD] Add new fucntion for test pod annotation
Browse files Browse the repository at this point in the history
[FIX] Fix helm chart of minio (The address of helm.min.io changed to charts.min.io) and values of chart has been change

Signed-off-by: Pooya Azarpour <pooya_azarpour@yahoo.com>
  • Loading branch information
poyaz committed Dec 11, 2023
1 parent a91c902 commit 7767f61
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
35 changes: 35 additions & 0 deletions e2e/definitions/annotated-subject/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: v1
kind: Pod
metadata:
name: subject-pod
namespace: k8up-e2e-subject
annotations:
k8up.io/backupcommand: '/tmp/test.sh'
k8up.io/file-extension: '.txt'
k8up.io/backupcommand-container: subject-container
spec:
containers:
- image: busybox
name: dummy-container-blocking-first-position
command:
- "/bin/sh"
- "-c"
- "sleep infinity"
- name: subject-container
image: quay.io/prometheus/busybox:latest
imagePullPolicy: IfNotPresent
args:
- sh
- -c
- |
printf '#!/bin/sh\nsleep 30s\necho %s\n' "$BACKUP_FILE_CONTENT" | tee /tmp/test.sh && chmod a+x /tmp/test.sh && \
echo && \
echo "sleeping now" && \
sleep infinity
securityContext:
runAsUser: $ID
env:
- name: BACKUP_FILE_CONTENT
value: ""
- name: BACKUP_FILE_NAME
value: ""
7 changes: 5 additions & 2 deletions e2e/definitions/minio/helm.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
accessKey: myaccesskey
secretKey: mysecretkey
users:
- accessKey: myaccesskey
secretKey: mysecretkey
policy: consoleAdmin
replicas: 1
mode: standalone
resources:
requests:
memory: 250M
Expand Down
13 changes: 12 additions & 1 deletion e2e/lib/k8up.bash
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ given_an_annotated_subject() {
echo "✅ The annotated subject is ready"
}

given_an_annotated_subject_pod() {
require_args 2 ${#}

export BACKUP_FILE_NAME=${1}
export BACKUP_FILE_CONTENT=${2}

yq e '.spec.containers[1].securityContext.runAsUser='$(id -u)' | .spec.containers[1].env[0].value=strenv(BACKUP_FILE_CONTENT) | .spec.containers[1].env[1].value=strenv(BACKUP_FILE_NAME)' definitions/annotated-subject/pod.yaml | kubectl apply -f -

echo "✅ The annotated subject pod is ready"
}

given_a_rwo_pvc_subject_in_worker_node() {
require_args 2 ${#}

Expand All @@ -159,7 +170,7 @@ given_a_rwo_pvc_subject_in_controlplane_node() {
given_s3_storage() {
# Speed this step up
(helm -n "${MINIO_NAMESPACE}" list | grep minio > /dev/null) && return
helm repo add minio https://helm.min.io/ --force-update
helm repo add minio https://charts.min.io/ --force-update
helm repo update
helm upgrade --install minio \
--values definitions/minio/helm.yaml \
Expand Down

0 comments on commit 7767f61

Please sign in to comment.