Skip to content

Commit 1cde18c

Browse files
committed
Adapt install-helm-chart.sh and test-helm-release.sh for multitenant
1 parent 5162e32 commit 1cde18c

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

.github/scripts/install-helm-chart.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ CURRENT_SCRIPT_DIR=$(realpath "$(dirname "$0")")
77
HELM_DEPLOY_SCRIPT_BASE_PATH=$(realpath "${CURRENT_SCRIPT_DIR}"/../../api/kubernetes)
88

99
PASSWORD_FOR_ARGO_PASSWORD="a-super-secure-password-we-dont-care-about"
10-
NAMESPACE="phoenix"
1110

1211
# Generate a sample values-ci.yaml. We will also inherit configuration from values-dev.yaml
1312
cat <<EOF > values-ci.yaml
@@ -28,8 +27,8 @@ config:
2827
oauth2:
2928
resource-server:
3029
jwt:
31-
issuer-uri: "https://localhost/${NAMESPACE}/auth/realms/cosmotech"
32-
jwk-set-uri: "http://${NAMESPACE}-keycloak.${NAMESPACE}.svc.cluster.local/${NAMESPACE}/auth/realms/cosmotech/protocol/openid-connect/certs"
30+
issuer-uri: "https://localhost/${CHART_RELEASE_TEST_NAMESPACE}/auth/realms/cosmotech"
31+
jwk-set-uri: "http://${CHART_RELEASE_TEST_NAMESPACE}-keycloak.${CHART_RELEASE_TEST_NAMESPACE}.svc.cluster.local/${CHART_RELEASE_TEST_NAMESPACE}/auth/realms/cosmotech/protocol/openid-connect/certs"
3332
audiences:
3433
- "account"
3534
@@ -45,12 +44,12 @@ config:
4544
principalJwtClaim: "email"
4645
tenantIdJwtClaim: "iss"
4746
allowed-tenants:
48-
- "${NAMESPACE}"
47+
- "${CHART_RELEASE_TEST_NAMESPACE}"
4948
- "cosmotech"
5049
identityProvider:
5150
code: keycloak
52-
authorizationUrl: "https://localhost/${NAMESPACE}/auth/realms/cosmotech/protocol/openid-connect/auth"
53-
tokenUrl: "https://localhost/${NAMESPACE}/auth/realms/cosmotech/protocol/openid-connect/token"
51+
authorizationUrl: "https://localhost/${CHART_RELEASE_TEST_NAMESPACE}/auth/realms/cosmotech/protocol/openid-connect/auth"
52+
tokenUrl: "https://localhost/${CHART_RELEASE_TEST_NAMESPACE}/auth/realms/cosmotech/protocol/openid-connect/token"
5453
defaultScopes:
5554
openid: "OpenId Scope"
5655
email: "Email Scope"

.github/scripts/test-helm-release.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
API_VERSION=${1:-latest}
44

5-
helm -n "${CHART_RELEASE_TEST_NAMESPACE}" test "cosmotech-api-${API_VERSION}"
5+
helm -n "${CHART_RELEASE_TEST_NAMESPACE}" test "cosmotech-api-${CHART_RELEASE_TEST_NAMESPACE}-${API_VERSION}"
66

77
retVal=$?
88
echo "retVal=$retVal"
@@ -20,15 +20,15 @@ kubectl describe all --all-namespaces
2020
echo "=== ==="
2121

2222
for test in openapi swaggerui; do
23-
echo ">>> Logs for cosmotech-api-${API_VERSION}-test-connection-${test} <<<"
24-
kubectl -n "${CHART_RELEASE_TEST_NAMESPACE}" logs "cosmotech-api-${API_VERSION}-test-connection-${test}"
23+
echo ">>> Logs for cosmotech-api-${CHART_RELEASE_TEST_NAMESPACE}-${API_VERSION}-test-connection-${test} <<<"
24+
kubectl -n "${CHART_RELEASE_TEST_NAMESPACE}" logs "cosmotech-api-${CHART_RELEASE_TEST_NAMESPACE}-${API_VERSION}-test-connection-${test}"
2525
echo "-"
2626
done
2727

2828
if [[ "${retVal}" != "0" ]]; then
2929
echo "Helm Release testing did not complete successfully: $retVal."
30-
echo " Command: helm -n ${CHART_RELEASE_TEST_NAMESPACE} test cosmotech-api-${API_VERSION}"
31-
exit $retVal
30+
echo " Command: helm -n ${CHART_RELEASE_TEST_NAMESPACE} test cosmotech-api-${CHART_RELEASE_TEST_NAMESPACE}-${API_VERSION}"
31+
exit $retVald
3232
fi
3333

3434
# Also test the access via the Ingress
@@ -37,11 +37,11 @@ if [[ "${API_VERSION}" == "latest" ]]; then
3737
else
3838
base_path="/${API_VERSION}"
3939
fi
40-
for route in "/" "/openapi" "/openapi.json" "/openapi.yaml" ; do
41-
echo "==> Testing the access (${base_path}${route}) via the Ingress Resource (controlled by an Ingress Controller)"
40+
for route in "/openapi" "/openapi.yaml" ; do
41+
echo "==> Testing the access (/cosmotech-api/${CHART_RELEASE_TEST_NAMESPACE}${base_path}${route}) via the Ingress Resource (controlled by an Ingress Controller)"
4242
wget --no-check-certificate \
4343
--tries 10 \
4444
-S \
4545
-O - \
46-
"https://localhost/cosmotech-api${base_path}${route}" || exit 1
46+
"https://localhost/cosmotech-api/${CHART_RELEASE_TEST_NAMESPACE}${base_path}${route}" || exit 1
4747
done

api/kubernetes/helm-chart/templates/tests/test-access-openapi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ spec:
3939
- '-O'
4040
- '-'
4141
- 'http://{{ include "cosmotech-api.fullname" . }}:{{ .Values.service.port }}{{ $contextPath | trimSuffix "/" }}/openapi'
42-
- 'http://{{ include "cosmotech-api.fullname" . }}:{{ .Values.service.port }}{{ $contextPath | trimSuffix "/" }}/openapi.json'
4342
- 'http://{{ include "cosmotech-api.fullname" . }}:{{ .Values.service.port }}{{ $contextPath | trimSuffix "/" }}/openapi.yaml'
4443
securityContext:
4544
readOnlyRootFilesystem: true

api/kubernetes/helm-chart/templates/tests/test-access-swaggerui.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: "{{ include "cosmotech-api.fullname" . }}-test-connection-swaggerui"
66
namespace: {{ .Release.Namespace }}
77
labels:
8-
{{- include "cosmotech-api.labels" . | nindent 4 }}
8+
{{- include "cosmotech-api.labels" . | nindent 4 }}
99
annotations:
1010
1111
"helm.sh/hook": test

0 commit comments

Comments
 (0)