-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1027 from k8up-io/fix/false-positive-backups
Fail if the backup command in the annotation exits != 0
- Loading branch information
Showing
10 changed files
with
116 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: annotated-subject-deployment | ||
namespace: k8up-e2e-subject | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: subject | ||
template: | ||
metadata: | ||
labels: | ||
app: subject | ||
annotations: | ||
k8up.io/backupcommand: 'invalid' | ||
k8up.io/backupcommand-container: subject-container | ||
spec: | ||
containers: | ||
- image: busybox | ||
imagePullPolicy: IfNotPresent | ||
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 | ||
- | | ||
sleep infinity | ||
securityContext: | ||
runAsUser: $ID | ||
volumeMounts: | ||
- name: volume | ||
mountPath: /data | ||
env: | ||
- name: BACKUP_FILE_CONTENT | ||
value: "" | ||
- name: BACKUP_FILE_NAME | ||
value: "" | ||
volumes: | ||
- name: volume | ||
persistentVolumeClaim: | ||
claimName: subject-pvc |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ k8up: | |
envVars: | ||
- name: K8UP_DEBUG | ||
value: "true" | ||
- name: BACKUP_GLOBAL_BACKOFF_LIMIT | ||
value: "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bats | ||
|
||
load "lib/utils" | ||
load "lib/detik" | ||
load "lib/k8up" | ||
|
||
# shellcheck disable=SC2034 | ||
DETIK_CLIENT_NAME="kubectl" | ||
# shellcheck disable=SC2034 | ||
DETIK_CLIENT_NAMESPACE="k8up-e2e-subject" | ||
# shellcheck disable=SC2034 | ||
DEBUG_DETIK="true" | ||
|
||
@test "Annotated app, When creating a backup, Then expect Error" { | ||
expected_content="expected content: $(timestamp)" | ||
expected_filename="expected_filename.txt" | ||
|
||
given_a_running_operator | ||
given_a_clean_ns | ||
given_s3_storage | ||
given_a_broken_annotated_subject "${expected_filename}" "${expected_content}" | ||
|
||
kubectl apply -f definitions/secrets | ||
yq e '.spec.podSecurityContext.runAsUser='$(id -u)'' definitions/backup/backup.yaml | kubectl apply -f - | ||
|
||
try "at most 10 times every 5s to get backup named 'k8up-backup' and verify that '.status.started' is 'true'" | ||
verify_object_value_by_label job 'k8up.io/owned-by=backup_k8up-backup' '.status.active' 1 true | ||
|
||
wait_for_until_jsonpath backup/k8up-backup 2m 'jsonpath={.status.conditions[?(@.type=="Completed")].reason}=Failed' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/k8up-io/k8up/v2 | ||
|
||
go 1.21 | ||
go 1.23 | ||
|
||
require ( | ||
github.com/firepear/qsplit/v2 v2.5.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters