Skip to content

Define how controllers / operator should be externally configured #237

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

Closed
metacosm opened this issue Nov 25, 2020 · 8 comments
Closed

Define how controllers / operator should be externally configured #237

metacosm opened this issue Nov 25, 2020 · 8 comments
Assignees

Comments

@metacosm
Copy link
Collaborator

#228 was created as an experiment to see how things could be done but I think we need to formalize how configuration should be handled so that users can configure their controllers / operator without having to modify / rebuild the code.

@metacosm
Copy link
Collaborator Author

metacosm commented Nov 25, 2020

Proposal

  • Be able to configure things in an application.properties or application.yml file.
  • Configure the client at the operator level
  • Name controllers so that they can be configured individually in particular for scope and retry
  • Config classes should be POJOs to be extended by frameworks for specific support (i.e. Spring Boot, Quarkus…)

Client

  • io.javaoperatorsdk.kubernetes.client prefix
  • Properties similar to what's already defined in OperatorProperties
  • OpenShift status should probably be automatically inferred and not "hardcoded"

Controllers

  • io.javaoperatorsdk.controller.<controller name> prefix
  • io.javaoperatorsdk.controller.<controller name>.namespaces: comma-separated list of target namespaces the controller watches, if no value is provided, current namespace (i.e. the one the client is connected to) is assumed. If the value is (or contains) ALL_NAMESPACES, the controller watches all namespaces.
  • io.javaoperatorsdk.controller.<controller name>.retry prefix: properties similar to what's already defined in RetryProperties

/cc @adam-sandor @kirek007 @psycho-ir @csviri

@s-soroosh
Copy link
Contributor

Thanks, @metacosm, the proposal looks good to me.
Maybe one thing to add, we may need a way to make the operator cluster-scoped.
Adding a new field like:
io.javaoperatorsdk.controller.<controller name>.scope = namespace|cluster may help in this regard.

@metacosm
Copy link
Collaborator Author

Thanks, @metacosm, the proposal looks good to me.
Maybe one thing to add, we may need a way to make the operator cluster-scoped.
Adding a new field like:
io.javaoperatorsdk.controller.<controller name>.scope = namespace|cluster may help in this regard.

We could make it more explicit but it should be covered using io.javaoperatorsdk.controller.<controller name>.namespaces=ALL_NAMESPACES, no?

@s-soroosh
Copy link
Contributor

s-soroosh commented Nov 26, 2020

Thanks, @metacosm, the proposal looks good to me.
Maybe one thing to add, we may need a way to make the operator cluster-scoped.
Adding a new field like:
io.javaoperatorsdk.controller.<controller name>.scope = namespace|cluster may help in this regard.

We could make it more explicit but it should be covered using io.javaoperatorsdk.controller.<controller name>.namespaces=ALL_NAMESPACES, no?

I don't think so, a CR can be cluster-scoped, that means its resources don't live in none of the namespaces.
e.g. PersistentVolume is a cluster-scoped resource.

@metacosm
Copy link
Collaborator Author

metacosm commented Nov 26, 2020

Ah yes, forgot about that. Let's add the scope property then.

@kirek007
Copy link
Contributor

Thanks, @metacosm, the proposal looks good to me.
Maybe one thing to add, we may need a way to make the operator cluster-scoped.
Adding a new field like:
io.javaoperatorsdk.controller.<controller name>.scope = namespace|cluster may help in this regard.

Definitely we should go this way. It's the way objects in kubernetes are scoped.

metacosm added a commit to halkyonio/java-operator-sdk that referenced this issue Nov 27, 2020
metacosm added a commit to halkyonio/java-operator-sdk that referenced this issue Dec 4, 2020
metacosm added a commit to halkyonio/java-operator-sdk that referenced this issue Dec 9, 2020
metacosm added a commit to halkyonio/java-operator-sdk that referenced this issue Dec 11, 2020
metacosm added a commit to halkyonio/java-operator-sdk that referenced this issue Dec 16, 2020
metacosm added a commit to halkyonio/java-operator-sdk that referenced this issue Dec 17, 2020
@metacosm
Copy link
Collaborator Author

One issue that popped out after the work done in #238, is how should we configure the Kubernetes client. The Quarkus extension relies on the Kubernetes Client extension to retrieve a fully configured client. However, this means that the client is configured using quarkus.kubernetes-client. prefixed properties. Moreover, the available properties cover a lot more than what is currently supported in the operator SDK.

The question is therefore whether or not we should strive to expose a simplified / unified k8s client configuration properties for all implementations or are we OK to have Quarkus-based implementations use a different configuration for that aspect? What do you think @adam-sandor @psycho-ir @csviri?

metacosm added a commit to halkyonio/java-operator-sdk that referenced this issue Dec 17, 2020
metacosm added a commit that referenced this issue Jan 14, 2021
The intent here is that controllers should be registered according to
their configuration. This will become even more relevant when
externalized configuration is in place (see #237). This also means
using ControllerConfiguration.WATCH_ALL_NAMESPACES_MARKER in the
namespaces field of the Controller annotation where appropriate since
that's what ControllerConfiguration uses to determine if a controller
should watch all namespaces. This still needs to be unified across the
code base (see #302).
metacosm added a commit that referenced this issue Jan 14, 2021
The intent here is that controllers should be registered according to
their configuration. This will become even more relevant when
externalized configuration is in place (see #237). This also means
using ControllerConfiguration.WATCH_ALL_NAMESPACES_MARKER in the
namespaces field of the Controller annotation where appropriate since
that's what ControllerConfiguration uses to determine if a controller
should watch all namespaces. This still needs to be unified across the
code base (see #302).
metacosm added a commit that referenced this issue Jan 19, 2021
The intent here is that controllers should be registered according to
their configuration. This will become even more relevant when
externalized configuration is in place (see #237). This also means
using ControllerConfiguration.WATCH_ALL_NAMESPACES_MARKER in the
namespaces field of the Controller annotation where appropriate since
that's what ControllerConfiguration uses to determine if a controller
should watch all namespaces. This still needs to be unified across the
code base (see #302).
metacosm added a commit that referenced this issue Jan 20, 2021
The intent here is that controllers should be registered according to
their configuration. This will become even more relevant when
externalized configuration is in place (see #237). This also means
using ControllerConfiguration.WATCH_ALL_NAMESPACES_MARKER in the
namespaces field of the Controller annotation where appropriate since
that's what ControllerConfiguration uses to determine if a controller
should watch all namespaces. This still needs to be unified across the
code base (see #302).
@metacosm
Copy link
Collaborator Author

metacosm commented Aug 2, 2021

As framework-specific code has been removed from the core SDK, it's up to each implementation to figure out how to implement externalized configuration. Please refer, therefore, to each implementation's respective documentation:

There are two things of note:

  1. While it would help that configuration properties be consistent across implementations, it's not always possible, nor desirable, in particular when common configuration would go against framework idioms. Each framework is thus configured as decided best by implementations with compatibility across implementations being a secondary goal.
  2. The code SDK configuration implementation is not currently externalizable but there hasn't been a need to provide support for this as this point, so we're closing this issue for now,

@metacosm metacosm closed this as completed Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants