Skip to content

Commit

Permalink
clairctl: Add subpath to clairctl
Browse files Browse the repository at this point in the history
Allows clairctl to connect to clair, which is located behind an http-subpath of the ingress

Signed-off-by: Florian Hopfensperger <florian.hopfensperger@de.ibm.com>
  • Loading branch information
fhopfensperger authored and hdonnay committed Feb 15, 2021
1 parent 2e65925 commit 5740a1b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/clairctl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (c *Client) IndexReport(ctx context.Context, id claircore.Digest, m *clairc
req *http.Request
res *http.Response
)
fp, err := c.host.Parse(path.Join(httptransport.IndexReportAPIPath, id.String()))
fp, err := c.host.Parse(path.Join(c.host.RequestURI(), httptransport.IndexReportAPIPath, id.String()))
if err != nil {
debug.Printf("unable to construct index_report url: %v", err)
return err
Expand Down Expand Up @@ -133,7 +133,8 @@ func (c *Client) IndexReport(ctx context.Context, id claircore.Digest, m *clairc
debug.Printf("unable to encode json payload: %v", err)
return err
}
ru, err := c.host.Parse(httptransport.IndexAPIPath)

ru, err := c.host.Parse(path.Join(c.host.RequestURI(), httptransport.IndexAPIPath))
if err != nil {
debug.Printf("unable to construct index_report url: %v", err)
return err
Expand Down Expand Up @@ -184,7 +185,7 @@ func (c *Client) VulnerabilityReport(ctx context.Context, id claircore.Digest) (
req *http.Request
res *http.Response
)
u, err := c.host.Parse(path.Join(httptransport.VulnerabilityReportPath, id.String()))
u, err := c.host.Parse(path.Join(c.host.RequestURI(), httptransport.VulnerabilityReportPath, id.String()))
if err != nil {
debug.Printf("unable to construct vulnerability_report url: %v", err)
return nil, err
Expand Down

0 comments on commit 5740a1b

Please sign in to comment.