Skip to content

Commit

Permalink
Allows default ACP and ASUP images to be configured by CI
Browse files Browse the repository at this point in the history
  • Loading branch information
reederc42 authored Sep 14, 2023
1 parent b643c35 commit 6e98a01
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
8 changes: 8 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions operator/controllers/orchestrator/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ func (i *Installer) setInstallationParams(
autosupportImage = commonconfig.DefaultAutosupportImage
httpTimeout = commonconfig.HTTPTimeoutString
imagePullPolicy = DefaultImagePullPolicy
acpImage = commonconfig.DefaultACPImage

imagePullSecrets = []string{}

Expand Down

0 comments on commit 6e98a01

Please sign in to comment.