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

Make kubeobject utils more generic #3425

Merged
merged 26 commits into from
Jul 19, 2024
Merged

Make kubeobject utils more generic #3425

merged 26 commits into from
Jul 19, 2024

Conversation

0sewa0
Copy link
Contributor

@0sewa0 0sewa0 commented Jul 8, 2024

Description

K8S-9483

Basic idea is to have the same interface for interacting with the kube-api, as we have multiple ways of doing it.

Changes: (the commits are semi-nicely structured)

  • Stopped using the Modifier/Builder interface in the kubeobjects, as it was overkill and made a simpler one
  • Replaced the Query struct with a generic implementation that is reusable for every client.Object
  • Updated all previous Query objects usages
  • If I touched a file, I updated the imports accordingly
  • Replaced some obvious copy-paste code:

Sidenote:

  • The generic Query struct evolved as I replaced the old utils, so it can be used for all current usecases
  • There are still soooooo much to fix, but this PR is already too big to nicely review, so I will create follow-ups.
    • Example:
      • The folder structure of kubeobjects could use some love
      • I didn't replace all the "old utils"

How can this be tested?

No change in behaviour

@0sewa0 0sewa0 added the core Changes to core functionality of the Operator label Jul 8, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 78.12500% with 98 lines in your changes missing coverage. Please review.

Project coverage is 57.77%. Comparing base (e4a2a0f) to head (0445b43).

Files Patch % Lines
pkg/util/kubeobjects/internal/query/query.go 87.15% 7 Missing and 7 partials ⚠️
pkg/util/kubeobjects/pod/query.go 0.00% 13 Missing ⚠️
pkg/controllers/dynakube/extension/secret.go 50.00% 10 Missing and 2 partials ⚠️
pkg/util/conditions/secret.go 0.00% 8 Missing ⚠️
pkg/util/kubeobjects/configmap/builder.go 58.82% 7 Missing ⚠️
pkg/util/kubeobjects/secret/builder.go 65.00% 7 Missing ⚠️
pkg/util/kubeobjects/secret/tokens.go 53.33% 4 Missing and 3 partials ⚠️
pkg/util/kubeobjects/configmap/query.go 58.33% 4 Missing and 1 partial ⚠️
pkg/util/kubeobjects/daemonset/query.go 61.53% 4 Missing and 1 partial ⚠️
pkg/util/kubeobjects/deployment/query.go 61.53% 4 Missing and 1 partial ⚠️
... and 7 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3425      +/-   ##
==========================================
- Coverage   58.05%   57.77%   -0.28%     
==========================================
  Files         365      371       +6     
  Lines       20316    20162     -154     
==========================================
- Hits        11794    11649     -145     
- Misses       7269     7277       +8     
+ Partials     1253     1236      -17     
Flag Coverage Δ
unittests 57.77% <78.12%> (-0.28%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@0sewa0 0sewa0 changed the title Make kubeobjects.Query generic Make kubeobject utils more generic Jul 8, 2024
@albertogdd

This comment was marked as outdated.

@0sewa0 0sewa0 marked this pull request as ready for review July 11, 2024 08:24
@0sewa0 0sewa0 requested a review from a team as a code owner July 11, 2024 08:24
@0sewa0 0sewa0 marked this pull request as draft July 11, 2024 10:58
@0sewa0
Copy link
Contributor Author

0sewa0 commented Jul 11, 2024

convert it back to draft, forgot about the owner-reference 😅

@0sewa0 0sewa0 marked this pull request as ready for review July 17, 2024 15:40
@0sewa0 0sewa0 requested a review from aorcholski July 18, 2024 12:59
pkg/controllers/dynakube/activegate/reconciler.go Outdated Show resolved Hide resolved
pkg/controllers/dynakube/extension/secret.go Outdated Show resolved Hide resolved
pkg/controllers/dynakube/oneagent/oneagent_reconciler.go Outdated Show resolved Hide resolved
pkg/controllers/dynakube/proxy/reconciler.go Outdated Show resolved Hide resolved
pkg/controllers/edgeconnect/controller.go Outdated Show resolved Hide resolved
pkg/controllers/edgeconnect/controller.go Outdated Show resolved Hide resolved
@0sewa0 0sewa0 requested review from gkrenn and aorcholski July 19, 2024 08:30
gkrenn
gkrenn previously approved these changes Jul 19, 2024
Copy link
Contributor

@gkrenn gkrenn left a comment

Choose a reason for hiding this comment

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

Tested with simple cloudnative deployment, everything alright 👍

@andriisoldatenko andriisoldatenko self-requested a review July 19, 2024 10:50
Copy link
Contributor

@andriisoldatenko andriisoldatenko left a comment

Choose a reason for hiding this comment

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

works well in my cluster, especially with both EC setups.

@0sewa0 0sewa0 enabled auto-merge (squash) July 19, 2024 11:18
@0sewa0 0sewa0 merged commit 5431a7c into main Jul 19, 2024
19 checks passed
@0sewa0 0sewa0 deleted the refactor/kubeobjects branch July 19, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Changes to core functionality of the Operator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants