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 flagd sidecar resources attribute #514

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

L3o-pold
Copy link
Contributor

@L3o-pold L3o-pold commented Aug 3, 2023

This PR

  • adds resources attribute for FlagSourceConfiguration CRD to configure flagd sidecar resources

Related Issues

Fixes #511

Notes

Follow-up Tasks

How to test

@L3o-pold L3o-pold requested a review from a team as a code owner August 3, 2023 12:11
@L3o-pold L3o-pold force-pushed the add-resources-flag branch 2 times, most recently from df1f228 to e66aee1 Compare August 3, 2023 12:14
@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #514 (d88e783) into main (31d8d5a) will increase coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #514      +/-   ##
==========================================
+ Coverage   82.70%   82.78%   +0.07%     
==========================================
  Files          22       22              
  Lines        1417     1423       +6     
==========================================
+ Hits         1172     1178       +6     
  Misses        207      207              
  Partials       38       38              
Files Changed Coverage Δ
...pis/core/v1alpha1/flagsourceconfiguration_types.go 97.09% <ø> (ø)
...is/core/v1alpha2/featureflagconfiguration_types.go 50.00% <ø> (ø)
...pis/core/v1alpha3/flagsourceconfiguration_types.go 100.00% <ø> (ø)
controllers/common/flagd-injector.go 91.04% <100.00%> (+0.15%) ⬆️
Flag Coverage Δ
unit-tests 82.78% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@Kavindu-Dodan
Copy link
Contributor

Thank you again for your contribution.

We already have the ability to configure flagd resource limits. But this is done through operator startup parameters 1 2. However, these configurations seems to be not well documented and difficult to manipulate the K8s descriptors. Hence, I see the proposed approach through this PR to superior.

However, I think we can still have default resource requests/limits defined through current configurations and later override them through proposed change. @L3o-pold if you have time, you can write tests to cover this overriding behavior

cc - @toddbaert & @thisthat appreciate input

Footnotes

  1. https://github.com/open-feature/open-feature-operator/blob/main/main.go#L268-L275

  2. https://github.com/open-feature/open-feature-operator/blob/e74006872ebbc6595332a3722657f64e34ef1f29/controllers/common/flagd-injector.go#L346

@L3o-pold
Copy link
Contributor Author

L3o-pold commented Aug 3, 2023

@Kavindu-Dodan My current PR continues to use resources limits defined on the operator level but allow custom resources limits (override).

@beeme1mr
Copy link
Member

beeme1mr commented Aug 3, 2023

Hey @L3o-pold, could you please update the FlagSourceConfiguration docs with an example?

@Kavindu-Dodan
Copy link
Contributor

@Kavindu-Dodan My current PR continues to use resources limits defined on the operator level but allow custom resources limits (override).

Yup, thank you for noticing this

+1 for @beeme1mr's point on doc update

@L3o-pold L3o-pold force-pushed the add-resources-flag branch 4 times, most recently from 9bd24c8 to 00486b0 Compare August 3, 2023 20:23
Copy link
Contributor

@Kavindu-Dodan Kavindu-Dodan left a comment

Choose a reason for hiding this comment

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

Approving

Let's wait for #513 and rebase before the merge

@Kavindu-Dodan
Copy link
Contributor

@L3o-pold could you please rebase and resolve conflicts that comes from #513 ? I will get this through within the day

Signed-off-by: Leopold Jacquot <leopold.jacquot@infomaniak.com>
@thisthat
Copy link
Member

thisthat commented Aug 4, 2023

Thank you again for your contribution.

We already have the ability to configure flagd resource limits. But this is done through operator startup parameters 1 2. However, these configurations seems to be not well documented and difficult to manipulate the K8s descriptors. Hence, I see the proposed approach through this PR to superior.

However, I think we can still have default resource requests/limits defined through current configurations and later override them through proposed change. @L3o-pold if you have time, you can write tests to cover this overriding behavior

cc - @toddbaert & @thisthat appreciate input

Footnotes

  1. main/main.go#L268-L275
  2. e740068/controllers/common/flagd-injector.go#L346

I agree with your suggestion @Kavindu-Dodan 👍
Unrelated to this PR, I noticed that the FlagSourceConfigurationSpec allows configuring the image to inject. I would suggest removing this property from such a configuration CRD since it could be abused to inject arbitrary images and could be a security problem. I see the need to allow using a different registry (e.g., in air-gapped envs), but I would rather keep it only as a startup parameter.

@Kavindu-Dodan
Copy link
Contributor

@thisthat thank you for noticing this. I think we can follow-up on this improvement as well as the test scenario I described later on

I will go ahead with the merging this PR

@Kavindu-Dodan
Copy link
Contributor

Thank you again for your contribution.
We already have the ability to configure flagd resource limits. But this is done through operator startup parameters 1 2. However, these configurations seems to be not well documented and difficult to manipulate the K8s descriptors. Hence, I see the proposed approach through this PR to superior.
However, I think we can still have default resource requests/limits defined through current configurations and later override them through proposed change. @L3o-pold if you have time, you can write tests to cover this overriding behavior
cc - @toddbaert & @thisthat appreciate input

Footnotes

  1. main/main.go#L268-L275
  2. e740068/controllers/common/flagd-injector.go#L346

I agree with your suggestion @Kavindu-Dodan 👍 Unrelated to this PR, I noticed that the FlagSourceConfigurationSpec allows configuring the image to inject. I would suggest removing this property from such a configuration CRD since it could be abused to inject arbitrary images and could be a security problem. I see the need to allow using a different registry (e.g., in air-gapped envs), but I would rather keep it only as a startup parameter.

Created a follow-up for this #517

@Kavindu-Dodan Kavindu-Dodan merged commit 56ad0bd into open-feature:main Aug 7, 2023
13 checks passed
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.

Allow custom resources definition
4 participants