diff --git a/data/data_test.go b/data/data_test.go index 07f50809..9a73490f 100644 --- a/data/data_test.go +++ b/data/data_test.go @@ -24,6 +24,7 @@ func TestDataTemplatesPluginsManifests(t *testing.T) { want := []string{ "templates/plugins/openshift-artifacts-collector.yaml", "templates/plugins/openshift-cluster-upgrade.yaml", + "templates/plugins/openshift-conformance-replay.yaml", "templates/plugins/openshift-conformance-validated.yaml", "templates/plugins/openshift-kube-conformance.yaml", } @@ -56,6 +57,7 @@ func TestDataTemplatesPluginsManifests(t *testing.T) { assert.Equal(t, want, got, "plugin manifests are readable") }, }, + // TODO: add test for plugin manifest content are rendered as expected. } efs.UpdateData(&testTemplatesPluginsAll) diff --git a/data/templates/plugins/openshift-artifacts-collector.yaml b/data/templates/plugins/openshift-artifacts-collector.yaml index 303cb8dc..bea16184 100644 --- a/data/templates/plugins/openshift-artifacts-collector.yaml +++ b/data/templates/plugins/openshift-artifacts-collector.yaml @@ -1,54 +1,41 @@ +--- podSpec: restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + priorityClassName: system-node-critical volumes: - name: shared emptyDir: {} - containers: - - name: report-progress - image: "{{ .PluginsImage }}" - imagePullPolicy: Always - priorityClassName: system-node-critical - command: ["./report-progress.sh"] - volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared - env: - - name: PLUGIN_ID - value: "99" - - name: ENV_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: ENV_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: ENV_POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace sonobuoy-config: driver: Job plugin-name: 99-openshift-artifacts-collector result-format: raw - description: The OpenShift Provider Certification Tool artifacts collector executed on the post-certification. - source-url: https://github.com/redhat-openshift-ecosystem/provider-certification-tool/blob/main/manifests/openshift-artifacts-collector.yaml + description: | + OPCT artifacts plugin collects the artifacts from the OpenShift Container + Platform post-validation. + source-url: + "https://github.com/redhat-openshift-ecosystem/provider-certification-tool/\ + blob/main/manifests/openshift-artifacts-collector.yaml" skipCleanup: true spec: name: plugin - image: "{{ .PluginsImage }}" + image: "{{ .CollectorImage }}" imagePullPolicy: Always + command: ["/bin/bash", "/plugin/entrypoint-collector.sh"] volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared + - mountPath: /tmp/sonobuoy/results + name: results + - mountPath: /tmp/shared + name: shared env: - name: PLUGIN_ID value: "99" + - name: PLUGIN_NAME + value: "openshift-artifacts-collector" + - name: PLUGIN_BLOCKED_BY + value: "80-openshift-tests-replay" + - name: IMAGE_OVERRIDE_MUST_GATHER + value: "{{ .MustGatherMonitoringImage }}" - name: ENV_NODE_NAME valueFrom: fieldRef: @@ -77,4 +64,3 @@ spec: name: plugins-config key: mirror-registry optional: true - diff --git a/data/templates/plugins/openshift-cluster-upgrade.yaml b/data/templates/plugins/openshift-cluster-upgrade.yaml index 8c9c3b39..d1377e43 100644 --- a/data/templates/plugins/openshift-cluster-upgrade.yaml +++ b/data/templates/plugins/openshift-cluster-upgrade.yaml @@ -1,53 +1,91 @@ +--- podSpec: restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + priorityClassName: system-node-critical volumes: - name: shared emptyDir: {} - containers: - - name: report-progress + initContainers: + - name: sync image: "{{ .PluginsImage }}" imagePullPolicy: Always - priorityClassName: system-node-critical - command: ["./report-progress.sh"] + command: + - "/bin/bash" + - "-c" + - "cp -vf ./entrypoint-tests.sh ./platform.sh /tmp/shared/" volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared + - mountPath: /tmp/shared + name: shared + - name: login + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + command: + - "/bin/bash" + - "-c" + - | + /usr/bin/oc login "${KUBE_API_URL}" \ + --token="$(cat "${SA_TOKEN_PATH}")" \ + --certificate-authority="${SA_CA_PATH}"; env: - - name: PLUGIN_ID - value: "05" - - name: ENV_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: ENV_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: ENV_POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace + - name: KUBECONFIG + value: "/tmp/shared/kubeconfig" + - name: KUBE_API_URL + value: "https://172.30.0.1:443" + - name: SA_TOKEN_PATH + value: "/var/run/secrets/kubernetes.io/serviceaccount/token" + - name: SA_CA_PATH + value: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" + volumeMounts: + - mountPath: /tmp/shared + name: shared + containers: + - name: tests + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + volumeMounts: + - mountPath: /tmp/shared + name: shared + command: ["/bin/bash", "/tmp/shared/entrypoint-tests.sh"] + env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: DEFAULT_SUITE_NAME + value: "none" + - name: OT_RUN_COMMAND + value: "run-upgrade" + - name: PLUGIN_NAME + value: "openshift-cluster-upgrade" + sonobuoy-config: driver: Job plugin-name: 05-openshift-cluster-upgrade result-format: junit - description: The end-to-end tests maintained by OpenShift to certify the Provider running the OpenShift Container Platform. - source-url: https://github.com/redhat-openshift-ecosystem/provider-certification-tool/blob/main/manifests/openshift-conformance-validated.yaml + description: | + The end-to-end tests maintained by OpenShift to validate provider + running the OpenShift Container Platform. + source-url: + "https://github.com/redhat-openshift-ecosystem/provider-certification-tool/\ + blob/main/manifests/openshift-conformance-validated.yaml" skipCleanup: true spec: name: plugin image: "{{ .PluginsImage }}" + command: + - "/bin/sh" + - "-c" + - "/usr/bin/openshift-tests-plugin run --name ${PLUGIN_NAME}" imagePullPolicy: Always - priorityClassName: system-node-critical volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared + - mountPath: /tmp/sonobuoy/results + name: results + - mountPath: /tmp/shared + name: shared env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: PLUGIN_NAME + value: "openshift-cluster-upgrade" - name: PLUGIN_ID value: "05" - name: ENV_NODE_NAME @@ -78,4 +116,3 @@ spec: name: plugins-config key: mirror-registry optional: true - diff --git a/data/templates/plugins/openshift-conformance-replay.yaml b/data/templates/plugins/openshift-conformance-replay.yaml new file mode 100644 index 00000000..a799f790 --- /dev/null +++ b/data/templates/plugins/openshift-conformance-replay.yaml @@ -0,0 +1,118 @@ +--- +podSpec: + restartPolicy: Never + serviceAccountName: sonobuoy-serviceaccount + priorityClassName: system-node-critical + volumes: + - name: shared + emptyDir: {} + initContainers: + - name: sync + image: "{{ .PluginsImage }}" + imagePullPolicy: Always + command: + - "/bin/bash" + - "-c" + - "cp -vf ./entrypoint-tests.sh ./platform.sh /tmp/shared/" + volumeMounts: + - mountPath: /tmp/shared + name: shared + - name: login + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + command: + - "/bin/bash" + - "-c" + - | + /usr/bin/oc login "${KUBE_API_URL}" \ + --token="$(cat "${SA_TOKEN_PATH}")" \ + --certificate-authority="${SA_CA_PATH}"; + env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: KUBE_API_URL + value: "https://172.30.0.1:443" + - name: SA_TOKEN_PATH + value: /var/run/secrets/kubernetes.io/serviceaccount/token + - name: SA_CA_PATH + value: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt + volumeMounts: + - mountPath: /tmp/shared + name: shared + containers: + - name: tests + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + volumeMounts: + - mountPath: /tmp/shared + name: shared + command: ["/bin/bash", "/tmp/shared/entrypoint-tests.sh"] + env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: PLUGIN_NAME + value: openshift-tests-replay + - name: DEFAULT_SUITE_NAME + value: all + - name: OT_RUN_COMMAND + value: run + +sonobuoy-config: + driver: Job + plugin-name: 80-openshift-tests-replay + result-format: junit + description: | + OPCT plugin to collect e2e failures from previous executions and + schedule a new execution running in serial mode with openshift-tests. + source-url: | + https://github.com/redhat-openshift-ecosystem/provider-certification-tool/\ + blob/main/manifests/openshift-conformance-validated.yaml + skipCleanup: true +spec: + name: plugin + image: "{{ .PluginsImage }}" + command: + - "/bin/sh" + - "-c" + - "/usr/bin/openshift-tests-plugin run --name ${PLUGIN_NAME}" + imagePullPolicy: Always + volumeMounts: + - mountPath: /tmp/sonobuoy/results + name: results + - mountPath: /tmp/shared + name: shared + env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: PLUGIN_NAME + value: openshift-tests-replay + - name: PLUGIN_ID + value: "80" + - name: ENV_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: ENV_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: ENV_POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: RUN_MODE + valueFrom: + configMapKeyRef: + name: plugins-config + key: run-mode + - name: DEV_MODE_COUNT + valueFrom: + configMapKeyRef: + name: plugins-config + key: dev-count + - name: MIRROR_IMAGE_REPOSITORY + valueFrom: + configMapKeyRef: + name: plugins-config + key: mirror-registry + optional: true diff --git a/data/templates/plugins/openshift-conformance-validated.yaml b/data/templates/plugins/openshift-conformance-validated.yaml index e4b05ca4..c3b5e0f7 100644 --- a/data/templates/plugins/openshift-conformance-validated.yaml +++ b/data/templates/plugins/openshift-conformance-validated.yaml @@ -1,53 +1,91 @@ +--- podSpec: restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + priorityClassName: system-node-critical volumes: - name: shared emptyDir: {} - containers: - - name: report-progress + initContainers: + - name: sync image: "{{ .PluginsImage }}" imagePullPolicy: Always - priorityClassName: system-node-critical - command: ["./report-progress.sh"] + command: + - "/bin/bash" + - "-c" + - "cp -vf ./entrypoint-tests.sh ./platform.sh /tmp/shared/" volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared + - mountPath: /tmp/shared + name: shared + - name: login + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + command: + - "/bin/bash" + - "-c" + - | + /usr/bin/oc login "${KUBE_API_URL}" \ + --token="$(cat "${SA_TOKEN_PATH}")" \ + --certificate-authority="${SA_CA_PATH}"; env: - - name: PLUGIN_ID - value: "20" - - name: ENV_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: ENV_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: ENV_POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace + - name: KUBECONFIG + value: "/tmp/shared/kubeconfig" + - name: KUBE_API_URL + value: "https://172.30.0.1:443" + - name: SA_TOKEN_PATH + value: "/var/run/secrets/kubernetes.io/serviceaccount/token" + - name: SA_CA_PATH + value: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" + volumeMounts: + - mountPath: /tmp/shared + name: shared + containers: + - name: tests + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + volumeMounts: + - mountPath: /tmp/shared + name: shared + command: ["/bin/bash", "/tmp/shared/entrypoint-tests.sh"] + env: + - name: KUBECONFIG + value: "/tmp/shared/kubeconfig" + - name: DEFAULT_SUITE_NAME + value: "openshift/conformance" + - name: OT_RUN_COMMAND + value: "run" + - name: PLUGIN_NAME + value: "openshift-conformance-validated" + sonobuoy-config: driver: Job plugin-name: 20-openshift-conformance-validated result-format: junit - description: The end-to-end tests maintained by OpenShift to certify the Provider running the OpenShift Container Platform. - source-url: https://github.com/redhat-openshift-ecosystem/provider-certification-tool/blob/main/manifests/openshift-conformance-validated.yaml + description: | + OPCT plugin to schedule e2e tests using openshift-tests tool to validate + an OpenShift Container Platform cluster installed in a specific provider. + source-url: + "https://github.com/redhat-openshift-ecosystem/provider-certification-tool/\ + blob/main/manifests/openshift-conformance-validated.yaml" skipCleanup: true spec: name: plugin image: "{{ .PluginsImage }}" + command: + - "/bin/sh" + - "-c" + - "/usr/bin/openshift-tests-plugin run --name ${PLUGIN_NAME}" imagePullPolicy: Always - priorityClassName: system-node-critical volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared + - mountPath: /tmp/sonobuoy/results + name: results + - mountPath: /tmp/shared + name: shared env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: PLUGIN_NAME + value: "openshift-conformance-validated" - name: PLUGIN_ID value: "20" - name: ENV_NODE_NAME diff --git a/data/templates/plugins/openshift-kube-conformance.yaml b/data/templates/plugins/openshift-kube-conformance.yaml index 79279af0..03a787c5 100644 --- a/data/templates/plugins/openshift-kube-conformance.yaml +++ b/data/templates/plugins/openshift-kube-conformance.yaml @@ -1,53 +1,91 @@ +--- podSpec: restartPolicy: Never serviceAccountName: sonobuoy-serviceaccount + priorityClassName: system-node-critical volumes: - name: shared emptyDir: {} - containers: - - name: report-progress + initContainers: + - name: sync image: "{{ .PluginsImage }}" imagePullPolicy: Always - priorityClassName: system-node-critical - command: ["./report-progress.sh"] + command: + - "/bin/bash" + - "-c" + - "cp -vf ./entrypoint-tests.sh ./platform.sh /tmp/shared/" volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared + - mountPath: /tmp/shared + name: shared + - name: login + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + command: + - "/bin/bash" + - "-c" + - | + /usr/bin/oc login "${KUBE_API_URL}" \ + --token="$(cat "${SA_TOKEN_PATH}")" \ + --certificate-authority="${SA_CA_PATH}"; env: - - name: PLUGIN_ID - value: "10" - - name: ENV_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: ENV_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: ENV_POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace + - name: KUBECONFIG + value: "/tmp/shared/kubeconfig" + - name: KUBE_API_URL + value: "https://172.30.0.1:443" + - name: SA_TOKEN_PATH + value: "/var/run/secrets/kubernetes.io/serviceaccount/token" + - name: SA_CA_PATH + value: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" + volumeMounts: + - mountPath: /tmp/shared + name: shared + containers: + - name: tests + image: "{{ .OpenshiftTestsImage }}" + imagePullPolicy: Always + volumeMounts: + - mountPath: /tmp/shared + name: shared + command: ["/bin/bash", "/tmp/shared/entrypoint-tests.sh"] + env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: DEFAULT_SUITE_NAME + value: "kubernetes/conformance" + - name: OT_RUN_COMMAND + value: "run" + - name: PLUGIN_NAME + value: "openshift-kube-conformance" + sonobuoy-config: driver: Job plugin-name: 10-openshift-kube-conformance result-format: junit - description: The end-to-end tests maintained by Kubernetes to certify the platform. - source-url: https://github.com/redhat-openshift-ecosystem/provider-certification-tool/blob/main/manifests/openshift-kube-conformance.yaml + description: | + OPCT plugin to schedule e2e tests using openshift-tests tool to validate + an OpenShift Container Platform cluster installed in a specific provider. + source-url: + "https://github.com/redhat-openshift-ecosystem/provider-certification-tool/\ + blob/main/manifests/openshift-kube-conformance.yaml" skipCleanup: true spec: name: plugin image: "{{ .PluginsImage }}" + command: + - "/bin/sh" + - "-c" + - "/usr/bin/openshift-tests-plugin run --name ${PLUGIN_NAME}" imagePullPolicy: Always - priorityClassName: system-node-critical volumeMounts: - - mountPath: /tmp/sonobuoy/results - name: results - - mountPath: /tmp/shared - name: shared + - mountPath: /tmp/sonobuoy/results + name: results + - mountPath: /tmp/shared + name: shared env: + - name: KUBECONFIG + value: /tmp/shared/kubeconfig + - name: PLUGIN_NAME + value: "openshift-kube-conformance" - name: PLUGIN_ID value: "10" - name: ENV_NODE_NAME diff --git a/pkg/cmd/get/images.go b/pkg/cmd/get/images.go index c98ee84d..d532ad7f 100644 --- a/pkg/cmd/get/images.go +++ b/pkg/cmd/get/images.go @@ -5,7 +5,6 @@ import ( "github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg" "github.com/spf13/cobra" - "github.com/vmware-tanzu/sonobuoy/pkg/buildinfo" ) type imageOptions struct { @@ -36,15 +35,15 @@ func generateImage(repo, name string) string { } func runGetImages(cmd *cobra.Command, args []string) { - images := []string{} // Sonobuoy - images = append(images, generateImage("quay.io/ocp-cert", fmt.Sprintf("sonobuoy:%s", buildinfo.Version))) + images = append(images, generateImage(pkg.DefaultToolsRepository, pkg.SonobuoyImage)) // Plugins - images = append(images, generateImage("quay.io/ocp-cert", pkg.PluginsImage)) - images = append(images, generateImage("quay.io/opct", "must-gather-monitoring:v0.1.0")) + images = append(images, generateImage(pkg.DefaultToolsRepository, pkg.PluginsImage)) + images = append(images, generateImage(pkg.DefaultToolsRepository, pkg.CollectorImage)) + images = append(images, generateImage(pkg.DefaultToolsRepository, pkg.MustGatherMonitoringImage)) // etcdfio img_etcdfio := "quay.io/openshift-scale/etcd-perf:latest" diff --git a/pkg/run/run.go b/pkg/run/run.go index ff6cffd1..662974ee 100644 --- a/pkg/run/run.go +++ b/pkg/run/run.go @@ -39,16 +39,23 @@ type RunOptions struct { dedicated bool sonobuoyImage string imageRepository string + // PluginsImage // defines the image containing plugins associated with the provider-certification-tool. // this variable is referenced by plugin manifest templates to dynamically reference the plugins image. - PluginsImage string + PluginsImage string + CollectorImage string + MustGatherMonitoringImage string + OpenshiftTestsImage string + timeout int watch bool watchInterval int - devCount string mode string upgradeImage string + + // devel flags + devCount string } const ( @@ -147,22 +154,37 @@ func NewCmdRun() *cobra.Command { }, } - cmd.Flags().BoolVar(&o.dedicated, "dedicated", defaultDedicatedFlag, "Setup plugins to run in dedicated test environment.") - cmd.Flags().StringVar(&o.devCount, "dev-count", "0", "Developer Mode only: run small random set of tests. Default: 0 (disabled)") cmd.Flags().StringVar(&o.mode, "mode", defaultRunMode, "Run mode: Availble: regular, upgrade") cmd.Flags().StringVar(&o.upgradeImage, "upgrade-to-image", defaultUpgradeImage, "Target OpenShift Release Image. Example: oc adm release info 4.11.18 -o jsonpath={.image}") - cmd.Flags().StringArrayVar(o.plugins, "plugin", nil, "Override default conformance plugins to use. Can be used multiple times. (default plugins can be reviewed with assets subcommand)") - cmd.Flags().StringVar(&o.sonobuoyImage, "sonobuoy-image", fmt.Sprintf("%s/sonobuoy:%s", pkg.DefaultToolsRepository, buildinfo.Version), "Image override for the Sonobuoy worker and aggregator") - cmd.Flags().StringVar(&o.PluginsImage, "plugins-image", pkg.PluginsImage, "Image containing plugins to be executed.") cmd.Flags().StringVar(&o.imageRepository, "image-repository", "", "Image repository containing required images test environment. Example: openshift-provider-cert-tool --mirror-repository mirror.repository.net/ocp-cert") cmd.Flags().IntVar(&o.timeout, "timeout", defaultRunTimeoutSeconds, "Execution timeout in seconds") cmd.Flags().BoolVarP(&o.watch, "watch", "w", defaultRunWatchFlag, "Keep watch status after running") cmd.Flags().IntVarP(&o.watchInterval, "watch-interval", "", status.DefaultStatusIntervalSeconds, "Interval to watch the status and print in the stdout") - // Hide optional flags + // Flags use for maitainance / development / CI. Those are intentionally hidden. + cmd.Flags().StringArrayVar(o.plugins, "plugin", nil, "Override default conformance plugins to use. Can be used multiple times. (default plugins can be reviewed with assets subcommand)") + cmd.Flags().BoolVar(&o.dedicated, "dedicated", defaultDedicatedFlag, "Setup plugins to run in dedicated test environment.") + cmd.Flags().StringVar(&o.devCount, "dev-count", "0", "Developer Mode only: run small random set of tests. Default: 0 (disabled)") + + hideOptionalFlags(cmd, "plugin") hideOptionalFlags(cmd, "dedicated") hideOptionalFlags(cmd, "dev-count") + + // Override build-int images use by plugins/steps in the standard workflow. + cmd.Flags().StringVar(&o.sonobuoyImage, "sonobuoy-image", pkg.GetSonobuoyImage(), "Image override for the Sonobuoy worker and aggregator") + cmd.Flags().StringVar(&o.PluginsImage, "plugins-image", pkg.GetPluginsImage(), "Image containing plugins to be executed.") + cmd.Flags().StringVar(&o.CollectorImage, "collector-image", pkg.GetCollectorImage(), "Image containing the collector plugin.") + cmd.Flags().StringVar(&o.MustGatherMonitoringImage, "must-gather-monitoring-image", pkg.GetMustGatherMonitoring(), "Image containing the must-gather monitoring plugin.") + + // devel can be override by quay.io/opct/openshift-tests:devel + // opct run --devel-skip-checks=true --plugins-image=plugin-openshift-tests:v0.0.0-devel-8ff93d9 --openshift-tests-image=quay.io/opct/openshift-tests:devel + cmd.Flags().StringVar(&o.OpenshiftTestsImage, "openshift-tests-image", pkg.OpenShiftTestsImage, "Developer Mode only: openshift-tests image override") + + hideOptionalFlags(cmd, "sonobuoy-image") hideOptionalFlags(cmd, "plugins-image") + hideOptionalFlags(cmd, "collector-image") + hideOptionalFlags(cmd, "must-gather-monitoring-image") + hideOptionalFlags(cmd, "openshift-tests-image") return cmd } @@ -459,13 +481,13 @@ func (r *RunOptions) Run(kclient kubernetes.Interface, sclient sonobuoyclient.In imageRepository = r.imageRepository log.Infof("Mirror registry is configured %s ", r.imageRepository) } - // the flag --sonobuoy-image should not be used in default validation. - if overrideSonobuoyImageSet { - log.Warn("Flag --sonobuoy-image is not supported in official validation process, unset it if you are submitting the results to Red Hat.") - } else { - r.sonobuoyImage = fmt.Sprintf("%s/sonobuoy:%s", imageRepository, buildinfo.Version) + if imageRepository != pkg.DefaultToolsRepository { + log.Infof("Setting up images for custom image repository %s", imageRepository) + r.sonobuoyImage = fmt.Sprintf("%s/%s", imageRepository, pkg.SonobuoyImage) + r.PluginsImage = fmt.Sprintf("%s/%s", imageRepository, pkg.PluginsImage) + r.CollectorImage = fmt.Sprintf("%s/%s", imageRepository, pkg.CollectorImage) + r.MustGatherMonitoringImage = fmt.Sprintf("%s/%s", imageRepository, pkg.MustGatherMonitoringImage) } - r.PluginsImage = fmt.Sprintf("%s/%s", imageRepository, r.PluginsImage) // Let Sonobuoy do some preflight checks before we run errs := sclient.PreflightChecks(&sonobuoyclient.PreflightConfig{ diff --git a/pkg/types.go b/pkg/types.go index 3e452436..16cd9d8e 100644 --- a/pkg/types.go +++ b/pkg/types.go @@ -1,5 +1,11 @@ package pkg +import ( + "fmt" + + "github.com/vmware-tanzu/sonobuoy/pkg/buildinfo" +) + const ( PrivilegedClusterRole = "opct-scc-privileged" PrivilegedClusterRoleBinding = "opct-scc-privileged" @@ -12,8 +18,15 @@ const ( SonobuoyLabelNamespaceName = "namespace" SonobuoyLabelComponentName = "component" SonobuoyLabelComponentValue = "sonobuoy" - DefaultToolsRepository = "quay.io/ocp-cert" - PluginsImage = "openshift-tests-provider-cert:v0.5.0-alpha.1" + DefaultToolsRepository = "quay.io/opct" + PluginsImage = "plugin-openshift-tests:v0.5.0-alpha.5" + CollectorImage = "plugin-artifacts-collector:v0.5.0-alpha.5" + MustGatherMonitoringImage = "must-gather-monitoring:v0.5.0-alpha.5" + OpenShiftTestsImage = "image-registry.openshift-image-registry.svc:5000/openshift/tests" +) + +var ( + SonobuoyImage = fmt.Sprintf("sonobuoy:%s", buildinfo.Version) ) var ( @@ -28,3 +41,19 @@ var ( "pod-security.kubernetes.io/warn": "privileged", } ) + +func GetSonobuoyImage() string { + return fmt.Sprintf("%s/%s", DefaultToolsRepository, SonobuoyImage) +} + +func GetPluginsImage() string { + return fmt.Sprintf("%s/%s", DefaultToolsRepository, PluginsImage) +} + +func GetCollectorImage() string { + return fmt.Sprintf("%s/%s", DefaultToolsRepository, CollectorImage) +} + +func GetMustGatherMonitoring() string { + return fmt.Sprintf("%s/%s", DefaultToolsRepository, MustGatherMonitoringImage) +}