Skip to content

Commit e6861c8

Browse files
authored
Fix CI failures with OpenID jobs (#659)
* Fix waiting for upterm session to close * Upgrade k9s version used for ci debugging * Migrate to use https://artifacthub.io/packages/helm/codecentric/keycloakx for Keycloak in ci
1 parent 4d4a41c commit e6861c8

File tree

5 files changed

+36
-34
lines changed

5 files changed

+36
-34
lines changed

.ci/auth/keycloak/values.yaml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,34 @@
1717
# under the License.
1818
#
1919

20-
tls:
21-
enabled: false
20+
# Uses quay.io/keycloak/keycloak (official image, default for codecentric/keycloakx chart)
21+
# Run Keycloak in development mode with realm import for CI testing
22+
# https://www.keycloak.org/server/containers
23+
command:
24+
- "/opt/keycloak/bin/kc.sh"
25+
- "start-dev"
26+
- "--import-realm"
27+
28+
# Bootstrap admin credentials
29+
# https://www.keycloak.org/server/containers#_bootstrap_admin_and_creating_initial_admin_user
30+
extraEnv: |
31+
- name: KC_BOOTSTRAP_ADMIN_USERNAME
32+
value: admin
33+
- name: KC_BOOTSTRAP_ADMIN_PASSWORD
34+
value: admin
35+
2236
# This block sets up an example Pulsar Realm
2337
# https://www.keycloak.org/server/importExport#_importing_a_realm_from_a_directory
24-
extraEnvVars:
25-
- name: KEYCLOAK_EXTRA_ARGS
26-
value: "--import-realm"
27-
extraVolumes:
38+
extraVolumes: |
2839
- name: realm-config
2940
secret:
3041
secretName: keycloak-ci-realm-config
31-
extraVolumeMounts:
42+
43+
extraVolumeMounts: |
3244
- name: realm-config
33-
mountPath: "/opt/bitnami/keycloak/data/import"
45+
mountPath: "/opt/keycloak/data/import"
3446
readOnly: true
3547
36-
# Fix for https://github.com/bitnami/charts/issues/35164
37-
global:
38-
security:
39-
allowInsecureImages: true
40-
image:
41-
repository: bitnamilegacy/keycloak
42-
tag: 26.2.3-debian-12-r0
43-
postgresql:
44-
image:
45-
repository: bitnamilegacy/postgresql
46-
tag: 17.4.0-debian-12-r17
48+
resources:
49+
limits:
50+
memory: 768Mi

.ci/clusters/values-openid.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ proxy:
2222
configData:
2323
# Authentication settings of the broker itself. Used when the broker connects to other brokers, or when the proxy connects to brokers, either in same or other clusters
2424
brokerClientAuthenticationPlugin: "org.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2"
25-
brokerClientAuthenticationParameters: '{"privateKey":"file:///pulsar/auth/proxy/credentials_file.json","audience":"account","issuerUrl":"http://keycloak-ci-headless:8080/realms/pulsar"}'
25+
brokerClientAuthenticationParameters: '{"privateKey":"file:///pulsar/auth/proxy/credentials_file.json","audience":"account","issuerUrl":"http://keycloak-ci-keycloakx-http/auth/realms/pulsar"}'
2626
extraVolumes:
2727
- name: pulsar-proxy-credentials
2828
secret:
@@ -36,7 +36,7 @@ broker:
3636
configData:
3737
# Authentication settings of the broker itself. Used when the broker connects to other brokers, or when the proxy connects to brokers, either in same or other clusters
3838
brokerClientAuthenticationPlugin: "org.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2"
39-
brokerClientAuthenticationParameters: '{"privateKey":"file:///pulsar/auth/broker/credentials_file.json","audience":"account","issuerUrl":"http://keycloak-ci-headless:8080/realms/pulsar"}'
39+
brokerClientAuthenticationParameters: '{"privateKey":"file:///pulsar/auth/broker/credentials_file.json","audience":"account","issuerUrl":"http://keycloak-ci-keycloakx-http/auth/realms/pulsar"}'
4040
extraVolumes:
4141
- name: pulsar-broker-credentials
4242
secret:
@@ -49,7 +49,7 @@ broker:
4949
toolset:
5050
configData:
5151
authPlugin: "org.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2"
52-
authParams: '{"privateKey":"file:///pulsar/auth/admin/credentials_file.json","audience":"account","issuerUrl":"http://keycloak-ci-headless:8080/realms/pulsar"}'
52+
authParams: '{"privateKey":"file:///pulsar/auth/admin/credentials_file.json","audience":"account","issuerUrl":"http://keycloak-ci-keycloakx-http/auth/realms/pulsar"}'
5353
extraVolumes:
5454
- name: pulsar-admin-credentials
5555
secret:
@@ -67,7 +67,7 @@ auth:
6767
enabled: true
6868
# https://pulsar.apache.org/docs/next/security-openid-connect/#enable-openid-connect-authentication-in-the-broker-and-proxy
6969
openIDAllowedTokenIssuers:
70-
- http://keycloak-ci-headless:8080/realms/pulsar
70+
- http://keycloak-ci-keycloakx-http/auth/realms/pulsar
7171
openIDAllowedAudiences:
7272
- account
7373
#openIDTokenIssuerTrustCertsFilePath:

.ci/configure_ci_runner_for_debugging.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function k9s() {
2727
# install k9s on the fly
2828
if [ ! -x /usr/local/bin/k9s ]; then
2929
echo "Installing k9s..."
30-
curl -L -s https://github.com/derailed/k9s/releases/download/v0.40.5/k9s_Linux_amd64.tar.gz | sudo tar xz -C /usr/local/bin k9s
30+
curl -L -s https://github.com/derailed/k9s/releases/download/v0.50.18/k9s_Linux_amd64.tar.gz | sudo tar xz -C /usr/local/bin k9s
3131
fi
3232
command k9s "$@"
3333
}

.ci/helm.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ function ci::helm_repo_add() {
8585
echo "Adding the helm repo ..."
8686
${HELM} repo add prometheus-community https://prometheus-community.github.io/helm-charts
8787
${HELM} repo add vm https://victoriametrics.github.io/helm-charts/
88+
${HELM} repo add codecentric https://codecentric.github.io/helm-charts
8889
${HELM} repo update
8990
echo "Successfully added the helm repo."
9091
}
@@ -535,10 +536,10 @@ function ci::create_openid_resources() {
535536
${KUBECTL} create secret generic keycloak-ci-realm-config --from-file=realm-pulsar.json=/tmp/realm-pulsar.json -n ${NAMESPACE}
536537

537538
echo "Installing keycloak helm chart"
538-
${HELM} install keycloak-ci oci://registry-1.docker.io/bitnamicharts/keycloak --version 24.6.4 --values ${PULSAR_HOME}/.ci/auth/keycloak/values.yaml -n ${NAMESPACE}
539+
${HELM} install keycloak-ci codecentric/keycloakx --version 7.1.8 --values ${PULSAR_HOME}/.ci/auth/keycloak/values.yaml -n ${NAMESPACE}
539540

540541
echo "Wait until keycloak is running"
541-
WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep keycloak-ci-0 | wc -l)
542+
WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep keycloak-ci-keycloakx-0 | wc -l)
542543
counter=1
543544
while [[ ${WC} -lt 1 ]]; do
544545
((counter++))
@@ -553,15 +554,11 @@ function ci::create_openid_resources() {
553554
exit 1
554555
fi
555556
fi
556-
WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep keycloak-ci-0 | wc -l)
557+
WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep keycloak-ci-keycloakx-0 | wc -l)
557558
done
558559

559560
echo "Wait until keycloak is ready"
560-
${KUBECTL} wait --for=condition=Ready pod/keycloak-ci-0 -n ${NAMESPACE} --timeout 180s
561-
562-
echo "Check keycloack realm pulsar issuer url"
563-
${KUBECTL} exec -n ${NAMESPACE} keycloak-ci-0 -c keycloak -- bash -c 'curl -sSL http://keycloak-ci-headless:8080/realms/pulsar'
564-
561+
${KUBECTL} wait --for=condition=Ready pod/keycloak-ci-keycloakx-0 -n ${NAMESPACE} --timeout 180s
565562
}
566563

567564
# lists all available functions in this tool

.github/actions/ssh-access/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,16 @@ runs:
138138
if command -v upterm &>/dev/null; then
139139
shopt -s nullglob
140140
echo "SSH connection information"
141-
upterm session current --admin-socket ~/.upterm/*.sock || {
141+
export UPTERM_ADMIN_SOCKET=$(find $HOME/.upterm $XDG_RUNTIME_DIR/upterm /run/user/$(id -u)/upterm -name "*.sock" | head -n 1)
142+
upterm session current || {
142143
echo "upterm isn't running. Not waiting any longer."
143144
exit 0
144145
}
145146
timeout=${{ inputs.timeout }}
146147
echo "Waiting $timeout seconds..."
147148
sleep $timeout
148149
echo "Keep waiting as long as there's a connected session"
149-
while upterm session current --admin-socket ~/.upterm/*.sock|grep Connected &>/dev/null; do
150+
while upterm session current|grep Connected &>/dev/null; do
150151
sleep 30
151152
done
152153
echo "No session is connected. Not waiting any longer."

0 commit comments

Comments
 (0)