-
Notifications
You must be signed in to change notification settings - Fork 218
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
make namespace parsing and informers pluggable #626
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure why this change is needed since the current implementation (without this PR) also watchs only the dedicated namespace.
Here's the scenario ...
Because of the way Informers work under the hood (Informers implement the underlying watch functionality), you can only select one namespace to watch or all namespaces to watch. With the current implementation this scenario wouldn't seem to work ... |
@emsixteeen Uhm, I see. I understand your situation, but as I can see your code, the mpi-operator can only watch a single namespace the same as before, right?: mpi-operator/pkg/informers/informers.go Lines 15 to 19 in a4c30dc
|
That is correct – the PR does not change any current functionality or implementation. Rather, it provides an extension point to call different InformerFactory functions for each of the Informers. It does this by replacing the actual call to The PR provides a default function which behaves the same way as the current implementation, which is what you referenced. The crux of the changes are where the function definition is defined: mpi-operator/cmd/mpi-operator/app/options/additional.go Lines 24 to 34 in a4c30dc
Here is where / how it's used: mpi-operator/cmd/mpi-operator/app/server.go Lines 140 to 141 in a4c30dc
For comparison, the current implementation: mpi-operator/cmd/mpi-operator/app/server.go Lines 141 to 142 in a1ff84c
Considering the scenario, the thought process and rationale for these changes: Background:
Options:
Thoughts:
Usability: In order to make use of the extension points, a new package is needed, which is composed using the There's probably plenty more pros and cons which haven't even been touched upon ... Perhaps there's a some better way to go about this ...? Footnotes |
Thank you for this clarifications. TBH, I don't like such extension points for external mpi-operator. Also, if it's challenging to make efforts for you in this repository or upstream kubernetes, you can fork this repository, and you can directly improve the forked mpi-operator with x-ns informers. @alculquicondor WDYT? |
Also, I guess that switching to controller-runtime would be possible to create x-ns informers like this: https://github.com/kubernetes-sigs/controller-runtime/blob/56159419231e985c091ef3e7a8a3dee40ddf1d73/pkg/cache/cache.go#L223-L225 But, I'm not sure that the controller-runtime will really resolve this issue. |
I don't think it will resolve it ... I haven't checked the If it's the case – that it's using the standard generated Informers – then that's the key issue: an Informer will List either one namespace or all namespaces. The filtering is done post-facto – i.e. the Informer will get objects from all namespaces, but the filter will only act upon interested namespace(s). The catch there is that if RBAC rules don't allow for some item to be listed across all namespaces, the Informer will keep getting a permission error, and the |
It's not that I'm looking to implement another operator, inasmuch as be afforded functionality that is not available in the current design. (Noting that the current design is more an artifact of how Kubernetes codegen works, and not directly related to the design of the
Totally understand... The main reason this PR creates extension points was so that there would be no need to bring in (and create dependencies upon) experimental packages (such as On one hand, creating extension points can become a liability in the long term (needing to support it, side effects, risking breaking other things down the road, etc.) ... On the other hand, I don't know of another way to do this without creating additional dependencies and also obtaining this functionality (barring upstream code changes in how Regardless, I'm completely open to bringing this functionality directly into [this] upstream Here's an early prototype of what bringing in
Given the value the project has delivered, I'd really rather the effort be applied to the upstream project...
|
@emsixteeen I meant that I disagree with both exporting Informer for external projects and using the xns-informer in this project. If you don't want to such a discussion in the kubernetes core project, you can just fork this repository and then you can extend the mpi-operator using the I think importing not maintainable library (xns-informer) should avoid as much as possible, and we should not increase maintenance costs by exporting functions for the external projects. |
This addresses #620 – in the case where the
mpi-operator
is running in a highly restrictive RBAC environment and the need to runMPIJobs
in only a subset of namespaces.The changes provide:
SharedInformerFactory
for each type of Informer or user-provided ones.