Early on, when designing initial version of Keycloak Operator, we decided to create Realms and never update them from Operator. Our idea was that users will create an empty realm and edit it via Keycloak Admin Console. This breaks symmetry with other CRs (KeycloakUser, KeycloakClient), which are always updated.
After thinking about this for a moment, I'd like to propose introducing a boolean switch to all our CRs, called "managed". If the switch is set to true, Keycloak Operator will synchronize all the updates. If the switch is set to false, Keycloak Operator will only create the resource and then never update it. This mode might be useful if you'd like to create a Realm and manage it via Keycloak Admin Console.Hey Sebastian,we used the same strategy in our old internal Keycloak Operator. How would this A few questions:1) what is the default value if the field is not provided?
2) what if users are provided in a Realm CR and also in a User CR? Who wins?
3) will other CRs also get this switch or will they always be managed?
I think a default value of 'managed: true' would make sense: otherwise users could run into the situation where they created a realm a while ago, made changes in the admin console and then they all get reset once the flag is switched.
Regards,PeterOn Wednesday, August 12, 2020 at 9:25:46 AM UTC+2 sebastian...@gmail.com wrote:Hey,This discussion is related to https://issues.redhat.com/browse/KEYCLOAK-15142Early on, when designing initial version of Keycloak Operator, we decided to create Realms and never update them from Operator. Our idea was that users will create an empty realm and edit it via Keycloak Admin Console. This breaks symmetry with other CRs (KeycloakUser, KeycloakClient), which are always updated.
After thinking about this for a moment, I'd like to propose introducing a boolean switch to all our CRs, called "managed". If the switch is set to true, Keycloak Operator will synchronize all the updates. If the switch is set to false, Keycloak Operator will only create the resource and then never update it. This mode might be useful if you'd like to create a Realm and manage it via Keycloak Admin Console.What do you think about this proposal?
--Thanks,Sebastian
You received this message because you are subscribed to the Google Groups "Keycloak Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-dev/0380c36f-02d9-48bc-9753-dbfaa7be2c42n%40googlegroups.com.
I’m new to the discussion and don’t have a full picture what happened so far in the operator.
So don’t mind to ignore this comment J
IMHO CRD are mostly used to describe a desired state. If an “managed” flag is introduced. This would indicate to me that CRD is also not removed if the resource is removed. This brings the question to my mind why the CRD was there in the first place.
Idea:
If the CRD is unmanaged it could be a job like interface. E.g. CreateClient CRD CreateRealm CRD etc. as in the K8s Job/CronJob API the Create* CRDs could consist of a higher level strategy as “override vs update” or may how many clients of the same type are created via an iterator etc. The separation of concern for the run once CRDs and the synced CRDs would allow a clear separation of such configurations. Eventually these Create* CRDs would wrap a concrete CRD e.g. a Client etc. After successful creation these CRDs could be dropped or show their final state forever in the state section.
In any case something like this would be more idiomatic to k8s IMHO. Also users would have a clear separation between run once and synced objects.
Mit freundlichen Grüßen / Best regards
Markus Till
Project Delivery Berlin 22 (IOC/PDL22)
Bosch.IO GmbH | Ziegelei 7 | 88090 Immenstaad |
GERMANY | www.bosch.io
Tel. +49 30 726112-354 | Mobil +49 172 5782078 | Telefax +49 30 726112-100 |
Threema /
Threema Work: FHKUKVDR
| Marku...@bosch.io
Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B
Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten Lücke; Geschäftsführung: Dr. Stefan Ferber, Dr. Aleksandar Mitrovic, Yvonne Reckling
--
You received this message because you are subscribed to the Google Groups "Keycloak Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
keycloak-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-dev/c11621ec-bccf-40f5-9f1e-069a45565ddan%40googlegroups.com.
Hey Sebastian,the proposal looks reasonable to me. Comments inline.On Wed, Aug 12, 2020 at 9:38 AM Peter Braun <pbr...@redhat.com> wrote:Hey Sebastian,we used the same strategy in our old internal Keycloak Operator. How would this A few questions:1) what is the default value if the field is not provided?IMHO it should default to "true" (since users might naturally expect performing the changes via the webconsoleor "oc edit" command to work without additional settings need to be performed in advance).
2) what if users are provided in a Realm CR and also in a User CR? Who wins?Maybe merge / union the requests if intersection of the users definition in both CRs is disjunctive?If the requests are conflicting ones, I would say the definition in User CR should win (since IMHOthis is what the operator user would expect to happen).
3) will other CRs also get this switch or will they always be managed?To preserve the consistency other CRs should get this switch too IMHO.
I think a default value of 'managed: true' would make sense: otherwise users could run into the situation where they created a realm a while ago, made changes in the admin console and then they all get reset once the flag is switched.+1 on defaulting to "true" setting (the behavior you described [sudden values reset upon flag switch] might be confusing to the users IMHO. Plus one might expect the "oc edit" command on the resource just work [without additional settings need to be performed apriori] if the field is allowed to be edited in CR definition).
I’m new to the discussion and don’t have a full picture what happened so far in the operator.
So don’t mind to ignore this comment J
IMHO CRD are mostly used to describe a desired state. If an “managed” flag is introduced. This would indicate to me that CRD is also not removed if the resource is removed. This brings the question to my mind why the CRD was there in the first place.
Is there documentation on this design? I would like to dive deeper before my next comment.
Anyways an also unqualified addition to my initial comment ;):
I was a bit unspecific.
I was referring to resources as resources In Keycloak. So if you drop a Client CR in k8s it will not drop the resource in Keycloak. That’s what I understood as “unmanaged”
Therefore if you create 100 clients in k8s it might turn out a lot of them aren’t in Keycloak at all or are changed over time. So the information value of this objects kept in k8s is unclear to me, It just indicates that someone at some point created a Client but not what the state of this client is, so the client fields makes no sense (as you said sync is hard and also a bit against the principles of k8s).
To represent a unmanaged Client I would rather expect a UnmanagedClient CR or the proposed Client CR (with unmanaged flag) which holds just the clientid or things which won’t change. In addition I would expect its deleted if the user deletes the client in the admin api.
Therefore I would split the CR which have a constant desired state as e.g. a Client which will be changed back if changed on the admin ui. (Keycloak should may support immutable clients for this use case).
And Clients which are created only once. This kind of Clients can disappear after the job is done. So I would design them like a Job in k8s.
In general I find it confusing to combine immutable configuration (k8s) and mutable configuration (Keycloak) in the same object.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-dev/1e2b674d-ceee-4405-8501-17f39323d8a5n%40googlegroups.com.
Is there documentation on this design? I would like to dive deeper before my next comment.
Anyways an also unqualified addition to my initial comment ;):
I was a bit unspecific.
I was referring to resources as resources In Keycloak. So if you drop a Client CR in k8s it will not drop the resource in Keycloak. That’s what I understood as “unmanaged”
Therefore if you create 100 clients in k8s it might turn out a lot of them aren’t in Keycloak at all or are changed over time. So the information value of this objects kept in k8s is unclear to me, It just indicates that someone at some point created a Client but not what the state of this client is, so the client fields makes no sense (as you said sync is hard and also a bit against the principles of k8s).
To represent a unmanaged Client I would rather expect a UnmanagedClient CR or the proposed Client CR (with unmanaged flag) which holds just the clientid or things which won’t change. In addition I would expect its deleted if the user deletes the client in the admin api.
Therefore I would split the CR which have a constant desired state as e.g. a Client which will be changed back if changed on the admin ui. (Keycloak should may support immutable clients for this use case).
And Clients which are created only once. This kind of Clients can disappear after the job is done. So I would design them like a Job in k8s.
In general I find it confusing to combine immutable configuration (k8s) and mutable configuration (Keycloak) in the same object.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-dev/CADP5VTUBjeTR1aKjq1ZNgmLZkU2pPp-f0aQifUy41BitTKDAZg%40mail.gmail.com.
I also like this idea of owned “resources”. Could also be used to prevent people from messing with the internal clients (security-admin-console, account, etc…).
Best regards,
Sebastian
Mit freundlichen Grüßen / Best regards
Dr.-Ing. Sebastian Schuster
Project Delivery Berlin 22 (IOC/PDL22)
Bosch.IO GmbH | Ullsteinstr. 128 | 12109 Berlin |
GERMANY | www.bosch.io
Tel. +49 30 726112-485 | Mobil +49 152 02177668 | Telefax +49 30 726112-100 |
Sebastian...@bosch.io
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-dev/CADP5VTUBjeTR1aKjq1ZNgmLZkU2pPp-f0aQifUy41BitTKDAZg%40mail.gmail.com.