Skip to content

Allow overrides of Makefile values and include an optional values folder path #493

Description

@wadebee

Use case:
Our team has its own utility container for working within our multicloud environment. We have rebased our container to hybridcloudpatterns/utility-container:latest so we can pick up all required VP tooling.

Our container makes use of a git clone to pull in the validated pattern repo as a subfolder. We include our own Makefile in our DIR_HOME to hand-off to VPs Makefile appropriately.

Containerfile Extract

	FROM mycompany.com/hybridcloudpatterns/utility-container:latest
	ARG CONTAINER_DIR_HOME=/home/root
        ARG MY_REPO_CLI_BRANCH ?= 'dev'
	ARG MY_REPO_CLI_URL=https://github.mycompany.com/my-utility-container.git
	ARG VP_DIR_MULTICLOUD=vp-multicloud-gitops
	ARG VP_DIR_VALUES=vp-values
        ARG VP_PATTERN_NAME=my-pattern
        ARG VP_REPO_MULTICLOUD_BRANCH=main
	ARG VP_REPO_MULTICLOUD_URL=https://github.com/validatedpatterns/multicloud-gitops.git
	
	RUN git clone --depth 1 ${VP_REPO_MULTICLOUD_URL} ${CONTAINER_DIR_HOME}/${VP_DIR_MULTICLOUD}; \
	    rm ${CONTAINER_DIR_HOME}/${VP_DIR_MULTICLOUD}/.github -R; \
	    rm ${CONTAINER_DIR_HOME}/${VP_DIR_MULTICLOUD}/.gitignore; 
	
	COPY ${VP_DIR_VALUES}/                 ${CONTAINER_DIR_HOME}/${VP_DIR_MULTICLOUD}/${VP_DIR_VALUES}
	COPY ./Makefile                        ${CONTAINER_DIR_HOME}
	
	ENV KUBECONFIG=${CONTAINER_DIR_HOME}/.kube/config \
            VP_DIR_MULTICLOUD=${VP_DIR_MULTICLOUD} \
            VP_DIR_VALUES=${VP_DIR_VALUES} \
            VP_REPO_MULTICLOUD_BRANCH=${VP_REPO_MULTICLOUD_BRANCH} \
            VP_REPO_MULTICLOUD_URL=${VP_REPO_MULTICLOUD_URL} \
            VP_PATTERN_NAME=${VP_PATTERN_NAME} 
	
	WORKDIR ${CONTAINER_DIR_HOME}
	ENTRYPOINT ["sh", "run.sh"]
	CMD ["help"]

Makefile

	export MY_REPO_CLI_BRANCH ?= 'main'
	export MY_REPO_CLI_ORIGIN ?= 'origin'
	export MY_REPO_CLI_URL ?= 'https://github.mycompany.com/my-utility-container.git'

	export VP_DIR_VALUES ?= 'my-default-vp-values-path'
	export VP_DIR_MULTICLOUD ?= 'my-default-vp-mc-path'
	export VP_PATTERN_NAME ?= 'my-default-pattern'
	export VP_REPO_MULTICLOUD_BRANCH ?= 'main'
	export VP_REPO_MULTICLOUD_URL ?= 'https://github.com/validatedpatterns/multicloud-gitops.git'
	
	export NAME ?= ${VP_PATTERN_NAME}
	export TARGET_ORIGIN ?= ${MY_REPO_CLI_ORIGIN}
	export TARGET_REPO ?= ${MY_REPO_CLI_URL}
	export TARGET_BRANCH ?= ${MY_REPO_CLI_BRANCH}
	
	%:
		@make $* -C vp-multicloud-gitops

Requested Changes

To facilitate the use case above I am requesting modifications be made to common/Makefile as follows:

  • Add a line 2 to contain a new variable that will serve as a folder path prefix for our company's value files.

VP_DIR_VALUES ?= '.'

  • Modify line 19

TARGET_REPO ?= $[….]

  • Modify line 21

TARGET_BRANCH ?= $[….]

The last set of changes I will leave to you but effectively any VP references to value files should be prefixed with $(VP_DIR_VALUES).

Example changes I have found so far include common/Makefile line 39 and 43:

HELM_OPTS=-f $(VP_DIR_VALUES)/values-global.yaml

And line 65:

$(eval CLUSTERGROUP ?= $(shell yq ".main.clusterGroupName" $(VP_DIR_VALUES)/values-global.yaml))

I believe other files are involved in this update as well like common/scripts/preview.sh.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions