-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Cleanup logs in minikube VM after running k8s tests
Signed-off-by: Aaron Wilson <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: "${JOB_NAME}" | ||
spec: | ||
ttlSecondsAfterFinished: 0 | ||
template: | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- minikube | ||
containers: | ||
- name: delete-files | ||
image: busybox | ||
command: ["sh", "-c", "if [ -d ${HOST_PATH} ]; then rm -rf ${HOST_PATH}; fi"] | ||
volumeMounts: | ||
- name: host-volume | ||
mountPath: "${PARENT_DIR}" | ||
restartPolicy: Never | ||
volumes: | ||
- name: host-volume | ||
hostPath: | ||
path: "${PARENT_DIR}" |
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,4 +1,11 @@ | ||
# Kill all pods and services created by ci job and ignore errors | ||
kubectl delete pods -l app=ais,type=ais-target || true | ||
kubectl delete pods -l app=ais,type=ais-proxy || true | ||
kubectl delete svc -l app=ais || true | ||
kubectl delete svc -l app=ais || true | ||
|
||
# Use a cleanup job to delete any AIS files mounted with hostpath inside the minikube vm | ||
export PARENT_DIR="/tmp" | ||
export HOST_PATH="/tmp/ais" | ||
export JOB_NAME="test-cleanup" | ||
envsubst < kube_templates/cleanup_job_template.yml > cleanup_job.yml | ||
kubectl apply -f cleanup_job.yml |