Skip to content

Conversation

@Diaphteiros
Copy link
Contributor

@Diaphteiros Diaphteiros commented May 12, 2025

What this PR does / why we need it:

Change 1:
The controller-runtime library already has a LabelSelectorPredicate function, but it takes a metav1.LabelSelector as an argument and converts it into a labels.Selector internally. This PR adds a similar function to the controller library, but it works directly on a label.Selector, which is useful if the selector is build in code and does not originate from a metav1.LabelSelector or if it already was converted to a labels.Selector earlier.

Change 2:
The clusters package now allows to create a fake Cluster from an existing client. This is useful for testing purposes, but the resulting Cluster will not be fully functional and calling anything but Client() on it will likely result in a panic or undefined behavior.

Change 3:
In addition to the RegisterConfigPathFlag method, which adds a --<id>-cluster flag to the given FlagSet, the clusters package now also offers a RegisterSingleConfigPathFlag function, which works similarly, but names the flag --kubeconfig, which is more intuitive if only a single cluster is passed into the controller as an argument.

@Diaphteiros Diaphteiros requested a review from robertgraeff May 12, 2025 08:55
@Diaphteiros Diaphteiros changed the title add LabelSelectorPredicate function to controller library minor improvements May 13, 2025
@Diaphteiros Diaphteiros changed the title minor improvements minor improvements (includes release v0.8.0) May 13, 2025
@robertgraeff robertgraeff merged commit c066965 into main May 14, 2025
7 checks passed
@robertgraeff robertgraeff deleted the lspred branch May 14, 2025 05:57
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

Successfully merging this pull request may close these issues.

3 participants