-
Notifications
You must be signed in to change notification settings - Fork 27
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
Generate and use client to make api calls towards resource server #352
base: main
Are you sure you want to change the base?
Conversation
mlguerrero12
commented
Nov 27, 2024
- Add missing Model property to ResourceType
- Generate client from resource server api spec
- Move k8s client to commons
[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 |
@pixelsoccupied @alegacy, PTAL |
internal/service/alarms/internal/resourceserver/resourceserver.go
Outdated
Show resolved
Hide resolved
internal/service/alarms/internal/resourceserver/resourceserver.go
Outdated
Show resolved
Hide resolved
internal/service/alarms/internal/resourceserver/resourceserver.go
Outdated
Show resolved
Hide resolved
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.
good stuff! alarms + resource server connectivity incoming!
Signed-off-by: Marcelo Guerrero <[email protected]>
de743ab
to
be3066f
Compare
It generates the client of the Resource Server API and uses it to get the resourceType list Signed-off-by: Marcelo Guerrero <[email protected]>
The k8s client can be used by different servers Signed-off-by: Marcelo Guerrero <[email protected]>
This add nonResourceURLs permissions to get and list /o2ims-infrastructureInventory/v1/resourceTypes endpoint Signed-off-by: Marcelo Guerrero <[email protected]>
It includes changes due to communication with the resource server Signed-off-by: Marcelo Guerrero <[email protected]>
be3066f
to
fd59505
Compare
addressed comments, PTAL again @alegacy, @pixelsoccupied |
@mlguerrero12: 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. |
// Set up transport | ||
tr := &http.Transport{ | ||
TLSClientConfig: &tls.Config{ | ||
MinVersion: tls.VersionTLS12, | ||
// #nosec G402: InsecureSkipVerify set true. | ||
InsecureSkipVerify: utils.GetTLSSkipVerify(), | ||
}, | ||
} | ||
|
||
if !tr.TLSClientConfig.InsecureSkipVerify { | ||
tr.TLSClientConfig.RootCAs = x509.NewCertPool() | ||
data, err := os.ReadFile(utils.DefaultServiceCAFile) | ||
if err != nil { | ||
// Should never happen | ||
return nil, fmt.Errorf("failed to read CA file: %w", err) | ||
} | ||
|
||
tr.TLSClientConfig.RootCAs.AppendCertsFromPEM(data) | ||
} | ||
|
||
hc := http.Client{Transport: tr} |
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 have a utility to do this. See GetDefaultTLSConfig
in utils
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.
or GetDefaultBackendTransport
depending on what you need
|
||
tokenPath := utils.DefaultBackendTokenFile | ||
|
||
// Use for local development |
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.
Now that we have a way to deploy the server in-cluster should not be relying so much on these local hacks.