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

templatize ev2 gap #825

Merged
merged 4 commits into from
Nov 14, 2024
Merged

templatize ev2 gap #825

merged 4 commits into from
Nov 14, 2024

Conversation

geoberle
Copy link
Collaborator

@geoberle geoberle commented Nov 11, 2024

What this PR does

This PR tries to close the gap between templatize current haviour and EV2s mode of operations.

Name generation

This PR removes the name generator functions e.g. azureKeyVaultName since for EV2 the real names need to be determined at runtime not at buildtime. so we restrict ourselves to only use ctx.region ctx.regionShort and ctx.stamp
this sadly has the impact that certain names for resources will change and that means it is disruptive for DEVs and our permantent DEV envs. after merging this, ENVs need to be recreated.

Generate with EV2 placeholders

generate an output file and replaces all placeholders with EV2 double-underscore ones when --ev2-placeholders is specified. this supports delayed evaluation of variables to distinguish between the EV2 build and run stage. this also means that the naming functions like azureKeyVaultName have been removed. Instead region-short has been introduced to have a short region name (as defined by EV2) available for resource naming that will not exceed lenght limitations.

templatize generate ... --ev2-placeholders --input xx --output xx`

SERVICE_KV ?= __SERVICEKEYVAULTNAME__
OIDC_STORAGE_ACCOUNT ?= __OIDCSTORAGEACCOUNTNAME__
IMAGE_REPO ?= __CLUSTERSERVICEIMAGEREPO__

EV2 ServiceConfig helper

in order to support the generation of a ServiceConfig.json, the pkg.ev2.GetNonRegionalServiceConfigVariables function can be used to fetch the variables from config.yaml that should go into a service configs global section. all variable values are formatted in a way to support EV2 system variables, e.g. $location(), $stamp(), $(someOtherConfigValue)

the pkg.ev2.GetNonRegionalServiceConfigVariables function can be used to fetch the regional overrides for a deploy env, again formatted for EV2 system variable usage.

EV2 ScopeBinding helper

the pkg.ev2.ScopeBindingVariables function can be used to extract a find/replace suitable variable list for an EV2 ScopeBinding. the result is a dictionary with entries like __VAR__ = $config(var) or __PARENT_CHILD__ = $config(parent.child) for nested configs.

EV2 file preprocess helper

the pkg.ev2.PreprocessFileForEV2 function can be used to process a file with {{}} placeholders into one that uses EV2 system variables like $location() etc.

Pipeline.yaml runner

the EV2 generator from the ADO repository will use a pipeline.yaml file to generate EV2 artifacts (see example in this PR).
it is important that we use this pipeline.yaml declaration also in DEV to drive deployments. this way such declarations remain well maintained.

templatize run-pipeline --config-file config/config.yaml --cloud public --deploy-env personal-dev -p maestro/server/pipeline.yaml --region westus3 --region-short usw3gobe --stamp 1

Right now, only Shell runner is supported. the idea is to revamp the Makefiles so they don't require the config.tmpl.mk files anymore but rely exclusively on ENV variables to be injected as defined in the pipeline.yaml. in DEV, the run-pipeline command will ensure these env vars are set. in higher envs, EV2 will take care of it.

depending on the subscription and RG, the run-pipeline command will provide a suitable kubeconfig. in higher envs EV2 will take care of this.

Jira: https://issues.redhat.com/browse/ARO-12087
Link to demo recording:

Special notes for your reviewer

@geoberle geoberle force-pushed the tooling-func branch 3 times, most recently from 681103d to b893faf Compare November 13, 2024 13:00
Copy link

Please rebase pull request.

Copy link

Please rebase pull request.

tooling/templatize/pkg/pipeline/run.go Outdated Show resolved Hide resolved
tooling/templatize/pkg/pipeline/run.go Outdated Show resolved Hide resolved
tooling/templatize/pkg/pipeline/run.go Outdated Show resolved Hide resolved
tooling/templatize/pkg/pipeline/types.go Outdated Show resolved Hide resolved
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
Copy link
Collaborator

@tony-schndr tony-schndr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@geoberle geoberle merged commit 65de40a into main Nov 14, 2024
21 checks passed
@geoberle geoberle deleted the tooling-func branch November 14, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants