Skip to content

Commit 49fe346

Browse files
RHCLOUD-41924: Externalize caddy config data to ConfigMaps (#196)
* Handle external configmap data for proxy config * Use ONLY configmap for frontend dev proxy route config * chrome asset path changed
1 parent c65c90d commit 49fe346

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

pipelines/platform-ui/docker-build-run-all-tests.yaml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ spec:
123123
- description: Script run by the run-application sidecar
124124
name: run-app-script
125125
type: string
126-
- description: Proxy route data to be incorportated in frontend-development-proxy Caddyfile
127-
name: frontend-proxy-routes
126+
- description: Name of ConfigMap containing proxy routes data
127+
name: frontend-proxy-routes-configmap
128128
type: string
129+
default: ""
129130
- description: Application port (default 8000)
130131
name: e2e-app-port
131132
type: string
@@ -720,8 +721,8 @@ spec:
720721
value: $(params.e2e-tests-script)
721722
- name: run-app-script
722723
value: $(params.run-app-script)
723-
- name: PROXY_ROUTES
724-
value: $(params.frontend-proxy-routes)
724+
- name: PROXY_ROUTES_CONFIGMAP
725+
value: $(params.frontend-proxy-routes-configmap)
725726
- name: APP_PORT
726727
value: $(params.e2e-app-port)
727728
- name: PLAYWRIGHT_IMAGE
@@ -752,8 +753,8 @@ spec:
752753
- description: The script to run the application
753754
name: run-app-script
754755
type: string
755-
- description: Proxy routes
756-
name: PROXY_ROUTES
756+
- description: Name of ConfigMap containing proxy routes data
757+
name: PROXY_ROUTES_CONFIGMAP
757758
type: string
758759
- description: Application port (default 8000)
759760
name: APP_PORT
@@ -775,6 +776,13 @@ spec:
775776
emptyDir: {}
776777
- name: proxy-config
777778
emptyDir: {}
779+
- name: proxy-routes-configmap
780+
configMap:
781+
name: $(params.PROXY_ROUTES_CONFIGMAP)
782+
optional: true
783+
items:
784+
- key: routes
785+
path: routes
778786
- name: chrome-dev-caddyfile
779787
emptyDir: {}
780788
stepTemplate:
@@ -946,7 +954,7 @@ spec:
946954
}
947955
948956
:9912 {
949-
root * /opt/app-root/src/build/stable
957+
root * /srv/dist
950958
951959
# Handle /apps/chrome* requests - strip prefix and serve
952960
@app_match {
@@ -1011,19 +1019,29 @@ spec:
10111019
script: |
10121020
#!/bin/sh
10131021
set -e
1014-
echo "Generating proxy routes configuration..."
1015-
# The frontend proxy image expects the data to be in /config/routes
1016-
# Write the proxy routes script to the expected place
1017-
cat > /config/routes << 'SCRIPT_EOF'
1018-
$(params.PROXY_ROUTES)
1019-
SCRIPT_EOF
10201022
1023+
# Check if ConfigMap data is available
1024+
if [ ! -f /configmap-data/routes ]; then
1025+
echo "ERROR: ConfigMap routes file not found at /configmap-data/routes"
1026+
echo "Please ensure the ConfigMap is properly configured with a 'routes' key"
1027+
exit 1
1028+
fi
1029+
1030+
if [ ! -s /configmap-data/routes ]; then
1031+
echo "ERROR: ConfigMap routes file is empty"
1032+
exit 1
1033+
fi
1034+
1035+
echo "Using routes from ConfigMap..."
1036+
cp /configmap-data/routes /config/routes
10211037
chmod 644 /config/routes
1022-
echo "Proxy routes configured successfully:"
1038+
echo "Routes content:"
10231039
cat /config/routes
10241040
volumeMounts:
10251041
- name: proxy-config
10261042
mountPath: /config
1043+
- name: proxy-routes-configmap
1044+
mountPath: /configmap-data
10271045
- image: $(params.PLAYWRIGHT_IMAGE)
10281046
env:
10291047
- name: NO_PROXY

0 commit comments

Comments
 (0)