-
Notifications
You must be signed in to change notification settings - Fork 18
NETOBSERV-1905 Query UDNs without flows #688
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
base: main
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
@jotak & @msherif1234 any thoughts about the approach ? That approach could be useful for other scenarios such as Nodes / Namespaces especially since we are introducing capture filters. The UI could show we don't capture everything in these cases |
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"k8s.io/client-go/dynamic" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relying on dynamic
client here allows us to read the CRDs without importing the whole API.
pkg/handler/k8s.go
Outdated
cudns, err := resources.List(ctx, token, schema.GroupVersionResource{ | ||
Group: "k8s.ovn.org", | ||
Version: "v1", | ||
Resource: "clusteruserdefinednetworks", | ||
}) | ||
if err != nil { | ||
writeError(w, http.StatusInternalServerError, err.Error()) | ||
} | ||
|
||
udns, err := resources.List(ctx, token, schema.GroupVersionResource{ | ||
Group: "k8s.ovn.org", | ||
Version: "v1", | ||
Resource: "userdefinednetworks", | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only need to maintain the version per group / resource
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #688 +/- ##
==========================================
+ Coverage 56.62% 58.99% +2.36%
==========================================
Files 197 159 -38
Lines 10210 6974 -3236
Branches 1196 1199 +3
==========================================
- Hits 5781 4114 -1667
+ Misses 4059 2658 -1401
+ Partials 370 202 -168
Flags with carried forward coverage won't be shown. Click here to find out more.
|
values := []string{} | ||
for _, cudn := range cudns { | ||
md := cudn.Object["metadata"].(map[string]interface{}) | ||
values = append(values, fmt.Sprintf("%s", md["name"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
values = append(values, fmt.Sprintf("%s", md["name"])) | |
values = append(values, md["name"]) |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I commited this but I will revert it as the metadata
can contains other things than strings such as boolean
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
pkg/handler/k8s.go
Outdated
Resource: "clusteruserdefinednetworks", | ||
}) | ||
if err != nil { | ||
writeError(w, http.StatusInternalServerError, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense I think to propagate the k8s error code, such as 401/403 ?
I never tried that but I guess it should work:
kerr "k8s.io/apimachinery/pkg/api/errors"
//...
if err != nil {
var k8sErr *kerr.StatusError
if errors.As(err, &k8sErr) {
writeError(w, int(k8sErr.ErrStatus.Code), err.Error())
} else {
writeError(w, http.StatusInternalServerError, err.Error())
}
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 96a8ce4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/ok-to-test |
New image: It will expire after two weeks. To deploy this build, run from the operator repo, assuming the operator is running: USER=netobserv VERSION=9b2cd3a make set-plugin-image |
@jpinsonneau: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Dependencies
n/a
Checklist
If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.