Created
October 17, 2022 23:30
-
-
Save pivotaljohn/9024a4184c5dd183c345467715ad4739 to your computer and use it in GitHub Desktop.
Simpler ConfigMap overriding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
labels: | |
label1: value1 | |
name: service1 | |
data: | |
PVC: "false" | |
ENDPOINT: http://internal-api:8080/api/v1/scan | |
PATH: /test1 | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
labels: | |
label1: value1 | |
name: service2 | |
data: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:data", "data") | |
#@ load("@ytt:overlay", "overlay") | |
#@ for app_name in dir(data.values.configmaps): | |
#@ if hasattr(data.values.configmaps[app_name], "dev"): | |
#@overlay/match by=overlay.subset({"kind": "ConfigMap", "metadata": {"name": app_name}}) | |
--- | |
#@overlay/match-child-defaults missing_ok=True | |
data: #@ data.values.configmaps[app_name].dev | |
#@ end | |
#@ end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@data/values-schema | |
--- | |
configmaps: | |
service1: | |
dev: | |
DB_HOST: 192.168.1.1 | |
DB_USER: service1_dev | |
service2: | |
dev: | |
DB_HOST: 192.168.1.2 | |
DB_USER: service2_dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment