feat: add environment values handling for automatic host patching#4
feat: add environment values handling for automatic host patching#4
Conversation
Reads environment-values.env from the overlay directory and generates kustomize patches for recognized keys (EXTERNAL_HOST). Supports simple mode (replace all hosts) and mapping mode (old->new pairs) for Ingress and HTTPRoute resources. Includes idempotency cleanup, resource discovery via kustomize build with file scan fallback, and robust parsing that skips malformed lines. 68 tests covering core functionality and backward compatibility.
| description: 'Name of the environment values file to read from the overlay directory' | ||
| required: false | ||
| default: 'environment-values.env' | ||
| patch_prefix: |
There was a problem hiding this comment.
why do we need this? isn't this just temp for the CI job? not sure why this would be worthwhile for someone to bother with changing?
There was a problem hiding this comment.
u mean specially the 'patch_prefix'?
We intend this will be used for ephemeral use case only.
However, if someone will use this feature for a non ephemeral use case.
Or if preview env will be persisted to git (i.e because using argocd).
Then the result files will have random file names, this will be ugly and functionally broken.
|
Fix tests - lets see them passing in CI |
|
Ok having given it more thought I have a few major concerns with this:
|
…ode internals Remove environment_values_file and patch_prefix inputs, and applied_environment_keys and skipped_environment_keys outputs. Hardcode environment-values.env filename and skyhook- prefix for idempotent GitOps behavior.
Summary
kustomize-editthat readsenvironment-values.envand generates kustomize patches for recognized keysEXTERNAL_HOST=preview.myorg.dev— replaces all hostsEXTERNAL_HOST=old->new,old2->new2— replaces specific hostskustomize buildwith recursive file scan fallbackNew inputs
environment_values_file(default:environment-values.env)patch_prefix(default: randomskyhook-<8hex>-)New outputs
applied_environment_keys— comma-separated keys that were processedskipped_environment_keys— comma-separated unrecognized keysTest plan
bash test_environment_values.sh)test_set_images.shtests still pass (57/57)