From 6e98a01dd999d1c18eea51b74a287e7a5a758489 Mon Sep 17 00:00:00 2001 From: reederc42 Date: Thu, 14 Sep 2023 11:58:14 -0700 Subject: [PATCH] Allows default ACP and ASUP images to be configured by CI --- BUILD.md | 8 ++++++++ Makefile | 10 ++++++++-- cli/cmd/install.go | 3 ++- config/config.go | 8 ++++++-- .../controllers/orchestrator/installer/installer.go | 1 + 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/BUILD.md b/BUILD.md index bf75a7699..21daab51d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -130,6 +130,14 @@ Path to buildkitd config file for docker buildx. Used to configure buildx contex registry mirrors. See docker (https://docs.docker.com/engine/reference/commandline/buildx_create/#config) and buildkit (https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md) docs for more options and examples. +`DEFAULT_AUTOSUPPORT_IMAGE` + +Override the default asup image in tridentctl and operator + +`DEFAULT_ACP_IMAGE` + +Override the default acp image in tridentctl and operator + Example file: ```shell # insecure, local/private registry, set $PRIVATE_REGISTRY to appropriate value diff --git a/Makefile b/Makefile index 518cd39b1..1be4fae2a 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,12 @@ OPERATOR_MANIFEST_TAG ?= $(OPERATOR_TAG) # cross-platform builds, see example config: https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md BUILDX_CONFIG_FILE ?= +# DEFAULT_AUTOSUPPORT_IMAGE override the default asup image in tridentctl and operator +DEFAULT_AUTOSUPPORT_IMAGE ?= + +# DEFAULT_ACP_IMAGE override the default acp image in tridentctl and operator +DEFAULT_ACP_IMAGE ?= + # Constants ALL_PLATFORMS = linux/amd64 linux/arm64 windows/amd64/ltsc2022 windows/amd64/1809 darwin/amd64 DEFAULT_REGISTRY = docker.io/netapp @@ -118,8 +124,8 @@ TRIDENT_IMAGE_REPO := $(REGISTRY)/$(TRIDENT_IMAGE): DEFAULT_OPERATOR_TAG := $(DEFAULT_REGISTRY)/$(OPERATOR_IMAGE):$(VERSION) # linker flags need to be properly encapsulated with double quotes to handle spaces in values -LINKER_FLAGS = "-s -w -X \"$(TRIDENT_CONFIG_PKG).BuildHash=$(GITHASH)\" -X \"$(TRIDENT_CONFIG_PKG).BuildType=$(BUILD_TYPE)\" -X \"$(TRIDENT_CONFIG_PKG).BuildTypeRev=$(BUILD_TYPE_REV)\" -X \"$(TRIDENT_CONFIG_PKG).BuildTime=$(BUILD_TIME)\" -X \"$(TRIDENT_CONFIG_PKG).BuildImage=$(TRIDENT_TAG)\" -X \"$(OPERATOR_CONFIG_PKG).BuildImage=$(OPERATOR_TAG)\"" -OPERATOR_LINKER_FLAGS = "-s -w -X \"$(OPERATOR_CONFIG_PKG).BuildHash=$(GITHASH)\" -X \"$(OPERATOR_CONFIG_PKG).BuildType=$(BUILD_TYPE)\" -X \"$(OPERATOR_CONFIG_PKG).BuildTypeRev=$(BUILD_TYPE_REV)\" -X \"$(OPERATOR_CONFIG_PKG).BuildTime=$(BUILD_TIME)\" -X \"$(OPERATOR_CONFIG_PKG).BuildImage=$(OPERATOR_TAG)\" -X \"$(OPERATOR_INSTALLER_CONFIG_PKG).DefaultTridentVersion=$(TRIDENT_VERSION)\" -X \"$(OPERATOR_INSTALLER_CONFIG_PKG).DefaultTridentRepo=$(TRIDENT_IMAGE_REPO)\"" +LINKER_FLAGS = "-s -w -X \"$(TRIDENT_CONFIG_PKG).BuildHash=$(GITHASH)\" -X \"$(TRIDENT_CONFIG_PKG).BuildType=$(BUILD_TYPE)\" -X \"$(TRIDENT_CONFIG_PKG).BuildTypeRev=$(BUILD_TYPE_REV)\" -X \"$(TRIDENT_CONFIG_PKG).BuildTime=$(BUILD_TIME)\" -X \"$(TRIDENT_CONFIG_PKG).BuildImage=$(TRIDENT_TAG)\" -X \"$(OPERATOR_CONFIG_PKG).BuildImage=$(OPERATOR_TAG)\"$(if $(DEFAULT_AUTOSUPPORT_IMAGE), -X \"$(TRIDENT_CONFIG_PKG).DefaultAutosupportImage=$(DEFAULT_AUTOSUPPORT_IMAGE)\")$(if $(DEFAULT_ACP_IMAGE), -X \"$(TRIDENT_CONFIG_PKG).DefaultACPImage=$(DEFAULT_ACP_IMAGE)\")" +OPERATOR_LINKER_FLAGS = "-s -w -X \"$(OPERATOR_CONFIG_PKG).BuildHash=$(GITHASH)\" -X \"$(OPERATOR_CONFIG_PKG).BuildType=$(BUILD_TYPE)\" -X \"$(OPERATOR_CONFIG_PKG).BuildTypeRev=$(BUILD_TYPE_REV)\" -X \"$(OPERATOR_CONFIG_PKG).BuildTime=$(BUILD_TIME)\" -X \"$(OPERATOR_CONFIG_PKG).BuildImage=$(OPERATOR_TAG)\" -X \"$(OPERATOR_INSTALLER_CONFIG_PKG).DefaultTridentVersion=$(TRIDENT_VERSION)\" -X \"$(OPERATOR_INSTALLER_CONFIG_PKG).DefaultTridentRepo=$(TRIDENT_IMAGE_REPO)\"$(if $(DEFAULT_AUTOSUPPORT_IMAGE), -X \"$(TRIDENT_CONFIG_PKG).DefaultAutosupportImage=$(DEFAULT_AUTOSUPPORT_IMAGE)\")$(if $(DEFAULT_ACP_IMAGE), -X \"$(TRIDENT_CONFIG_PKG).DefaultACPImage=$(DEFAULT_ACP_IMAGE)\")" # Functions diff --git a/cli/cmd/install.go b/cli/cmd/install.go index 68e5c50d6..5c82a90f8 100644 --- a/cli/cmd/install.go +++ b/cli/cmd/install.go @@ -223,7 +223,8 @@ func init() { "Override the HTTP request timeout for Trident controller’s REST API") installCmd.Flags().BoolVar(&enableACP, "enable-acp", false, "Enable the trident-acp premium features.") - installCmd.Flags().StringVar(&acpImage, "acp-image", "", "Override the default trident-acp container image.") + installCmd.Flags().StringVar(&acpImage, "acp-image", tridentconfig.DefaultACPImage, + "Override the default trident-acp container image.") if err := installCmd.Flags().MarkHidden("skip-k8s-version-check"); err != nil { _, _ = fmt.Fprintln(os.Stderr, err) diff --git a/config/config.go b/config/config.go index ba152f002..c6385710c 100644 --- a/config/config.go +++ b/config/config.go @@ -176,8 +176,6 @@ const ( /* Kubernetes operator constants */ OperatorContainerName = "trident-operator" - DefaultAutosupportImage = "docker.io/netapp/trident-autosupport:23.07" - // IscsiSelfHealingInterval is an interval with which the iSCSI self-healing thread is called periodically IscsiSelfHealingInterval = 300 * time.Second @@ -252,6 +250,12 @@ var ( // DisableExtraFeatures makes a subset of Trident features disabled // This can be removed when ACP replaces feature-gating DisableExtraFeatures = false + + // DefaultAutosupportImage default image used by tridentctl and operator for asup sidecar + DefaultAutosupportImage = "docker.io/netapp/trident-autosupport:23.07" + + // DefaultACPImage default image used by tridentctl and operator for acp sidecar + DefaultACPImage = "" ) func IsValidProtocol(p Protocol) bool { diff --git a/operator/controllers/orchestrator/installer/installer.go b/operator/controllers/orchestrator/installer/installer.go index e694f421d..c26f883bc 100644 --- a/operator/controllers/orchestrator/installer/installer.go +++ b/operator/controllers/orchestrator/installer/installer.go @@ -286,6 +286,7 @@ func (i *Installer) setInstallationParams( autosupportImage = commonconfig.DefaultAutosupportImage httpTimeout = commonconfig.HTTPTimeoutString imagePullPolicy = DefaultImagePullPolicy + acpImage = commonconfig.DefaultACPImage imagePullSecrets = []string{}