From 692522dec078b85ebf8dc705daee8f9a0fdba6bc Mon Sep 17 00:00:00 2001 From: John Schnake Date: Thu, 12 May 2022 16:46:38 -0500 Subject: [PATCH] Only apply imagePullPolicy to plugins if instructed (#1705) Adds a new option which allows the user to specify whether or not to apply the imagePullPolicy to all plugins and override their stated values. This is important since even the default value was overwriting explicit values in the plugins leading to confusing behavior. Techinically a breaking change for someone who was running sonobuoy CLI with the --image-pull-policy flag to overwrite explicit values. They will now need to add the --force-image-pull-policy flag to obtain the same behavior. This makes all modifications to plugins explicit via some option rather than this one being implicit. Fixes #1652 Signed-off-by: John Schnake --- cmd/sonobuoy/app/args.go | 14 +- cmd/sonobuoy/app/gen.go | 1 + pkg/client/gen.go | 7 +- pkg/client/gen_test.go | 11 +- ...regatorpermissions-noncluster-admin.golden | 2 - .../default-plugins-via-nil-selection.golden | 2 - .../default-plugins-via-selection.golden | 2 - pkg/client/testdata/default-pod-spec.golden | 2 - pkg/client/testdata/default.golden | 2 - pkg/client/testdata/e2e-default.golden | 2 - .../testdata/e2e-progress-custom-port.golden | 1 - .../e2e-progress-vs-user-defined.golden | 1 - pkg/client/testdata/e2e-progress.golden | 1 - pkg/client/testdata/envoverrides.golden | 1 - pkg/client/testdata/goRunnerRemoved.golden | 1 - .../imagePullPolicy-all-plugins.golden | 2 +- .../imagePullPolicy-not-all-plugins.golden | 147 +++++++++++++++ pkg/client/testdata/imagePullSecrets.golden | 1 - .../manual-custom-plugin-plus-e2e.golden | 2 - .../manual-custom-plugin-plus-systemd.golden | 2 - .../testdata/manual-custom-plugin.golden | 1 - pkg/client/testdata/manual-e2e.golden | 1 - .../testdata/multiple-node-selector.golden | 2 - pkg/client/testdata/plugin-configmaps.golden | 2 - .../plugins-and-pluginSelection.golden | 2 - .../testdata/single-node-selector.golden | 2 - .../testdata/systemd-logs-default.golden | 2 - .../testdata/use-existing-pod-spec.golden | 1 - pkg/config/config.go | 1 + test/integration/sonobuoy_integration_test.go | 8 + .../gen-imagePullPolicy-forced.golden | 169 ++++++++++++++++++ .../testdata/gen-imagePullPolicy.golden | 169 ++++++++++++++++++ .../testdata/gen-issue-1528.golden | 3 +- .../testdata/gen-plugin-renaming.golden | 2 - .../testdata/gen-rerunfailed-missing.golden | 3 +- .../gen-rerunfailed-no-failures.golden | 3 +- .../gen-rerunfailed-not-tarball.golden | 3 +- .../testdata/gen-variable-image.golden | 2 - test/integration/testdata/plugin-list.golden | 6 + .../testdata/plugin-loading-installed.golden | 1 - .../testdata/plugin-loading-local.golden | 1 - .../plugins/good/setImagePullPolicy.yaml | 12 ++ 42 files changed, 544 insertions(+), 56 deletions(-) create mode 100644 pkg/client/testdata/imagePullPolicy-not-all-plugins.golden create mode 100644 test/integration/testdata/gen-imagePullPolicy-forced.golden create mode 100644 test/integration/testdata/gen-imagePullPolicy.golden create mode 100644 test/integration/testdata/plugins/good/setImagePullPolicy.yaml diff --git a/cmd/sonobuoy/app/args.go b/cmd/sonobuoy/app/args.go index fff864475..8e1d7ec86 100644 --- a/cmd/sonobuoy/app/args.go +++ b/cmd/sonobuoy/app/args.go @@ -37,6 +37,7 @@ const ( namespaceFlag = "namespace" sonobuoyImageFlag = "sonobuoy-image" imagePullPolicyFlag = "image-pull-policy" + forceImagePullPolicyFlag = "force-image-pull-policy" pluginFlag = "plugin" timeoutFlag = "timeout" waitOutputFlag = "wait-output" @@ -339,11 +340,20 @@ func AddWaitOutputFlag(mode *WaitOutputMode, flags *pflag.FlagSet, defaultMode W "Specify the type of output Sonobuoy should produce when --wait is used. Valid modes are silent, spinner, or progress") } -// AddImagePullPolicyFlag adds a boolean flag for deleting everything (including E2E tests). +// AddImagePullPolicyFlag adds a string flag for the image pull policy for the aggregator/worker. If ForceImagePullPolicy +// is set, it will also apply to the plugins. func AddImagePullPolicyFlag(policy *string, flags *pflag.FlagSet) { flags.StringVar( policy, imagePullPolicyFlag, config.DefaultSonobuoyPullPolicy, - fmt.Sprintf("Set the ImagePullPolicy for the Sonobuoy image and all plugins. Valid options are %s.", strings.Join(ValidPullPolicies(), ", ")), + fmt.Sprintf("Set the ImagePullPolicy for the Sonobuoy image and all plugins (if --%v is set). Valid options are %s.", forceImagePullPolicyFlag, strings.Join(ValidPullPolicies(), ", ")), + ) +} + +// AddForceImagePullPolicyFlag adds a boolean flag for applying the ImagePullPolicy to all plugins even if set in their +// plugin specification. +func AddForceImagePullPolicyFlag(apply *bool, flags *pflag.FlagSet) { + flags.BoolVar( + apply, forceImagePullPolicyFlag, false, "Force plugins' imagePullPolicy to match the value for the Sonobuoy pod", ) } diff --git a/cmd/sonobuoy/app/gen.go b/cmd/sonobuoy/app/gen.go index c7438cccd..070458e2e 100644 --- a/cmd/sonobuoy/app/gen.go +++ b/cmd/sonobuoy/app/gen.go @@ -76,6 +76,7 @@ func GenFlagSet(cfg *genFlags, rbac RBACMode) *pflag.FlagSet { AddKubeconfigFlag(&cfg.kubecfg, genset) AddRBACModeFlags(&cfg.rbacMode, genset, rbac) AddImagePullPolicyFlag(&cfg.sonobuoyConfig.ImagePullPolicy, genset) + AddForceImagePullPolicyFlag(&cfg.sonobuoyConfig.ForceImagePullPolicy, genset) AddTimeoutFlag(&cfg.sonobuoyConfig.Aggregation.TimeoutSeconds, genset) AddShowDefaultPodSpecFlag(&cfg.showDefaultPodSpec, genset) AddAggregatorPermissionsFlag(&cfg.sonobuoyConfig.AggregatorPermissions, genset) diff --git a/pkg/client/gen.go b/pkg/client/gen.go index abb43b58e..2f7362f04 100644 --- a/pkg/client/gen.go +++ b/pkg/client/gen.go @@ -135,10 +135,11 @@ func (*SonobuoyClient) GenerateManifestAndPlugins(cfg *GenConfig) ([]byte, []*ma return strings.ToLower(plugins[i].SonobuoyConfig.PluginName) < strings.ToLower(plugins[j].SonobuoyConfig.PluginName) }) - // Apply our universal transforms; only applies to ImagePullPolicy. Overrides all - // plugin values. + // Apply our universal transforms; only override defaultImagePullPolicy if desired. for _, p := range plugins { - p.Spec.ImagePullPolicy = corev1.PullPolicy(cfg.Config.ImagePullPolicy) + if cfg.Config.ForceImagePullPolicy { + p.Spec.ImagePullPolicy = corev1.PullPolicy(cfg.Config.ImagePullPolicy) + } } // Apply transforms. Ensure this is before handling configmaps and applying the k8s_version. diff --git a/pkg/client/gen_test.go b/pkg/client/gen_test.go index a66048445..73a456156 100644 --- a/pkg/client/gen_test.go +++ b/pkg/client/gen_test.go @@ -430,9 +430,12 @@ func TestGenerateManifestGolden(t *testing.T) { }, goldenFile: filepath.Join("testdata", "plugin-configmaps.golden"), }, { - name: "ImagePullPolicy applied to all plugins", + name: "ImagePullPolicy applied to all plugins if forced", inputcm: &client.GenConfig{ - Config: staticConfig(), + Config: fromConfig(func(c *config.Config) *config.Config { + c.ForceImagePullPolicy = true + return c + }), KubeVersion: "v99+static.testing", StaticPlugins: []*manifest.Manifest{ { @@ -446,7 +449,7 @@ func TestGenerateManifestGolden(t *testing.T) { }, goldenFile: filepath.Join("testdata", "imagePullPolicy-all-plugins.golden"), }, { - name: "ImagePullPolicy applied to all plugins", + name: "ImagePullPolicy not applied to all plugins by default", inputcm: &client.GenConfig{ Config: staticConfig(), KubeVersion: "v99+static.testing", @@ -460,7 +463,7 @@ func TestGenerateManifestGolden(t *testing.T) { }, }, }, - goldenFile: filepath.Join("testdata", "imagePullPolicy-all-plugins.golden"), + goldenFile: filepath.Join("testdata", "imagePullPolicy-not-all-plugins.golden"), }, { name: "AggregatorPermissions for non-cluster admin", inputcm: &client.GenConfig{ diff --git a/pkg/client/testdata/aggregatorpermissions-noncluster-admin.golden b/pkg/client/testdata/aggregatorpermissions-noncluster-admin.golden index 77e0eadfd..2ba1aa3e7 100644 --- a/pkg/client/testdata/aggregatorpermissions-noncluster-admin.golden +++ b/pkg/client/testdata/aggregatorpermissions-noncluster-admin.golden @@ -61,7 +61,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -112,7 +111,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/default-plugins-via-nil-selection.golden b/pkg/client/testdata/default-plugins-via-nil-selection.golden index 8dd9b8032..b641f7544 100644 --- a/pkg/client/testdata/default-plugins-via-nil-selection.golden +++ b/pkg/client/testdata/default-plugins-via-nil-selection.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/default-plugins-via-selection.golden b/pkg/client/testdata/default-plugins-via-selection.golden index f0918536d..d50d31de6 100644 --- a/pkg/client/testdata/default-plugins-via-selection.golden +++ b/pkg/client/testdata/default-plugins-via-selection.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/default-pod-spec.golden b/pkg/client/testdata/default-pod-spec.golden index 8dd9b8032..b641f7544 100644 --- a/pkg/client/testdata/default-pod-spec.golden +++ b/pkg/client/testdata/default-pod-spec.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/default.golden b/pkg/client/testdata/default.golden index 8dd9b8032..b641f7544 100644 --- a/pkg/client/testdata/default.golden +++ b/pkg/client/testdata/default.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/e2e-default.golden b/pkg/client/testdata/e2e-default.golden index 1c45c6d1f..07e0cb31c 100644 --- a/pkg/client/testdata/e2e-default.golden +++ b/pkg/client/testdata/e2e-default.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/e2e-progress-custom-port.golden b/pkg/client/testdata/e2e-progress-custom-port.golden index 8fb7e98fd..5d8a79107 100644 --- a/pkg/client/testdata/e2e-progress-custom-port.golden +++ b/pkg/client/testdata/e2e-progress-custom-port.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/e2e-progress-vs-user-defined.golden b/pkg/client/testdata/e2e-progress-vs-user-defined.golden index 5c8fa9438..191be6f0d 100644 --- a/pkg/client/testdata/e2e-progress-vs-user-defined.golden +++ b/pkg/client/testdata/e2e-progress-vs-user-defined.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/e2e-progress.golden b/pkg/client/testdata/e2e-progress.golden index eb13774cb..00c90e30d 100644 --- a/pkg/client/testdata/e2e-progress.golden +++ b/pkg/client/testdata/e2e-progress.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/envoverrides.golden b/pkg/client/testdata/envoverrides.golden index b63603b20..2685e955d 100644 --- a/pkg/client/testdata/envoverrides.golden +++ b/pkg/client/testdata/envoverrides.golden @@ -69,7 +69,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/goRunnerRemoved.golden b/pkg/client/testdata/goRunnerRemoved.golden index 236707bda..9799af670 100644 --- a/pkg/client/testdata/goRunnerRemoved.golden +++ b/pkg/client/testdata/goRunnerRemoved.golden @@ -64,7 +64,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/imagePullPolicy-all-plugins.golden b/pkg/client/testdata/imagePullPolicy-all-plugins.golden index 8097d7ec6..c1f02cc5b 100644 --- a/pkg/client/testdata/imagePullPolicy-all-plugins.golden +++ b/pkg/client/testdata/imagePullPolicy-all-plugins.golden @@ -13,7 +13,7 @@ metadata: --- apiVersion: v1 data: - config.json: '{"Description":"DEFAULT","UUID":"","Version":"static-version-for-testing","ResultsDir":"/tmp/sonobuoy/results","Resources":null,"Filters":{"Namespaces":".*","LabelSelector":""},"Limits":{"PodLogs":{"Namespaces":"kube-system","SonobuoyNamespace":true,"FieldSelectors":[],"LabelSelector":"","Previous":false,"SinceSeconds":null,"SinceTime":null,"Timestamps":false,"TailLines":null,"LimitBytes":null}},"QPS":30,"Burst":50,"Server":{"bindaddress":"0.0.0.0","bindport":8080,"advertiseaddress":"","timeoutseconds":21600},"Plugins":null,"PluginSearchPath":["./plugins.d","/etc/sonobuoy/plugins.d","~/sonobuoy/plugins.d"],"Namespace":"sonobuoy","WorkerImage":"sonobuoy/sonobuoy:static-version-for-testing","ImagePullPolicy":"IfNotPresent","ImagePullSecrets":"","AggregatorPermissions":"clusterAdmin","ProgressUpdatesPort":"8099","SecurityContextMode":"nonroot"}' + config.json: '{"Description":"DEFAULT","UUID":"","Version":"static-version-for-testing","ResultsDir":"/tmp/sonobuoy/results","Resources":null,"Filters":{"Namespaces":".*","LabelSelector":""},"Limits":{"PodLogs":{"Namespaces":"kube-system","SonobuoyNamespace":true,"FieldSelectors":[],"LabelSelector":"","Previous":false,"SinceSeconds":null,"SinceTime":null,"Timestamps":false,"TailLines":null,"LimitBytes":null}},"QPS":30,"Burst":50,"Server":{"bindaddress":"0.0.0.0","bindport":8080,"advertiseaddress":"","timeoutseconds":21600},"Plugins":null,"PluginSearchPath":["./plugins.d","/etc/sonobuoy/plugins.d","~/sonobuoy/plugins.d"],"Namespace":"sonobuoy","WorkerImage":"sonobuoy/sonobuoy:static-version-for-testing","ImagePullPolicy":"IfNotPresent","ForceImagePullPolicy":true,"ImagePullSecrets":"","AggregatorPermissions":"clusterAdmin","ProgressUpdatesPort":"8099","SecurityContextMode":"nonroot"}' kind: ConfigMap metadata: labels: diff --git a/pkg/client/testdata/imagePullPolicy-not-all-plugins.golden b/pkg/client/testdata/imagePullPolicy-not-all-plugins.golden new file mode 100644 index 000000000..e5d4a6d15 --- /dev/null +++ b/pkg/client/testdata/imagePullPolicy-not-all-plugins.golden @@ -0,0 +1,147 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: sonobuoy +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + component: sonobuoy + name: sonobuoy-serviceaccount + namespace: sonobuoy +--- +apiVersion: v1 +data: + config.json: '{"Description":"DEFAULT","UUID":"","Version":"static-version-for-testing","ResultsDir":"/tmp/sonobuoy/results","Resources":null,"Filters":{"Namespaces":".*","LabelSelector":""},"Limits":{"PodLogs":{"Namespaces":"kube-system","SonobuoyNamespace":true,"FieldSelectors":[],"LabelSelector":"","Previous":false,"SinceSeconds":null,"SinceTime":null,"Timestamps":false,"TailLines":null,"LimitBytes":null}},"QPS":30,"Burst":50,"Server":{"bindaddress":"0.0.0.0","bindport":8080,"advertiseaddress":"","timeoutseconds":21600},"Plugins":null,"PluginSearchPath":["./plugins.d","/etc/sonobuoy/plugins.d","~/sonobuoy/plugins.d"],"Namespace":"sonobuoy","WorkerImage":"sonobuoy/sonobuoy:static-version-for-testing","ImagePullPolicy":"IfNotPresent","ImagePullSecrets":"","AggregatorPermissions":"clusterAdmin","ProgressUpdatesPort":"8099","SecurityContextMode":"nonroot"}' +kind: ConfigMap +metadata: + labels: + component: sonobuoy + name: sonobuoy-config-cm + namespace: sonobuoy +--- +apiVersion: v1 +data: + plugin-0.yaml: |- + sonobuoy-config: + driver: "" + plugin-name: myplugin1 + spec: + env: + - name: RESULTS_DIR + value: /tmp/sonobuoy/results + - name: SONOBUOY + value: "true" + - name: SONOBUOY_CONFIG_DIR + value: /tmp/sonobuoy/config + - name: SONOBUOY_K8S_VERSION + value: v99+static.testing + - name: SONOBUOY_PROGRESS_PORT + value: "8099" + - name: SONOBUOY_RESULTS_DIR + value: /tmp/sonobuoy/results + imagePullPolicy: Never + name: "" + volumeMounts: + - mountPath: /tmp/sonobuoy/results + name: results + plugin-1.yaml: |- + sonobuoy-config: + driver: "" + plugin-name: myplugin2 + spec: + env: + - name: RESULTS_DIR + value: /tmp/sonobuoy/results + - name: SONOBUOY + value: "true" + - name: SONOBUOY_CONFIG_DIR + value: /tmp/sonobuoy/config + - name: SONOBUOY_K8S_VERSION + value: v99+static.testing + - name: SONOBUOY_PROGRESS_PORT + value: "8099" + - name: SONOBUOY_RESULTS_DIR + value: /tmp/sonobuoy/results + imagePullPolicy: Always + name: "" + volumeMounts: + - mountPath: /tmp/sonobuoy/results + name: results +kind: ConfigMap +metadata: + labels: + component: sonobuoy + name: sonobuoy-plugins-cm + namespace: sonobuoy +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + component: sonobuoy + sonobuoy-component: aggregator + tier: analysis + name: sonobuoy + namespace: sonobuoy +spec: + containers: + - args: + - aggregator + - --no-exit + - --level=info + - -v=4 + - --alsologtostderr + command: + - /sonobuoy + env: + - name: SONOBUOY_ADVERTISE_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: sonobuoy/sonobuoy:static-version-for-testing + name: kube-sonobuoy + volumeMounts: + - mountPath: /etc/sonobuoy + name: sonobuoy-config-volume + - mountPath: /plugins.d + name: sonobuoy-plugins-volume + - mountPath: /tmp/sonobuoy + name: output-volume + restartPolicy: Never + securityContext: + fsGroup: 2000 + runAsGroup: 3000 + runAsUser: 1000 + serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: kubernetes.io/e2e-evict-taint-key + operator: Exists + volumes: + - configMap: + name: sonobuoy-config-cm + name: sonobuoy-config-volume + - configMap: + name: sonobuoy-plugins-cm + name: sonobuoy-plugins-volume + - emptyDir: {} + name: output-volume +--- +apiVersion: v1 +kind: Service +metadata: + labels: + component: sonobuoy + sonobuoy-component: aggregator + name: sonobuoy-aggregator + namespace: sonobuoy +spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + sonobuoy-component: aggregator + type: ClusterIP +--- diff --git a/pkg/client/testdata/imagePullSecrets.golden b/pkg/client/testdata/imagePullSecrets.golden index 58b655634..4dea9d89d 100644 --- a/pkg/client/testdata/imagePullSecrets.golden +++ b/pkg/client/testdata/imagePullSecrets.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden b/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden index af98adc5f..8003bb575 100644 --- a/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden +++ b/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -89,7 +88,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden b/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden index 49c8f241b..5ca3037f4 100644 --- a/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden +++ b/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden @@ -41,7 +41,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -92,7 +91,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/manual-custom-plugin.golden b/pkg/client/testdata/manual-custom-plugin.golden index 2869aa389..45a323e40 100644 --- a/pkg/client/testdata/manual-custom-plugin.golden +++ b/pkg/client/testdata/manual-custom-plugin.golden @@ -41,7 +41,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/manual-e2e.golden b/pkg/client/testdata/manual-e2e.golden index eb13774cb..00c90e30d 100644 --- a/pkg/client/testdata/manual-e2e.golden +++ b/pkg/client/testdata/manual-e2e.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/multiple-node-selector.golden b/pkg/client/testdata/multiple-node-selector.golden index 7bc420802..e48c4a7d3 100644 --- a/pkg/client/testdata/multiple-node-selector.golden +++ b/pkg/client/testdata/multiple-node-selector.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/plugin-configmaps.golden b/pkg/client/testdata/plugin-configmaps.golden index 4be034e15..4da57ade7 100644 --- a/pkg/client/testdata/plugin-configmaps.golden +++ b/pkg/client/testdata/plugin-configmaps.golden @@ -48,7 +48,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/config @@ -80,7 +79,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/config diff --git a/pkg/client/testdata/plugins-and-pluginSelection.golden b/pkg/client/testdata/plugins-and-pluginSelection.golden index a2c3bdfdc..459f663ad 100644 --- a/pkg/client/testdata/plugins-and-pluginSelection.golden +++ b/pkg/client/testdata/plugins-and-pluginSelection.golden @@ -41,7 +41,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -64,7 +63,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/client/testdata/single-node-selector.golden b/pkg/client/testdata/single-node-selector.golden index 95eca47a2..0e099d79f 100644 --- a/pkg/client/testdata/single-node-selector.golden +++ b/pkg/client/testdata/single-node-selector.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/systemd-logs-default.golden b/pkg/client/testdata/systemd-logs-default.golden index 71e936e53..c8a457814 100644 --- a/pkg/client/testdata/systemd-logs-default.golden +++ b/pkg/client/testdata/systemd-logs-default.golden @@ -66,7 +66,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: k8s.gcr.io/conformance:v99+static.testing - imagePullPolicy: IfNotPresent name: e2e volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -117,7 +116,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/systemd-logs:v0.4 - imagePullPolicy: IfNotPresent name: systemd-logs securityContext: privileged: true diff --git a/pkg/client/testdata/use-existing-pod-spec.golden b/pkg/client/testdata/use-existing-pod-spec.golden index b60759e34..5812c1a03 100644 --- a/pkg/client/testdata/use-existing-pod-spec.golden +++ b/pkg/client/testdata/use-existing-pod-spec.golden @@ -43,7 +43,6 @@ data: value: "8099" - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results - imagePullPolicy: IfNotPresent name: "" volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/pkg/config/config.go b/pkg/config/config.go index 57962c236..ad11ca025 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -138,6 +138,7 @@ type Config struct { /////////////////////////////////////////////// WorkerImage string `json:"WorkerImage" mapstructure:"WorkerImage"` ImagePullPolicy string `json:"ImagePullPolicy" mapstructure:"ImagePullPolicy"` + ForceImagePullPolicy bool `json:"ForceImagePullPolicy,omitempty" mapstructure:"ForceImagePullPolicy"` ImagePullSecrets string `json:"ImagePullSecrets" mapstructure:"ImagePullSecrets"` CustomAnnotations map[string]string `json:"CustomAnnotations,omitempty" mapstructure:"CustomAnnotations"` AggregatorPermissions string `json:"AggregatorPermissions" mapstructure:"AggregatorPermissions"` diff --git a/test/integration/sonobuoy_integration_test.go b/test/integration/sonobuoy_integration_test.go index 0f88bcc9b..363b91a20 100644 --- a/test/integration/sonobuoy_integration_test.go +++ b/test/integration/sonobuoy_integration_test.go @@ -756,6 +756,14 @@ func TestExactOutput_LocalGolden(t *testing.T) { desc: "sonobuoy plugin-env supports aggregator", cmdLine: "gen --plugin-env=sonobuoy.FOO=bar --kubernetes-version=ignore", expectFile: "testdata/gen-plugin-env-sonobuoy.golden", + }, { + desc: "sonobuoy respects plugin imagePullPolicy", + cmdLine: "gen --kubernetes-version=ignore -p testdata/plugins/good/setImagePullPolicy.yaml", + expectFile: "testdata/gen-imagePullPolicy.golden", + }, { + desc: "sonobuoy respects plugin imagePullPolicy unless forced via config", + cmdLine: "gen --kubernetes-version=ignore -p testdata/plugins/good/setImagePullPolicy.yaml --force-image-pull-policy", + expectFile: "testdata/gen-imagePullPolicy-forced.golden", }, } for _, tc := range testCases { diff --git a/test/integration/testdata/gen-imagePullPolicy-forced.golden b/test/integration/testdata/gen-imagePullPolicy-forced.golden new file mode 100644 index 000000000..9e0e08426 --- /dev/null +++ b/test/integration/testdata/gen-imagePullPolicy-forced.golden @@ -0,0 +1,169 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: sonobuoy +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + component: sonobuoy + name: sonobuoy-serviceaccount + namespace: sonobuoy +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + component: sonobuoy + namespace: sonobuoy + name: sonobuoy-serviceaccount-sonobuoy +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: sonobuoy-serviceaccount-sonobuoy +subjects: +- kind: ServiceAccount + name: sonobuoy-serviceaccount + namespace: sonobuoy +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + component: sonobuoy + namespace: sonobuoy + name: sonobuoy-serviceaccount-sonobuoy +rules: +- apiGroups: + - '*' + resources: + - '*' + verbs: + - '*' +- nonResourceURLs: + - /metrics + - /logs + - /logs/* + verbs: + - get +--- +apiVersion: v1 +data: + config.json: '{"Description":"DEFAULT","UUID":"","Version":"*STATIC_FOR_TESTING*","ResultsDir":"/tmp/sonobuoy/results","Resources":null,"Filters":{"Namespaces":".*","LabelSelector":""},"Limits":{"PodLogs":{"Namespaces":"kube-system","SonobuoyNamespace":true,"FieldSelectors":[],"LabelSelector":"","Previous":false,"SinceSeconds":null,"SinceTime":null,"Timestamps":false,"TailLines":null,"LimitBytes":null}},"QPS":30,"Burst":50,"Server":{"bindaddress":"0.0.0.0","bindport":8080,"advertiseaddress":"","timeoutseconds":21600},"Plugins":null,"PluginSearchPath":["./plugins.d","/etc/sonobuoy/plugins.d","~/sonobuoy/plugins.d"],"Namespace":"sonobuoy","WorkerImage":"sonobuoy/sonobuoy:*STATIC_FOR_TESTING*","ImagePullPolicy":"IfNotPresent","ForceImagePullPolicy":true,"ImagePullSecrets":"","AggregatorPermissions":"clusterAdmin","ProgressUpdatesPort":"8099","SecurityContextMode":"nonroot"}' +kind: ConfigMap +metadata: + labels: + component: sonobuoy + name: sonobuoy-config-cm + namespace: sonobuoy +--- +apiVersion: v1 +data: + plugin-0.yaml: |- + sonobuoy-config: + description: This is a plugin description. + driver: Job + plugin-name: hello-world + result-format: raw + source-url: foo.com + spec: + command: + - ./run.sh + env: + - name: RESULTS_DIR + value: /tmp/sonobuoy/results + - name: SONOBUOY + value: "true" + - name: SONOBUOY_CONFIG_DIR + value: /tmp/sonobuoy/config + - name: SONOBUOY_K8S_VERSION + value: ignore + - name: SONOBUOY_PROGRESS_PORT + value: "8099" + - name: SONOBUOY_RESULTS_DIR + value: /tmp/sonobuoy/results + image: hello:v9 + imagePullPolicy: IfNotPresent + name: plugin + volumeMounts: + - mountPath: /tmp/sonobuoy/results + name: results +kind: ConfigMap +metadata: + labels: + component: sonobuoy + name: sonobuoy-plugins-cm + namespace: sonobuoy +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + component: sonobuoy + sonobuoy-component: aggregator + tier: analysis + name: sonobuoy + namespace: sonobuoy +spec: + containers: + - args: + - aggregator + - --no-exit + - --level=info + - -v=4 + - --alsologtostderr + command: + - /sonobuoy + env: + - name: SONOBUOY_ADVERTISE_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: sonobuoy/sonobuoy:*STATIC_FOR_TESTING* + imagePullPolicy: IfNotPresent + name: kube-sonobuoy + volumeMounts: + - mountPath: /etc/sonobuoy + name: sonobuoy-config-volume + - mountPath: /plugins.d + name: sonobuoy-plugins-volume + - mountPath: /tmp/sonobuoy + name: output-volume + restartPolicy: Never + securityContext: + fsGroup: 2000 + runAsGroup: 3000 + runAsUser: 1000 + serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: kubernetes.io/e2e-evict-taint-key + operator: Exists + volumes: + - configMap: + name: sonobuoy-config-cm + name: sonobuoy-config-volume + - configMap: + name: sonobuoy-plugins-cm + name: sonobuoy-plugins-volume + - emptyDir: {} + name: output-volume +--- +apiVersion: v1 +kind: Service +metadata: + labels: + component: sonobuoy + sonobuoy-component: aggregator + name: sonobuoy-aggregator + namespace: sonobuoy +spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + sonobuoy-component: aggregator + type: ClusterIP +--- + diff --git a/test/integration/testdata/gen-imagePullPolicy.golden b/test/integration/testdata/gen-imagePullPolicy.golden new file mode 100644 index 000000000..f10e6900a --- /dev/null +++ b/test/integration/testdata/gen-imagePullPolicy.golden @@ -0,0 +1,169 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: sonobuoy +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + component: sonobuoy + name: sonobuoy-serviceaccount + namespace: sonobuoy +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + component: sonobuoy + namespace: sonobuoy + name: sonobuoy-serviceaccount-sonobuoy +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: sonobuoy-serviceaccount-sonobuoy +subjects: +- kind: ServiceAccount + name: sonobuoy-serviceaccount + namespace: sonobuoy +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + component: sonobuoy + namespace: sonobuoy + name: sonobuoy-serviceaccount-sonobuoy +rules: +- apiGroups: + - '*' + resources: + - '*' + verbs: + - '*' +- nonResourceURLs: + - /metrics + - /logs + - /logs/* + verbs: + - get +--- +apiVersion: v1 +data: + config.json: '{"Description":"DEFAULT","UUID":"","Version":"*STATIC_FOR_TESTING*","ResultsDir":"/tmp/sonobuoy/results","Resources":null,"Filters":{"Namespaces":".*","LabelSelector":""},"Limits":{"PodLogs":{"Namespaces":"kube-system","SonobuoyNamespace":true,"FieldSelectors":[],"LabelSelector":"","Previous":false,"SinceSeconds":null,"SinceTime":null,"Timestamps":false,"TailLines":null,"LimitBytes":null}},"QPS":30,"Burst":50,"Server":{"bindaddress":"0.0.0.0","bindport":8080,"advertiseaddress":"","timeoutseconds":21600},"Plugins":null,"PluginSearchPath":["./plugins.d","/etc/sonobuoy/plugins.d","~/sonobuoy/plugins.d"],"Namespace":"sonobuoy","WorkerImage":"sonobuoy/sonobuoy:*STATIC_FOR_TESTING*","ImagePullPolicy":"IfNotPresent","ImagePullSecrets":"","AggregatorPermissions":"clusterAdmin","ProgressUpdatesPort":"8099","SecurityContextMode":"nonroot"}' +kind: ConfigMap +metadata: + labels: + component: sonobuoy + name: sonobuoy-config-cm + namespace: sonobuoy +--- +apiVersion: v1 +data: + plugin-0.yaml: |- + sonobuoy-config: + description: This is a plugin description. + driver: Job + plugin-name: hello-world + result-format: raw + source-url: foo.com + spec: + command: + - ./run.sh + env: + - name: RESULTS_DIR + value: /tmp/sonobuoy/results + - name: SONOBUOY + value: "true" + - name: SONOBUOY_CONFIG_DIR + value: /tmp/sonobuoy/config + - name: SONOBUOY_K8S_VERSION + value: ignore + - name: SONOBUOY_PROGRESS_PORT + value: "8099" + - name: SONOBUOY_RESULTS_DIR + value: /tmp/sonobuoy/results + image: hello:v9 + imagePullPolicy: Always + name: plugin + volumeMounts: + - mountPath: /tmp/sonobuoy/results + name: results +kind: ConfigMap +metadata: + labels: + component: sonobuoy + name: sonobuoy-plugins-cm + namespace: sonobuoy +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + component: sonobuoy + sonobuoy-component: aggregator + tier: analysis + name: sonobuoy + namespace: sonobuoy +spec: + containers: + - args: + - aggregator + - --no-exit + - --level=info + - -v=4 + - --alsologtostderr + command: + - /sonobuoy + env: + - name: SONOBUOY_ADVERTISE_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: sonobuoy/sonobuoy:*STATIC_FOR_TESTING* + imagePullPolicy: IfNotPresent + name: kube-sonobuoy + volumeMounts: + - mountPath: /etc/sonobuoy + name: sonobuoy-config-volume + - mountPath: /plugins.d + name: sonobuoy-plugins-volume + - mountPath: /tmp/sonobuoy + name: output-volume + restartPolicy: Never + securityContext: + fsGroup: 2000 + runAsGroup: 3000 + runAsUser: 1000 + serviceAccountName: sonobuoy-serviceaccount + tolerations: + - key: kubernetes.io/e2e-evict-taint-key + operator: Exists + volumes: + - configMap: + name: sonobuoy-config-cm + name: sonobuoy-config-volume + - configMap: + name: sonobuoy-plugins-cm + name: sonobuoy-plugins-volume + - emptyDir: {} + name: output-volume +--- +apiVersion: v1 +kind: Service +metadata: + labels: + component: sonobuoy + sonobuoy-component: aggregator + name: sonobuoy-aggregator + namespace: sonobuoy +spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + sonobuoy-component: aggregator + type: ClusterIP +--- + diff --git a/test/integration/testdata/gen-issue-1528.golden b/test/integration/testdata/gen-issue-1528.golden index 752549d68..51c4c4086 100644 --- a/test/integration/testdata/gen-issue-1528.golden +++ b/test/integration/testdata/gen-issue-1528.golden @@ -84,7 +84,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: hello:v9 - imagePullPolicy: IfNotPresent name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -132,7 +131,7 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: foo/bar:0.1.2 - imagePullPolicy: IfNotPresent + imagePullPolicy: Always name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/test/integration/testdata/gen-plugin-renaming.golden b/test/integration/testdata/gen-plugin-renaming.golden index 939ab6e3e..5f3396cb5 100644 --- a/test/integration/testdata/gen-plugin-renaming.golden +++ b/test/integration/testdata/gen-plugin-renaming.golden @@ -85,7 +85,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: sonobuoy/testimage:v0.1 - imagePullPolicy: IfNotPresent name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -112,7 +111,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: hello:v9 - imagePullPolicy: IfNotPresent name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/test/integration/testdata/gen-rerunfailed-missing.golden b/test/integration/testdata/gen-rerunfailed-missing.golden index c25e308d3..707945ae1 100644 --- a/test/integration/testdata/gen-rerunfailed-missing.golden +++ b/test/integration/testdata/gen-rerunfailed-missing.golden @@ -20,8 +20,9 @@ Flags: --e2e-repo-config yaml-filepath Specify a yaml file acting as KUBE_TEST_REPO_LIST, overriding registries for test images. --e2e-skip envModifier Specify the E2E_SKIP value for the e2e plugin, specifying which tests to skip. Shorthand for --plugin-env=e2e.E2E_SKIP= (default \[Disruptive\]|NoExecuteTaintManager) -f, --file - If set, loads the file as if it were the output from sonobuoy gen. Set to - to read from stdin. + --force-image-pull-policy Force plugins' imagePullPolicy to match the value for the Sonobuoy pod -h, --help help for gen - --image-pull-policy string Set the ImagePullPolicy for the Sonobuoy image and all plugins. Valid options are Always, IfNotPresent, Never. (default "IfNotPresent") + --image-pull-policy string Set the ImagePullPolicy for the Sonobuoy image and all plugins (if --force-image-pull-policy is set). Valid options are Always, IfNotPresent, Never. (default "IfNotPresent") --kube-conformance-image image Container image override for the e2e plugin. Shorthand for --plugin-image=e2e: (default map[]) --kubeconfig Kubeconfig Path to explicit kubeconfig file. --kubernetes-version string Use default E2E image, but override the version. Default is 'auto', which will be set to your cluster's version if detected, erroring otherwise. 'ignore' will try version resolution but ignore errors. 'latest' will find the latest dev image/version upstream. diff --git a/test/integration/testdata/gen-rerunfailed-no-failures.golden b/test/integration/testdata/gen-rerunfailed-no-failures.golden index 177b6a6b9..a2022b35f 100644 --- a/test/integration/testdata/gen-rerunfailed-no-failures.golden +++ b/test/integration/testdata/gen-rerunfailed-no-failures.golden @@ -20,8 +20,9 @@ Flags: --e2e-repo-config yaml-filepath Specify a yaml file acting as KUBE_TEST_REPO_LIST, overriding registries for test images. --e2e-skip envModifier Specify the E2E_SKIP value for the e2e plugin, specifying which tests to skip. Shorthand for --plugin-env=e2e.E2E_SKIP= (default \[Disruptive\]|NoExecuteTaintManager) -f, --file - If set, loads the file as if it were the output from sonobuoy gen. Set to - to read from stdin. + --force-image-pull-policy Force plugins' imagePullPolicy to match the value for the Sonobuoy pod -h, --help help for gen - --image-pull-policy string Set the ImagePullPolicy for the Sonobuoy image and all plugins. Valid options are Always, IfNotPresent, Never. (default "IfNotPresent") + --image-pull-policy string Set the ImagePullPolicy for the Sonobuoy image and all plugins (if --force-image-pull-policy is set). Valid options are Always, IfNotPresent, Never. (default "IfNotPresent") --kube-conformance-image image Container image override for the e2e plugin. Shorthand for --plugin-image=e2e: (default map[]) --kubeconfig Kubeconfig Path to explicit kubeconfig file. --kubernetes-version string Use default E2E image, but override the version. Default is 'auto', which will be set to your cluster's version if detected, erroring otherwise. 'ignore' will try version resolution but ignore errors. 'latest' will find the latest dev image/version upstream. diff --git a/test/integration/testdata/gen-rerunfailed-not-tarball.golden b/test/integration/testdata/gen-rerunfailed-not-tarball.golden index 9d0a8a44e..de5b881dc 100644 --- a/test/integration/testdata/gen-rerunfailed-not-tarball.golden +++ b/test/integration/testdata/gen-rerunfailed-not-tarball.golden @@ -20,8 +20,9 @@ Flags: --e2e-repo-config yaml-filepath Specify a yaml file acting as KUBE_TEST_REPO_LIST, overriding registries for test images. --e2e-skip envModifier Specify the E2E_SKIP value for the e2e plugin, specifying which tests to skip. Shorthand for --plugin-env=e2e.E2E_SKIP= (default \[Disruptive\]|NoExecuteTaintManager) -f, --file - If set, loads the file as if it were the output from sonobuoy gen. Set to - to read from stdin. + --force-image-pull-policy Force plugins' imagePullPolicy to match the value for the Sonobuoy pod -h, --help help for gen - --image-pull-policy string Set the ImagePullPolicy for the Sonobuoy image and all plugins. Valid options are Always, IfNotPresent, Never. (default "IfNotPresent") + --image-pull-policy string Set the ImagePullPolicy for the Sonobuoy image and all plugins (if --force-image-pull-policy is set). Valid options are Always, IfNotPresent, Never. (default "IfNotPresent") --kube-conformance-image image Container image override for the e2e plugin. Shorthand for --plugin-image=e2e: (default map[]) --kubeconfig Kubeconfig Path to explicit kubeconfig file. --kubernetes-version string Use default E2E image, but override the version. Default is 'auto', which will be set to your cluster's version if detected, erroring otherwise. 'ignore' will try version resolution but ignore errors. 'latest' will find the latest dev image/version upstream. diff --git a/test/integration/testdata/gen-variable-image.golden b/test/integration/testdata/gen-variable-image.golden index f6f1337ce..78655a384 100644 --- a/test/integration/testdata/gen-variable-image.golden +++ b/test/integration/testdata/gen-variable-image.golden @@ -82,7 +82,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: hello:v9 - imagePullPolicy: IfNotPresent name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results @@ -109,7 +108,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: hello:v123.456.789 - imagePullPolicy: IfNotPresent name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/test/integration/testdata/plugin-list.golden b/test/integration/testdata/plugin-list.golden index 87d7b56d4..3a9c328fa 100644 --- a/test/integration/testdata/plugin-list.golden +++ b/test/integration/testdata/plugin-list.golden @@ -10,6 +10,12 @@ Plugin name (in aggregator): hello-world2 Source URL: Description: --- +Run as: setImagePullPolicy +Filename: testdata/plugins/good/setImagePullPolicy.yaml +Plugin name (in aggregator): hello-world +Source URL: foo.com +Description: This is a plugin description. +--- Run as: sidecar Filename: testdata/plugins/good/sidecar.yaml Plugin name (in aggregator): sidecarplugin diff --git a/test/integration/testdata/plugin-loading-installed.golden b/test/integration/testdata/plugin-loading-installed.golden index afd6e199c..c19eb4263 100644 --- a/test/integration/testdata/plugin-loading-installed.golden +++ b/test/integration/testdata/plugin-loading-installed.golden @@ -84,7 +84,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: hello:v9 - imagePullPolicy: IfNotPresent name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/test/integration/testdata/plugin-loading-local.golden b/test/integration/testdata/plugin-loading-local.golden index d1c12a5d6..72a822c96 100644 --- a/test/integration/testdata/plugin-loading-local.golden +++ b/test/integration/testdata/plugin-loading-local.golden @@ -84,7 +84,6 @@ data: - name: SONOBUOY_RESULTS_DIR value: /tmp/sonobuoy/results image: hello:v9 - imagePullPolicy: IfNotPresent name: plugin volumeMounts: - mountPath: /tmp/sonobuoy/results diff --git a/test/integration/testdata/plugins/good/setImagePullPolicy.yaml b/test/integration/testdata/plugins/good/setImagePullPolicy.yaml new file mode 100644 index 000000000..e39ecce82 --- /dev/null +++ b/test/integration/testdata/plugins/good/setImagePullPolicy.yaml @@ -0,0 +1,12 @@ +sonobuoy-config: + driver: Job + plugin-name: hello-world + result-format: raw + source-url: foo.com + description: This is a plugin description. +spec: + command: + - ./run.sh + image: hello:v9 + name: plugin + imagePullPolicy: Always