Skip to content

Commit feb8792

Browse files
committed
Fixed tests.
1 parent eaf8ed9 commit feb8792

File tree

3 files changed

+35
-34
lines changed

3 files changed

+35
-34
lines changed

charts/eoapi/profiles/experimental.yaml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -371,20 +371,9 @@ stac-auth-proxy:
371371
enabled: true
372372
service:
373373
port: 8080
374-
# Wait for dependencies to be ready before starting stac-auth-proxy
375-
initContainers:
376-
- name: wait-for-mock-oidc
377-
image: busybox:1.35
378-
command: ['sh', '-c', 'until nc -z eoapi-mock-oidc-server.eoapi.svc.cluster.local 8080; do echo waiting for mock-oidc; sleep 2; done']
379-
- name: wait-for-stac
380-
image: busybox:1.35
381-
command: ['sh', '-c', 'until nc -z eoapi-stac.eoapi.svc.cluster.local 8080; do echo waiting for stac service; sleep 2; done']
382-
env:
383-
UPSTREAM_URL: "http://eoapi-stac:8080"
384-
# For testing one could deploy a mock OIDC server (https://github.com/alukach/mock-oidc-server)
385-
OIDC_DISCOVERY_URL: "http://eoapi-mock-oidc-server.eoapi.svc.cluster.local:8080/.well-known/openid-configuration"
386-
# For production, point to your actual OpenID Connect provider
387-
# OIDC_DISCOVERY_URL: "https://your-auth-provider.com/.well-known/openid-configuration"
374+
# For testing this will be set dynamically; for production, point to your OIDC server
375+
# env:
376+
# OIDC_DISCOVERY_URL: "http://eoapi-mock-oidc-server.eoapi.svc.cluster.local:8080/.well-known/openid-configuration"
388377

389378
######################
390379
# MOCK OIDC SERVER

scripts/deploy.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,7 @@ deploy_eoapi() {
391391
HELM_CMD="$HELM_CMD --set observability.grafana.enabled=true"
392392
HELM_CMD="$HELM_CMD --set monitoring.prometheusAdapter.prometheus.url=http://$RELEASE_NAME-prometheus-server.eoapi.svc.cluster.local"
393393

394-
# Set UPSTREAM_URL and OIDC_DISCOVERY_URL dynamically for stac-auth-proxy when experimental profile is used
395-
# The experimental profile enables stac-auth-proxy, so we need to set the correct service names
396-
# Also configure STAC service to run without root path when behind auth proxy
397-
HELM_CMD="$HELM_CMD --set stac-auth-proxy.env.UPSTREAM_URL=http://$RELEASE_NAME-stac:8080"
398-
HELM_CMD="$HELM_CMD --set stac-auth-proxy.env.OIDC_DISCOVERY_URL=http://$RELEASE_NAME-mock-oidc-server.$NAMESPACE.svc.cluster.local:8080/.well-known/openid-configuration"
399-
# Note: initContainer service names are dynamically replaced by the stac-auth-proxy-patch job
400-
# Configure STAC service to run without root path when behind auth proxy
401-
# Empty string makes STAC service run at root path (no --root-path argument)
402-
HELM_CMD="$HELM_CMD --set 'stac.overrideRootPath='"
394+
403395

404396
HELM_CMD="$HELM_CMD --set eoapi-notifier.enabled=true"
405397
HELM_CMD="$HELM_CMD --set eoapi-notifier.config.sources[0].config.connection.existingSecret.name=$RELEASE_NAME-pguser-eoapi"

scripts/deployment.sh

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ run_deployment() {
6969
helm dependency update charts/eoapi
7070

7171
local helm_cmd="helm upgrade --install $RELEASE_NAME charts/eoapi -n $NAMESPACE --create-namespace"
72-
local use_experimental=false
72+
local testing_mode=false
7373

7474
if [[ -f "charts/eoapi/profiles/experimental.yaml" ]]; then
7575
log_info "Applying experimental profile..."
7676
helm_cmd="$helm_cmd -f charts/eoapi/profiles/experimental.yaml"
77-
use_experimental=true
77+
testing_mode=true
7878
fi
7979
if [[ -f "charts/eoapi/profiles/local/k3s.yaml" ]]; then
8080
log_info "Applying k3s local profile..."
@@ -84,28 +84,41 @@ run_deployment() {
8484
helm_cmd="$helm_cmd --set eoapi-notifier.config.sources[0].type=pgstac"
8585
helm_cmd="$helm_cmd --set eoapi-notifier.config.sources[0].config.connection.existingSecret.name=$RELEASE_NAME-pguser-eoapi"
8686

87-
# Set UPSTREAM_URL and OIDC_DISCOVERY_URL dynamically for stac-auth-proxy when experimental profile is used
88-
# The experimental profile enables stac-auth-proxy, so we need to set the correct service names
87+
# Set UPSTREAM_URL and OIDC_DISCOVERY_URL dynamically for stac-auth-proxy when testing mode is enabled
88+
# Testing mode enables stac-auth-proxy, so we need to set the correct service names
8989
# Also configure STAC service to run without root path when behind auth proxy
90-
if [[ "$use_experimental" == "true" ]]; then
91-
helm_cmd="$helm_cmd --set stac-auth-proxy.env.UPSTREAM_URL=http://$RELEASE_NAME-stac:8080"
92-
helm_cmd="$helm_cmd --set stac-auth-proxy.env.OIDC_DISCOVERY_URL=http://$RELEASE_NAME-mock-oidc-server.$NAMESPACE.svc.cluster.local:8080/.well-known/openid-configuration"
93-
# Note: initContainer service names are dynamically replaced by the stac-auth-proxy-patch job
90+
if [[ "$testing_mode" == "true" ]]; then
91+
# Create temporary values file for dynamic stac-auth-proxy configuration
92+
local temp_values="/tmp/stac-auth-proxy-values-${RELEASE_NAME}.yaml"
93+
cat > "$temp_values" <<EOF
94+
stac-auth-proxy:
95+
env:
96+
UPSTREAM_URL: "http://${RELEASE_NAME}-stac:8080"
97+
OIDC_DISCOVERY_URL: "http://${RELEASE_NAME}-mock-oidc-server.${NAMESPACE}.svc.cluster.local:8080/.well-known/openid-configuration"
98+
initContainers:
99+
- name: wait-for-mock-oidc
100+
image: busybox:1.35
101+
command: ['sh', '-c', 'until nc -z ${RELEASE_NAME}-mock-oidc-server.${NAMESPACE}.svc.cluster.local 8080; do echo waiting for mock-oidc; sleep 2; done']
102+
- name: wait-for-stac
103+
image: busybox:1.35
104+
command: ['sh', '-c', 'until nc -z ${RELEASE_NAME}-stac.${NAMESPACE}.svc.cluster.local 8080; do echo waiting for stac service; sleep 2; done']
105+
EOF
106+
helm_cmd="$helm_cmd -f $temp_values"
94107
# Configure STAC service to run without root path when behind auth proxy
95108
# Empty string makes STAC service run at root path (no --root-path argument)
96109
helm_cmd="$helm_cmd --set 'stac.overrideRootPath='"
97110
fi
98111

99112
if is_ci; then
100113
log_info "Applying CI-specific configurations..."
101-
102-
helm_cmd="$helm_cmd --set testing=true"
103114
helm_cmd="$helm_cmd --set monitoring.prometheusAdapter.prometheus.url=http://$RELEASE_NAME-prometheus-server.eoapi.svc.cluster.local"
115+
testing_mode=true
104116
fi
105117

106118
helm_cmd="$helm_cmd --timeout $TIMEOUT"
107119

108120
log_info "Deploying eoAPI..."
121+
local deploy_result=0
109122
if eval "$helm_cmd"; then
110123
log_success "eoAPI deployed successfully"
111124

@@ -153,8 +166,15 @@ run_deployment() {
153166
fi
154167
else
155168
log_error "Deployment failed"
156-
return 1
169+
deploy_result=1
157170
fi
171+
172+
# Cleanup temporary files
173+
if [[ "$testing_mode" == "true" ]] && [[ -f "/tmp/stac-auth-proxy-values-${RELEASE_NAME}.yaml" ]]; then
174+
rm -f "/tmp/stac-auth-proxy-values-${RELEASE_NAME}.yaml"
175+
fi
176+
177+
return $deploy_result
158178
}
159179

160180
debug_deployment() {

0 commit comments

Comments
 (0)