From 32888e88fa91da4d181a5c380157962758a2002c Mon Sep 17 00:00:00 2001 From: Drew Walters Date: Wed, 19 Jun 2019 14:38:05 +0000 Subject: [PATCH] sonobuoy: Support storing results on host Currently, results are stored using an emptyDir volume. This change adds support for storing results using a customizable hostPath. When storing results in a hostPath, results can still be obtained form the hostPath while result publishing is disabled. Change-Id: Ibd01da23a8e74a54f500429cf0ba8ca72f2ac77d --- sonobuoy/templates/bin/_publish_results.sh.tpl | 5 +++++ sonobuoy/templates/pod-api.yaml | 10 ++++++++-- sonobuoy/values.yaml | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sonobuoy/templates/bin/_publish_results.sh.tpl b/sonobuoy/templates/bin/_publish_results.sh.tpl index d23dc1be..c46a8231 100644 --- a/sonobuoy/templates/bin/_publish_results.sh.tpl +++ b/sonobuoy/templates/bin/_publish_results.sh.tpl @@ -32,3 +32,8 @@ openstack object create --name $prefixed_file_name {{ .Values.conf.swift.contain openstack object show {{ .Values.conf.swift.container_name }} $prefixed_file_name swift post {{ .Values.conf.swift.container_name }} $prefixed_file_name -H \"X-Delete-After:{{ .Values.conf.swift.delete_objects_after_seconds }}\" + +# NOTE(aw442m): Delete results after publishing to avoid collisions when using host path +if [[ ! -z "${RESULTS_DIR}" ]]; then + rm "${RESULTS_DIR}"/"${file_name}" +fi diff --git a/sonobuoy/templates/pod-api.yaml b/sonobuoy/templates/pod-api.yaml index 768d6e30..6a24cdd7 100644 --- a/sonobuoy/templates/pod-api.yaml +++ b/sonobuoy/templates/pod-api.yaml @@ -122,6 +122,12 @@ spec: name: sonobuoy-plugins defaultMode: 0444 name: sonobuoy-plugins-volume - - emptyDir: {} - name: sonobuoy-output + - name: sonobuoy-output +{{- if .Values.conf.host_results_path }} + hostPath: + path: {{ .Values.conf.host_results_path }} + type: DirectoryOrCreate +{{- else }} + emptyDir: {} +{{- end }} {{- end }} diff --git a/sonobuoy/values.yaml b/sonobuoy/values.yaml index c2697aef..656c4ed2 100644 --- a/sonobuoy/values.yaml +++ b/sonobuoy/values.yaml @@ -107,6 +107,8 @@ manifests: conf: publish_results: true + # NOTE: use to store results on host; disabled by default. + host_results_path: null # Injected values root used by (some of) the plugins. This `plugin_values` # root is the parent for a mapping of named sections, each of which will be # added as a file in the plugin-values secret.