Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wadebee opened this issue Apr 25, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@wadebee
Copy link
Contributor

wadebee commented Apr 25, 2024

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.

@claudiol claudiol self-assigned this May 15, 2024
@claudiol claudiol added the enhancement New feature or request label May 15, 2024
@claudiol
Copy link
Contributor

@wadebee Do we still need this? Just need a reminder to see if you still need this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants