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

feat: Add pdb support for target allocator #2411

Merged
merged 6 commits into from
Dec 18, 2023

Conversation

JorTurFer
Copy link
Contributor

Description: Target allocator supports pdb
Link to tracking Issue: #2261
Testing: Some unit tests and e2e tests have been added to validate the content
Documentation: I've updated api docs

@JorTurFer JorTurFer requested a review from a team December 3, 2023 20:34
Signed-off-by: Jorge Turrado <[email protected]>
Signed-off-by: Jorge Turrado <[email protected]>
Signed-off-by: Jorge Turrado <[email protected]>
@JorTurFer
Copy link
Contributor Author

I'd say that failing test isn't related with my changes, could you reenqueue it?

@JorTurFer JorTurFer closed this Dec 3, 2023
@JorTurFer JorTurFer reopened this Dec 3, 2023
@JorTurFer
Copy link
Contributor Author

🤦
I closed the PR by mistake

change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
component: operator
Copy link
Member

Choose a reason for hiding this comment

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

this should be target allocator

Copy link
Contributor Author

@JorTurFer JorTurFer Dec 4, 2023

Choose a reason for hiding this comment

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

I added to the operator because the changes have been done in operator code. I mean, although it applies to the target allocator, the changed code is released as part of the operator (it's not part of target-allocator bin but operator bin)
I'll update this with the other comments once they are solved

apiVersion: v1
kind: Namespace
metadata:
name: create-pdbs-target-allocator
Copy link
Member

Choose a reason for hiding this comment

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

why a custom namespace is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use a custom namespace for testing all the labels because app.kubernetes.io/instance is build namespace.crName. But I can remove that validation if you think it's not useful

Copy link
Member

Choose a reason for hiding this comment

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

that can be unit-tested as well

@@ -0,0 +1,149 @@
# This creates four different deployments for checking different pdb options:
Copy link
Member

Choose a reason for hiding this comment

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

I like the test completeness but this is already tested with unit tests. It seems enough to just keep a single instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did the same for the collector pdb. Should I remove them there too? I added all the cases because it allows IntOrString as type (and it's quite "magic" for me).
It doesn't have any extra cost and covers it but I can remove them, keeping just one, as you prefer

Copy link
Member

Choose a reason for hiding this comment

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

Those can be removed as well

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

Are we ok merging this before we have a separate TargetAllocator CRD? @jaronoff97 @pavolloffay

@JorTurFer
Copy link
Contributor Author

Are we ok merging this before we have a separate TargetAllocator CRD? @jaronoff97 @pavolloffay

I hope so xD #2261 (comment)

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

two small changes, otherwise this looks good. In reference to @swiatekm-sumo 's question, I think it's fine to put this in before we have a TA CRD. This will just be another field we need to migrate.

// we set MaxUnavailable 1, which will work even if there is
// just one replica, not blocking node drains but preventing
// out-of-the-box from disruption generated by them with replicas > 1
if r.Spec.TargetAllocator.Enabled && r.Spec.TargetAllocator.PodDisruptionBudget == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also only set this for the consistent hashing strategy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a check for that in the manifest generator, is it needed in the defaulter too?

Copy link
Contributor Author

@JorTurFer JorTurFer Dec 4, 2023

Choose a reason for hiding this comment

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

nvm, ignore my question, after reading your second comment, it makes sense totally xD

@swiatekm swiatekm self-requested a review December 4, 2023 17:20
@pavolloffay
Copy link
Member

Are we ok merging this before we have a separate TargetAllocator CRD? @jaronoff97 @pavolloffay

I am fine with merging this. We need to spend some time how the TA CRD will look like in the v1alpha2

@JorTurFer
Copy link
Contributor Author

I'll address all the comments later on

Signed-off-by: Jorge Turrado <[email protected]>
@JorTurFer
Copy link
Contributor Author

I've addressed all the feedback (at least I hope so), PTAL

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

just one small thing otherwise this is looking pretty good!

Signed-off-by: Jorge Turrado <[email protected]>
@jaronoff97 jaronoff97 enabled auto-merge (squash) December 8, 2023 19:26
@pavolloffay
Copy link
Member

@swiatekm-sumo could you please re-review? The PR cannot be merged without your approval

@jaronoff97 jaronoff97 merged commit d7d0166 into open-telemetry:main Dec 18, 2023
26 checks passed
@JorTurFer JorTurFer deleted the add-pdb branch December 18, 2023 14:00
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
* feat: Add pdb support for target allocator

Signed-off-by: Jorge Turrado <[email protected]>

* fix e2e tests

Signed-off-by: Jorge Turrado <[email protected]>

* fix e2e tests

Signed-off-by: Jorge Turrado <[email protected]>

* update bundle

Signed-off-by: Jorge Turrado <[email protected]>

* Address feedback

Signed-off-by: Jorge Turrado <[email protected]>

* Change log level

Signed-off-by: Jorge Turrado <[email protected]>

---------

Signed-off-by: Jorge Turrado <[email protected]>
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.

4 participants