Description
Hi All,
I am trying out a few things in the sample-apiserver app and added a few custom paths "/v3/hello" to serve static content, say a webpage, for my learning purposes. I was expecting the path to be present while doing a curl to the "/" path, but it is not present in the returned list.
I searched the internet and found a project, Antrea, which uses this, but couldn't make it work. I referred to https://github.com/antrea-io/antrea/blob/f707fa976cd4b3110bcd64bbf6eaf64f05c557f4/pkg/apiserver/apiserver.go#L296, which has a similar implementation.
I tried using the client below, but I got an error the server could not find the requested resource
.
restClient, err := rest.UnversionedRESTClientFor(config)
if err != nil {
panic(fmt.Errorf("failed to create rest client: %w", err))
}
u := url.URL{Path: "/v3/hello"}
getter := restClient.Get().RequestURI(u.RequestURI()).Timeout(10*time.Second)
result, err := getter.DoRaw(context.TODO())
if err != nil {
panic(err)
}
fmt.Println(string(result))
The Aggregated API documentation does not seem to cover this topic, or I couldn't find it anywhere.