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

Horreum realm import for keycloak and improved app init script #21

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dustinblack
Copy link
Contributor

@dustinblack dustinblack commented Sep 6, 2023

Changes included

  • Add init container for keycloak
  • Automate horreum realm import for keycloak pod
  • Re-implement app init container w/ a loop to avoid crashloopbackoff
  • Remove problematic grafana reference from k8s_setup.sh script

Fixes still needed

To finalize these changes, we still need to correct a problem related to CA certificates with the app. PR #17 from @barreiro includes the basic changes, which are reported to work correctly with vanilla k8s. However, with OpenShift, the keytool command run in the app startup to add the CA cert fails because there is no write access to the root filesystem.

Correcting this involves running the pod, or at least the init container, with a ServiceAccount that has been granted the anyuid privileges in its ClusterRole. Since the ClusterRole and the ClusterRole binding are cluster-level resources, they cannot be created by the operator itself, so these need to be included when deploying the operator in order to make the privilege available to the ServiceAccount that can then be assigned to the container.

@jesperpedersen
Copy link
Collaborator

Can you squash these commits ?

controllers/defaults.go Outdated Show resolved Hide resolved
@jesperpedersen
Copy link
Collaborator

I use git rebase -i HEAD~X - in your case X = 5

@dustinblack
Copy link
Contributor Author

Can you squash these commits ?

I still have some work to do, and then I will clean things up before opening this PR.

@dustinblack dustinblack force-pushed the keycloak-init-test branch 4 times, most recently from 2a0cb00 to c2a8bbf Compare September 6, 2023 15:39
@dustinblack dustinblack marked this pull request as ready for review September 6, 2023 15:39

return &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: cr.Name + "-keycloak-horreum",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I find this name non-descriptive / confusing. I suggest cr.Name + "-keycloak-horreum-realm"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jesperpedersen
Copy link
Collaborator

Remember to squash

remove unnecessary env

keycloak init and realm import

app init container into a loop

import realm file from url

rename configmaps and volumes for horreum realms for better clarity

add sa, cr, and crb to app spec

tweaking and testing rbac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants