Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: account for keycloak HA ports #619

Merged
merged 16 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/slim-dev-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- src/istio/*
- src/prometheus-stack/*
- packages/slim-dev/*
- bundles/core-slim-dev/*
- bundles/k3d-slim-dev/*
- .github/workflows/slim-dev*

# Permissions for the GITHUB_TOKEN used by the workflow.
Expand Down
2 changes: 0 additions & 2 deletions bundles/k3d-slim-dev/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ packages:
# x-release-please-start-version
ref: 0.24.1
# x-release-please-end
optionalComponents:
- metrics-server
overrides:
istio-admin-gateway:
uds-istio-config:
Expand Down
1 change: 1 addition & 0 deletions src/istio/oscal-component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ component-definition:
"to": [
{
"operation": {
"ports": ["8080"],
"paths": ["/admin*", "/realms/master*"]
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/keycloak/chart/templates/istio-admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ spec:
rules:
- to:
- operation:
ports:
- "8080"
paths:
- "/admin*"
- "/realms/master*"
Expand All @@ -21,6 +23,8 @@ spec:
- istio-admin-gateway
- to:
- operation:
ports:
- "8080"
paths:
- /metrics*
from:
Expand All @@ -30,16 +34,23 @@ spec:
- monitoring
- to:
- operation:
ports:
- "8080"
paths:
# Never allow anonymous client registration except from the pepr-system namespace
# This is another fallback protection, as the KC policy already blocks it
- "/realms/{{ .Values.realm }}/clients-registrations/*"
from:
- source:
notNamespaces: ["pepr-system"]
notNamespaces:
- "pepr-system"
- when:
- key: request.headers[istio-mtls-client-certificate]
values: ["*"]
to:
- operation:
ports:
- "8080"
from:
- source:
notNamespaces:
Expand Down
8 changes: 8 additions & 0 deletions src/keycloak/chart/templates/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ spec:
port: 80
targetPort: http
protocol: TCP
- name: tcp
port: 7800
targetPort: tcp
protocol: TCP
- name: tcp-fd
port: 57800
targetPort: tcp-fd
protocol: TCP
selector:
{{- include "keycloak.selectorLabels" . | nindent 4 }}
8 changes: 7 additions & 1 deletion src/keycloak/chart/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ spec:
# java opts for jgroups required for infinispan distributed cache when using the kubernetes stack.
# https://www.keycloak.org/server/caching
- name: JAVA_OPTS_APPEND
value: -Djgroups.dns.query={{ include "keycloak.fullname" . }}-headless
value: -Djgroups.dns.query={{ include "keycloak.fullname" . }}-headless.keycloak.svc.cluster.local

# Postgres database configuration
- name: KC_DB
Expand Down Expand Up @@ -189,6 +189,12 @@ spec:
- name: http
containerPort: 8080
protocol: TCP
- name: tcp
containerPort: 7800
protocol: TCP
- name: tcp-fd
containerPort: 57800
protocol: TCP
livenessProbe:
httpGet:
path: /health/live
Expand Down
13 changes: 13 additions & 0 deletions src/keycloak/chart/templates/uds-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ spec:
port: {{ .Values.postgresql.port }}
remoteGenerated: Anywhere
{{- end }}
{{- if .Values.autoscaling.enabled }}
# HA for keycloak
- direction: Ingress
remoteGenerated: IntraNamespace
ports:
- 7800
- 57800
- direction: Egress
remoteGenerated: IntraNamespace
ports:
- 7800
- 57800
mjnagel marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}

expose:
- description: "remove private paths from public gateway"
Expand Down