Repository navigation
Replies: 5 comments 7 replies
|
CC: @keycloak/storage-x @keycloak/cloud-native-team @keycloak/kc-maintainers |
|
I think having an opinionated CRD with guardrails as in As long as there is some mechanism (as stated in the proposal, keeping something similar to The higher maintenance cost of how to add these top-level objects to the CRD isn't necessarily a bad thing - it means it would have to involve some consideration in if it should be a top-level object or not. Not to distract from the current discussion but the other considerations here are how the CRD changes would impact upgrades. If things are kept fully backwards compatible for N-1 releases, then there should be no problem - but drastic changes in the CRD (meaning new required fields or behavior change in how a field works) could be problematic and require a different approach for someone upgrading an existing, live deployment. |
|
Looks like we have no other option but #2. Based on our previous discussions, the fact we can't get the same level of integration with OLM in #1 (e.g.: discovering fields) removes it from the game completely. I would love to see the same experience between different runtimes, but if that is against OLM/Operator best practices we can't do much about it. Let's move forward with #2 (I think) for now and see if we can improve it later once we know all the requirements we need to consider to properly generate code. W.r.t. the structure of the CRD, I'm not 100% sure if using our configuration namespaces (e.g.: For me, it looks a lot easier to map options to/from a CRD while still leveraging the documentation/tooling we have. Perhaps we can even generate operator-specific documentation (e.g.: all-config page) if we use a naming pattern that includes the I agree we need the free-form I'm also not sure if we should mix operator-specific options with server options. So perhaps we could have all server options defined in |
|
I'd favour an approach that aligns the Operator config as much as possible with the container and distribution config, and allows direct mapping/translations between the two. Proposal 1 is not that at all; Let's take the example The equivalent in the CLI format is "--db=postgres", which is not comparable to the above. If directly translated to YAML it would rather look something like: That's obviously not quite there, as you'd want to inject the password from a secret. That is something we can and should solve at all levels. |
|
I'd favour an approach that aligns the Operator config as much as possible with the container and distribution config, and allows direct mapping/translations between the two. Proposal 1 is not that at all; Let's take the example The equivalent in the CLI format is "--db=postgres", which is not comparable to the above. If directly translated to YAML it would rather look something like: That's obviously not quite there, as you'd want to inject the password from a secret. That is something we can and should solve at all levels. Reading the docs for the dist today I'm not quite sure how that is handled today, but it should be relatively easy to say "use K8s secrets, then shouldn't matter if you are using the cli, env variables, or the operator, to configure you should be able to set what secret name to use. Same goes around certs and other (smart options) like that; it's not just the Operator that should be cloud/k8 friendly, the container and CLI should also be. That may mean that we need smarter config at all levels, not just in the Operator. With also smarter validation at all levels. Doing something completely different in the Operator adds overhead in maintenance, complexity, documentation, as well as UX. How do we achieve something like what I have in mind? There's two approaches we can take there. First just align with the CLI, and live with the Operator not being ideal, then gradually improve things; or alternatively come up with a config approach that is ideal for the Operator, then gradually unify the two over time. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The new Operator is designed to bring the already great container experience with the Quarkus distribution to a whole new cloud-native level. This includes deployment and the server/distribution configuration in a way that respects K8s best practices. For this, there's a Keycloak CR (Custom Resource) that currently (KC 19) looks something like this:
In that CR, we can see there are several configuration categories:
hostname,tlsSecretbut also the whole free-form (key-value) fieldserverConfiguration. The last one can either take a value as a plain text, or a reference to a Key in a Secret.instancesorimage.disableDefaultIngress.Deployment and Operator configurations are pretty clear, however the Server configuration can be inconsistent. Some fields are top-level (
hostname,tlsSecret), some are hidden underserverConfigurationkey-value map. Reason for this is that currently, the top-level fields are taken as a first-class citizen by the Operator which adds additional logic to them. E.g.hostnameis reflected by the Ingress that the Operator creates.tlsSecretmounts a Secret and actually translates into 2 config options under the hood (https-certificate-file,https-certificate-key-file). On the other hand,serverConfigurationis taken as is and transformed into configuration env vars without the Operator altering it in any way.There are several options to resolve this inconsistency.
Proposal 1: Use only
serverConfigurationWe move every server related top-level field under
serverConfiguration.Pros:
Cons:
tlsSecret. Additional logic in the Operator would be required to mitigate this and to honor the Secure by default principle, e.g. enforce some options are coming from a Secret.https-certificate-fileandhttps-certificate-key-filefor which K8s offers a native Secret type.Example
Proposal 2: Add more top-level fields
We would add selected fields to the top level, tailoring the API (the CR) to cloud-native environment. Some fields would be directly mapped to the dist options (like
hostname), some would be an aggregation or alternative the dist options (liketlsSecret). We would keep the free-formserverConfigurationfield (possibly renaming tostartupOptions) mainly to support easy SPIs configuration which is often added via extensions.Pros:
Cons:
Example
Related:
All reactions