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

Enhancement: Using Discovery API to discover Kubernetes Resources #284

Conversation

KiptoonKipkurui
Copy link
Member

Description
To discover all resources in a cluster, this PR uses the Discovery API to list all resources and avoid hardcoding the resources to track and also supports using both whitelist and blacklisted resources in watch-list ConfigMap
This PR fixes #274

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

@KiptoonKipkurui KiptoonKipkurui changed the title Feat/kiptoonkipkurui/default resources Enhancement: Using Discovery API to determine resources Dec 13, 2023
@KiptoonKipkurui KiptoonKipkurui changed the title Enhancement: Using Discovery API to determine resources Enhancement: Using Discovery API to discover Kubernetes Resources Dec 13, 2023
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Attention: Patch coverage is 80.32787% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 11.95%. Comparing base (a8e2fb7) to head (927e036).
Report is 29 commits behind head on master.

Files Patch % Lines
internal/config/default_config.go 77.55% 7 Missing and 4 partials ⚠️
internal/config/crd_config.go 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
+ Coverage    9.37%   11.95%   +2.58%     
==========================================
  Files          10       11       +1     
  Lines         651      669      +18     
==========================================
+ Hits           61       80      +19     
+ Misses        583      582       -1     
  Partials        7        7              
Flag Coverage Δ
unittests 11.95% <80.32%> (+2.58%) ⬆️

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.

@leecalcote leecalcote added component/meshsync MeshSync related kind/feature New major feature or request labels Dec 13, 2023
@leecalcote
Copy link
Member

This might be an ideal time for a set of standard tests to be run. What sort of CI coverage do we have currently? Only compilation of golang, but no functional or integration tests, right?

Time to invest in one, I suggest. We already have a number of them that can be reused from meshery/meshery....

@KiptoonKipkurui
Copy link
Member Author

This might be an ideal time for a set of standard tests to be run. What sort of CI coverage do we have currently? Only compilation of golang, but no functional or integration tests, right?

Time to invest in one, I suggest. We already have a number of them that can be reused from meshery/meshery....

There are many of them, I shall have fun reusing some of them here

@leecalcote
Copy link
Member

@VihasMakwana, your 👀s on this would be great.

Copy link
Member

@VihasMakwana VihasMakwana left a comment

Choose a reason for hiding this comment

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

LGTM overall. a couple of nits.
Great step towards the discovery!

Copy link

stale bot commented Feb 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue/stale Issue has not had any activity for an extended period of time label Feb 13, 2024
@leecalcote
Copy link
Member

merge conflicts, @KiptoonKipkurui

@stale stale bot removed the issue/stale Issue has not had any activity for an extended period of time label Feb 13, 2024
@KiptoonKipkurui
Copy link
Member Author

@leecalcote @VihasMakwana @MUzairS15 I have resolved all conflicts and reviews

@@ -134,5 +40,66 @@ var (
},
}

DefaultEvents = []string{"ADD", "UPDATE", "DELETE"}
DefaultEvents = []string{"ADD", "UPDATE", "DELETE"}
ExemptedResources = []string{"selfsubjectrulesreviews", "localsubjectaccessreviews", "bindings", "selfsubjectaccessreviews", "subjectaccessreviews", "tokenreviews", "componentstatuses", "flowschemas", "prioritylevelconfigurations"}

Choose a reason for hiding this comment

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

A perfect example of the use of deny selector in the CR config.


for _, group := range groupList {
for _, resource := range group.APIResources {
if strings.Contains(resource.Name, "/") {

Choose a reason for hiding this comment

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

What is this for?
Does this mean resources under apps/v1 , networking.k8s.io/v1 ... not to be watched for changes inside the cluster?

t.Error("local resources not discovered, expected 1")
}

idx := slices.IndexFunc(Pipelines["global"], func(c PipelineConfig) bool { return c.Name == "namespaces.v1." })

Choose a reason for hiding this comment

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

Is there any specific reason for treating namespace special? Is it just because all other namespaced resources are in the local config and non-namespaced resources are in the global config?

Choose a reason for hiding this comment

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

I see it's the test file, but even then adding a comment will help.

Copy link

stale bot commented May 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue/stale Issue has not had any activity for an extended period of time label May 1, 2024
Copy link

stale bot commented May 12, 2024

This issue is being automatically closed due to inactivity. However, you may choose to reopen this issue.

@stale stale bot closed this May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/meshsync MeshSync related issue/stale Issue has not had any activity for an extended period of time kind/feature New major feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DevOps] Enhance MeshSync Discovery All Resources
4 participants