Skip to content

Commit 80cf3cb

Browse files
author
Agent
committed
Switch integration test deployment to httpd mode
Deploy CTS under Apache httpd on port 8080 to match the production runtime, instead of Flask's built-in dev server on port 5005. - Add a cts-config ConfigMap with two files: - config.py: ProdConfiguration (AUTH_BACKEND=noauth, PostgreSQL URI) so init_config loads it via the file-based path without needing CTS_DEVELOPER_ENV. - httpd.conf: minimal Apache + mod_wsgi config listening on 8080. ServerRoot is /etc/httpd so LoadModule paths resolve correctly. All writable paths (PidFile, Mutex, ErrorLog) go under /tmp/httpd which the container creates at startup, avoiding permission issues under OpenShift restricted-v2 SCC. - Mount the ConfigMap at /etc/cts (read-only) in both the migration init container and the main cts container. - Override the main container command to mkdir -p /tmp/httpd/run then exec httpd -DFOREGROUND -f /etc/cts/httpd.conf, bypassing the image default start_cts_from_here script which hardcodes CTS_DEVELOPER_ENV=1. - Remove CTS_DEVELOPER_ENV and SQLALCHEMY_DATABASE_URI env vars from both containers (configuration now comes from the ConfigMap file). - Update all port references from 5005 to 8080: Service port/targetPort, containerPort, readinessProbe, livenessProbe, and CTS_URL in the run-tests step. Fixes #73 Generated-By: OpenCode (google-vertex-anthropic/claude-sonnet-4-6@default)
1 parent 7f048dc commit 80cf3cb

1 file changed

Lines changed: 61 additions & 17 deletions

File tree

.tekton/integration-test-eaas.yaml

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,41 @@ spec:
240240
echo "=========================================="
241241
echo "Image: $IMAGE"
242242
243+
# Create ConfigMap with production configuration and httpd config for CTS
244+
kubectl apply -f - <<EOF
245+
apiVersion: v1
246+
kind: ConfigMap
247+
metadata:
248+
name: cts-config
249+
data:
250+
config.py: |
251+
from conf.config import BaseConfiguration
252+
253+
class ProdConfiguration(BaseConfiguration):
254+
AUTH_BACKEND = "noauth"
255+
SQLALCHEMY_DATABASE_URI = "postgresql://cts:cts-test@cts-db:5432/cts"
256+
httpd.conf: |
257+
ServerRoot /etc/httpd
258+
ServerName localhost
259+
PidFile /tmp/httpd/run/httpd.pid
260+
Mutex file:/tmp/httpd/run default
261+
262+
Listen 8080
263+
264+
LoadModule mpm_event_module modules/mod_mpm_event.so
265+
LoadModule authz_core_module modules/mod_authz_core.so
266+
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi_python3.so
267+
268+
ErrorLog /tmp/httpd/error_log
269+
LogLevel warn
270+
271+
WSGIDaemonProcess cts python-path=/src processes=2 threads=5 \
272+
home=/src display-name=cts
273+
WSGIProcessGroup cts
274+
WSGIApplicationGroup %{GLOBAL}
275+
WSGIScriptAlias / /usr/share/cts/cts.wsgi
276+
EOF
277+
243278
# Deploy CTS
244279
kubectl apply -f - <<EOF
245280
apiVersion: v1
@@ -250,8 +285,8 @@ spec:
250285
app: cts
251286
spec:
252287
ports:
253-
- port: 5005
254-
targetPort: 5005
288+
- port: 8080
289+
targetPort: 8080
255290
name: http
256291
selector:
257292
app: cts
@@ -275,11 +310,6 @@ spec:
275310
initContainers:
276311
- name: run-migrations
277312
image: $IMAGE
278-
env:
279-
- name: CTS_DEVELOPER_ENV
280-
value: "1"
281-
- name: SQLALCHEMY_DATABASE_URI
282-
value: "postgresql://cts:cts-test@cts-db:5432/cts"
283313
command:
284314
- /bin/bash
285315
- -c
@@ -289,16 +319,22 @@ spec:
289319
cd /src
290320
cts-manager db upgrade
291321
echo "Migrations completed successfully"
322+
volumeMounts:
323+
- name: cts-config
324+
mountPath: /etc/cts
325+
readOnly: true
292326
containers:
293327
- name: cts
294328
image: $IMAGE
295-
env:
296-
- name: CTS_DEVELOPER_ENV
297-
value: "1"
298-
- name: SQLALCHEMY_DATABASE_URI
299-
value: "postgresql://cts:cts-test@cts-db:5432/cts"
329+
command:
330+
- /bin/bash
331+
- -c
332+
- |
333+
set -e
334+
mkdir -p /tmp/httpd/run
335+
exec httpd -DFOREGROUND -f /etc/cts/httpd.conf
300336
ports:
301-
- containerPort: 5005
337+
- containerPort: 8080
302338
resources:
303339
requests:
304340
memory: "256Mi"
@@ -309,18 +345,26 @@ spec:
309345
readinessProbe:
310346
httpGet:
311347
path: /api/1/
312-
port: 5005
348+
port: 8080
313349
initialDelaySeconds: 15
314350
periodSeconds: 5
315351
timeoutSeconds: 5
316352
failureThreshold: 12
317353
livenessProbe:
318354
httpGet:
319355
path: /api/1/
320-
port: 5005
356+
port: 8080
321357
initialDelaySeconds: 30
322358
periodSeconds: 10
323359
timeoutSeconds: 5
360+
volumeMounts:
361+
- name: cts-config
362+
mountPath: /etc/cts
363+
readOnly: true
364+
volumes:
365+
- name: cts-config
366+
configMap:
367+
name: cts-config
324368
EOF
325369
326370
echo "Waiting for CTS service to be ready..."
@@ -425,7 +469,7 @@ spec:
425469
426470
echo ""
427471
echo "Running tests in pod..."
428-
echo "CTS URL: http://cts:5005"
472+
echo "CTS URL: http://cts:8080"
429473
echo ""
430474
431475
# Run the tests - temporarily disable exit-on-error to capture result
@@ -448,7 +492,7 @@ spec:
448492
449493
echo ''
450494
echo 'Running pytest...'
451-
CTS_URL=http://cts:5005 python3 -m pytest tests/test_integration_api.py -v -s -o addopts=
495+
CTS_URL=http://cts:8080 python3 -m pytest tests/test_integration_api.py -v -s -o addopts=
452496
"
453497
TEST_RESULT=$?
454498
set -e

0 commit comments

Comments
 (0)