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

[Merged by Bors] - Add pod enrichment controller for injecting node addresses #36

Closed
wants to merge 4 commits into from

Conversation

nightkr
Copy link
Member

@nightkr nightkr commented May 13, 2022

Description

Fixes #35

Review Checklist

  • Code contains useful comments
  • (Integration-)Test cases added (or not applicable)
  • Documentation added (or not applicable)
  • Changelog updated (or not applicable)
  • Cargo.toml only contains references to git tags (not specific commits or branches)
  • Helm chart can be installed and deployed operator works (or not applicable)

Once the review is done, comment bors r+ (or bors merge) to merge. Further information

@nightkr nightkr requested a review from a team May 13, 2022 13:49
@nightkr nightkr self-assigned this May 13, 2022
Copy link
Member

@sbernauer sbernauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hdfs go brrrrr


The hostname or IP address of the `Node` that the `Pod` is scheduled to run on.
Compared to `Pod.status.nodeIP`, this can also (but doesn't have to) be a hostname, and prefers
externally routable addresses.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about having to separate labels enrichment.stackable.tech/node-ip and enrichment.stackable.tech/node-hostname? This way the product operator or even the product could decides what he prefers or needs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might add a separate node-ip at some point if something requires that specifically, but part of the point here is to abstract away the fact that not all clus†ers have meaningful (resolvable) hostnames for nodes.

.into_iter()
.filter(move |pod| {
pod.spec.as_ref().and_then(|s| s.node_name.as_deref())
== node.metadata.name.as_deref()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
== node.metadata.name.as_deref()
== Some(&node.name())

feel free to ignore
needs ResourceExt import

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Myeah, ResourceExt needs a bit of a revamp at some point: kube-rs/kube#634

Copy link
Member

@soenkeliebau soenkeliebau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, just one question (haven't tested it yet, sorry).
Would this annotate all pods that are out there? I didn't find anywhere that this is restricted to something carrying a specific Stackable label or similar?

pod_restart_controller,
pod_enrichment_controller
);
futures::future::select(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using select_all instead of chaining selects have the same effect here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but select_all boxes all the futures, effectively making each of them a black box for the optimizer.

I'm not sure how big the impact of that is here specifically, but…

@nightkr
Copy link
Member Author

nightkr commented May 19, 2022

Would this annotate all pods that are out there? I didn't find anywhere that this is restricted to something carrying a specific Stackable label or similar?

Yes, on the assumption that the annotation is namespaced anyway, so it shouldn't clash and anything that doesn't care can just ignore the annotation.

@soenkeliebau
Copy link
Member

Would this annotate all pods that are out there? I didn't find anywhere that this is restricted to something carrying a specific Stackable label or similar?

Yes, on the assumption that the annotation is namespaced anyway, so it shouldn't clash and anything that doesn't care can just ignore the annotation.

Ok, fine for me. Is there anything to consider around this in an RBAC enabled environment? Would the operator keep throwing errors when trying to annotate pods it doesn't have the right to change or something like that?

@nightkr
Copy link
Member Author

nightkr commented May 19, 2022

That's true, that'd happen for pods that it has permission to read but not patch…

@soenkeliebau
Copy link
Member

That's true, that'd happen for pods that it has permission to read but not patch…

We need to at some point look into having a stackableconfig configmap I think. We've had a couple of things come up that would be useful to configure centrally over the past few weeks. This is another one of those, being able to configure labelselector to match pods that should get annotated would give us a mechanism to improve this, where needed.

@nightkr
Copy link
Member Author

nightkr commented May 19, 2022

In that case I'd rather just hard-code a labelselector that triggers this..

@nightkr
Copy link
Member Author

nightkr commented May 19, 2022

Added a filter to only enrich pods with the label enrichment.stackable.tech/enabled: true

@nightkr
Copy link
Member Author

nightkr commented May 19, 2022

bors r+

bors bot pushed a commit that referenced this pull request May 19, 2022
@bors
Copy link

bors bot commented May 19, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Add pod enrichment controller for injecting node addresses [Merged by Bors] - Add pod enrichment controller for injecting node addresses May 19, 2022
@bors bors bot closed this May 19, 2022
@bors bors bot deleted the feature/pod-enrichment branch May 19, 2022 12:14
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.

Annotate pods with node address
3 participants