Skip to content
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

k8s: defer extra pod labels conversion to labels.Selector #4495

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

milas
Copy link
Contributor

@milas milas commented Apr 30, 2021

Extra pod labels come in as one or more maps of label keys and values
([]labels.Set). Once converted into a list of labels.Selector,
it can be used for matching, but introspecting it is more difficult,
as it requires conversion, which produces a list of
labels.Requirement. The biggest problem that introduces is that
labels.Requirement is more expressive, so backwards conversion
means a bunch of error-handling for (what should be) impossible
cases.

This just passes the labels.Sets as they're parsed from the
Tiltfile through and stores them that way on the target in state.
Once they're actually used, they get converted to the actual
labels.Selectors for matching.

This will simplify the new intermediary step where they'll get
converted to API label selector objects, so that conversion can
happen without hiccups or excessive boilerplate.

Extra pod labels come in as one or more maps of label keys and values
(`[]labels.Set`). Once converted into a list of `labels.Selector`,
it can be used for matching, but introspecting it is more difficult,
as it requires conversion, which produces a list of
`labels.Requirement`. The biggest problem that introduces is that
`labels.Requirement` is more expressive, so backwards conversion
means a bunch of error-handling for (what should be) impossible
cases.

This just passes the `labels.Set`s as they're parsed from the
`Tiltfile` through and stores them that way on the target in state.
Once they're actually used, they get converted to the actual
`labels.Selector`s for matching.

This will simplify the new intermediary step where they'll get
converted to API label selector objects, so that conversion can
happen without hiccups or excessive boilerplate.
@milas milas requested a review from nicks April 30, 2021 18:50
@milas
Copy link
Contributor Author

milas commented Apr 30, 2021

This is just to make the conversion to KubernetesDiscovery easier so that instead of going from labels.Set -> labels.Selector -> metav1.LabelSelector -> labels.Selector, it'll be labels.Set -> metav1.LabelSelector -> labels.Selector.

@milas milas merged commit c8027e5 into master Apr 30, 2021
@milas milas deleted the milas/label-selectors branch April 30, 2021 19:18
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.

None yet

2 participants