Skip to content

Conversation

@KyriosGN0
Copy link
Contributor

fixes #38843

@KyriosGN0
Copy link
Contributor Author

pretty sure the testNoAutoMountServiceAccount passed locally, just to be extra sure i will re-run it locally tomorrow

@ahus1
Copy link
Contributor

ahus1 commented Jun 19, 2025

For the Keycloak Multi-Site setup, IMHO we assume that the CA used in OpenShift is imported automatically so we can communicate with Infinispan securely.

Looping in @ryanemerson / @pruivo to ensure that the docs are updated for that.

@pruivo
Copy link
Member

pruivo commented Jun 20, 2025

For mult-site HA, Infinispan requires /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
Documentation

@ahus1
Copy link
Contributor

ahus1 commented Jun 20, 2025

@pruivo - in addition to that, when Keycloak talks to Infinispan in that setup, it uses TLS. And to verify the Infinispan certificate, it needs to know about the CA. I remember there was some kind of mechanism.

Maybe @shawkins can refresh my memory here how Keycloak picks up that CA?

@pruivo
Copy link
Member

pruivo commented Jun 20, 2025

@ahus1 The operator automatically adds the certificate to the truststore:

// include the kube CA if the user is not controlling KC_TRUSTSTORE_PATHS via the unsupported or the additional
varMap.putIfAbsent(KC_TRUSTSTORE_PATHS, new EnvVarBuilder().withName(KC_TRUSTSTORE_PATHS).withValue(truststores).build());

@ahus1
Copy link
Contributor

ahus1 commented Jun 20, 2025

@pruivo, thank you, I was looking for that code snippet but didn't find it. So this option would be required in the Keycloak HA setup as described in https://www.keycloak.org/high-availability/deploy-keycloak-kubernetes

So if this is merged for the 26.3 release and we decide to update the docs in a follow-up issue, that follow-up issue should be a blocker for the 26.3 release.

@pruivo
Copy link
Member

pruivo commented Jun 20, 2025

@ahus1 How so? This PR is disabling the service account tokens (/var/run/secrets/kubernetes.io/serviceaccount/token ), and I don't find any relation to the service certificates in the Kubernetes docs.

@ahus1
Copy link
Contributor

ahus1 commented Jun 20, 2025

@pruivo - OK, then I was just worried without a reason. Then proceed here, and our tests in the cluster will show if it breaks. Sorry for the noise!

@pruivo
Copy link
Member

pruivo commented Jun 20, 2025

This is the only doc I found: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#opt-out-of-api-credential-automounting
If something breaks after this PR is merged, we will know the culprit 🤣

@vmuzikar
Copy link
Contributor

I don't find any relation to the service certificates in the Kubernetes docs

Based on #38843 (comment) it would appear that the CA cert is also not mounted when automountServiceAccountToken: false.

@KyriosGN0
Copy link
Contributor Author

@ahus1 How so? This PR is disabling the service account tokens (/var/run/secrets/kubernetes.io/serviceaccount/token ), and I don't find any relation to the service certificates in the Kubernetes docs.

the /var/run/secrets/kubernetes.io/serviceaccount/ca.crt (and that entire directory) is controlled by that flag, should i add the a clarification in some doc page that this option has to be true for multi-site setup in k8s?

@vmuzikar
Copy link
Contributor

should i add the a clarification in some doc page that this option has to be true for multi-site setup in k8s?

+1

@KyriosGN0
Copy link
Contributor Author

added the automountServiceAccountToken: true to the example keycloak used in this doc

@KyriosGN0
Copy link
Contributor Author

Hey @vmuzikar would it be possible to get someone to take a look here?

Thanks in advance!

@vmuzikar
Copy link
Contributor

@KyriosGN0 Sorry, will take a look this week.

@KyriosGN0 KyriosGN0 requested a review from a team as a code owner July 14, 2025 19:52
@KyriosGN0 KyriosGN0 requested a review from shawkins July 14, 2025 22:07
@KyriosGN0
Copy link
Contributor Author

@shawkins thanks for the review, i agree with your suggestion and have committed them

@KyriosGN0
Copy link
Contributor Author

@vmuzikar would it be possible for you take another look?
Thanks!

@KyriosGN0
Copy link
Contributor Author

hey @vmuzikar @stianst, is it possible to get a review here?

@KyriosGN0
Copy link
Contributor Author

hey @vmuzikar @stianst, is there something i can do to progress with this PR ?


When running on a Kubernetes or OpenShift environment well-known locations of trusted certificates are included automatically.
This includes `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt` and the `/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt` when present.
In order to not include `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt` in Keycloak pods, set the `automountServiceAccountToken` field in the spec to `false`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, in the CRD property description, or both it should be clearer why you would want to set it to false and when that isn't possible.

If this seems like it's getting too nuanced, then I'm still in favor of using a networkpolicy that denies access from the keycloak pods to the api server.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KyriosGN0 Sorry for the late reply.

If this seems like it's getting too nuanced

IMHO it's not.

@KyriosGN0 In order to move this forward, we would need to document that the service account is required by the Kube service accounts identity provider.

why you would want to set it to false

+1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And infinispan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shawkins do you mean using external infinispan cluster ?

Copy link
Contributor

@shawkins shawkins Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - #40605 (comment)

It can also be needed if there is custom provider logic that expects to connect to the api server.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KyriosGN0 KyriosGN0 requested a review from shawkins November 7, 2025 10:24
shawkins
shawkins previously approved these changes Nov 12, 2025
Copy link
Contributor

@shawkins shawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @KyriosGN0 this looks good. Just a couple of minor edits might be good.

Copy link
Contributor

@vmuzikar vmuzikar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution, LGTM!

KyriosGN0 and others added 13 commits November 14, 2025 15:24
Signed-off-by: AvivGuiser <[email protected]>

# Conflicts:
#	operator/src/main/java/org/keycloak/operator/crds/v2alpha1/deployment/KeycloakSpec.java
Signed-off-by: AvivGuiser <[email protected]>
Signed-off-by: AvivGuiser <[email protected]>
Co-authored-by: Steven Hawkins <[email protected]>
Signed-off-by: AvivGuiser <[email protected]>
…ken to true

Co-authored-by: Steven Hawkins <[email protected]>
Signed-off-by: AvivGuiser <[email protected]>
Signed-off-by: AvivGuiser <[email protected]>
Signed-off-by: AvivGuiser <[email protected]>
Signed-off-by: AvivGuiser <[email protected]>
@vmuzikar vmuzikar enabled auto-merge (squash) November 14, 2025 14:25
@vmuzikar vmuzikar dismissed stianst’s stale review November 14, 2025 14:26

This has been resolved by a docs note.

@vmuzikar vmuzikar merged commit 3c8af6d into keycloak:main Nov 14, 2025
81 checks passed
Captain-P-Goldfish pushed a commit to Captain-P-Goldfish/keycloak that referenced this pull request Nov 15, 2025
Jonaka3385 pushed a commit to Jonaka3385/keycloak that referenced this pull request Nov 17, 2025
Closes keycloak#44156

Signed-off-by: Giuseppe Graziano <[email protected]>

Add permissions to stability-* workflows (keycloak#44212)

Signed-off-by: stianst <[email protected]>

Avoid downloading spotless dependencies every time

Closes keycloak#44214

Signed-off-by: stianst <[email protected]>

fix: correcting termination test on openshift (keycloak#44181)

closes: keycloak#44179

Signed-off-by: Steve Hawkins <[email protected]>

Translations update from Hosted Weblate (keycloak#44055)

* Updated translation for Turkish

Language: tr

Update translation files

Updated by "Cleanup translation files" hook in Weblate.

Updated translation for Turkish

Language: tr

Updated translation for Turkish

Language: tr

Co-authored-by: Arif EROL <[email protected]>
Co-authored-by: Hosted Weblate <[email protected]>
Signed-off-by: Arif EROL <[email protected]>
Signed-off-by: Hosted Weblate <[email protected]>

* Update translation files

Updated by "Cleanup translation files" hook in Weblate.

Co-authored-by: Hosted Weblate <[email protected]>
Signed-off-by: Hosted Weblate <[email protected]>

* Updated translation for French

Language: fr

Updated translation for French

Language: fr

Update translation files

Updated by "Cleanup translation files" hook in Weblate.

Updated translation for French

Language: fr

Updated translation for French

Language: fr

Updated translation for French

Language: fr

Updated translation for French

Language: fr

Updated translation for French

Language: fr

Updated translation for French

Language: fr

Updated translation for French

Language: fr

Updated translation for French

Language: fr

Co-authored-by: Alexander Schwartz <[email protected]>
Co-authored-by: Dodouce <[email protected]>
Co-authored-by: Hosted Weblate <[email protected]>
Co-authored-by: Sylvain Pichon <[email protected]>
Signed-off-by: Alexander Schwartz <[email protected]>
Signed-off-by: Dodouce <[email protected]>
Signed-off-by: Hosted Weblate <[email protected]>
Signed-off-by: Sylvain Pichon <[email protected]>

* Update translation files

Updated by "Cleanup translation files" hook in Weblate.

Co-authored-by: Hosted Weblate <[email protected]>
Signed-off-by: Hosted Weblate <[email protected]>

* Update translation files

Updated by "Cleanup translation files" hook in Weblate.

Updated translation for Chinese (Traditional Han script)

Language: zh_Hant

Updated translation for Chinese (Traditional Han script)

Language: zh_Hant

Co-authored-by: Hosted Weblate <[email protected]>
Co-authored-by: 秉虎 <[email protected]>
Signed-off-by: Hosted Weblate <[email protected]>
Signed-off-by: 秉虎 <[email protected]>

---------

Signed-off-by: Arif EROL <[email protected]>
Signed-off-by: Hosted Weblate <[email protected]>
Signed-off-by: Alexander Schwartz <[email protected]>
Signed-off-by: Dodouce <[email protected]>
Signed-off-by: Sylvain Pichon <[email protected]>
Signed-off-by: 秉虎 <[email protected]>
Co-authored-by: Arif EROL <[email protected]>
Co-authored-by: Alexander Schwartz <[email protected]>
Co-authored-by: Dodouce <[email protected]>
Co-authored-by: Sylvain Pichon <[email protected]>
Co-authored-by: 秉虎 <[email protected]>

Create remember_me column for user sessions

Closes keycloak#44112

Signed-off-by: Pedro Ruivo <[email protected]>
Co-authored-by: Pedro Ruivo <[email protected]>

Add optional parameter in WorkflowResource.toRepresentation to allow retrieval of the rep without the ids

Closes keycloak#44183

Signed-off-by: Stefan Guilhen <[email protected]>

Fix logger call to align arguments with format pattern

fixes keycloak#44229

Signed-off-by: Lucas <[email protected]>

MLDSA Keys and Feature-Flag

Removing Feature-Flag

set auto-mount service account token to false in keycloak pods (keycloak#40605)

closes keycloak#38843

Signed-off-by: AvivGuiser <[email protected]>
Co-authored-by: Steven Hawkins <[email protected]>

Bug fix double-encoding for query parameter acr_values

Related bug fix in Keycloak version 26.4

space with mutiple values results in → "+" → "%2B"

Reported bug:
keycloak#44125

Signed-off-by: jhgojbis <[email protected]>

Fixing encoding of forwarded parameters

Closes keycloak#44125

Signed-off-by: Pedro Igor <[email protected]>

Fix UserSessionProviderOfflineModelTest#testLoadUserSessionsWithNotDeletedOfflineClientSessions

Fixes keycloak#43886

Signed-off-by: Pedro Ruivo <[email protected]>
Co-authored-by: Pedro Ruivo <[email protected]>

Deprecate TopologyInfo

Closes keycloak#44047

Signed-off-by: Pedro Ruivo <[email protected]>
Co-authored-by: Pedro Ruivo <[email protected]>

Find highest sequence number in jgroups_ping

* Find the highest sequence number in jgroups_ping table to avoid duplicates

Fixes keycloak#44189

Signed-off-by: Pedro Ruivo <[email protected]>
Co-authored-by: Pedro Ruivo <[email protected]>

Bump the actions-dependencies group with 3 updates (keycloak#44245)

Bumps the actions-dependencies group with 3 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [github/codeql-action](https://github.com/github/codeql-action) and [actions/download-artifact](https://github.com/actions/download-artifact).

Updates `actions/upload-artifact` from 4.6.2 to 5.0.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@ea165f8...330a01c)

Updates `github/codeql-action` from 4.30.8 to 4.31.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@f443b60...014f16e)

Updates `actions/download-artifact` from 5.0.0 to 6.0.0
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@634f93c...018cc2c)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions-dependencies
- dependency-name: github/codeql-action
  dependency-version: 4.31.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-dependencies
- dependency-name: actions/download-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions-dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump the actions-dependencies group with 3 updates (keycloak#44245)

Bumps the actions-dependencies group with 3 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [github/codeql-action](https://github.com/github/codeql-action) and [actions/download-artifact](https://github.com/actions/download-artifact).

Updates `actions/upload-artifact` from 4.6.2 to 5.0.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@ea165f8...330a01c)

Updates `github/codeql-action` from 4.30.8 to 4.31.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@f443b60...014f16e)

Updates `actions/download-artifact` from 5.0.0 to 6.0.0
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@634f93c...018cc2c)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions-dependencies
- dependency-name: github/codeql-action
  dependency-version: 4.31.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-dependencies
- dependency-name: actions/download-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions-dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

JWK Algorithm Key Pair support (keycloak#44203)

Closes keycloak#44141

Signed-off-by: stianst <[email protected]>

Merge GenerateKeystoreForTestUtil with CryptoKeyStore (keycloak#44223)

Closes keycloak#44195

Signed-off-by: stianst <[email protected]>

Rename ApiUtil to AdminApiUtil (keycloak#44224)

Closes keycloak#44196

Signed-off-by: stianst <[email protected]>
Ogenbertrand pushed a commit to adorsys/keycloak-oid4vc that referenced this pull request Dec 2, 2025
…oak#40605)

closes keycloak#38843

Signed-off-by: AvivGuiser <[email protected]>
Co-authored-by: Steven Hawkins <[email protected]>
Signed-off-by: Ogenbertrand <[email protected]>
@KyriosGN0 KyriosGN0 deleted the automount2 branch December 16, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set automountServiceAccountToken: false on Keycloak pods

6 participants