i see the code
https://github.com/tektoncd/dashboard/blob/8b1f04a48fcb116352a17afa84ca9fc9efd8bcd5/pkg/utils/proxy.go#L10
it is just http client methed and how to handle x509: certificate?
thks
The Dashboard uses k8s.io/client-go/rest as the REST client with InClusterConfig by default. This is a recommended approach for accessing the API server from a pod.
Here's an example showing the approach from the kubernetes/client-go repo: https://github.com/kubernetes/client-go/blob/60a0346672170c8e9f65795fb33e41527980c583/examples/in-cluster-client-configuration/main.go
More details from the Kubernetes documentation: https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod
think a lot !
i see the code
1 init httpclient transport
https://github.com/tektoncd/dashboard/blob/abbd6c1cd29b3d08c515c813c8db2be5db360a4f/cmd/dashboard/main.go#L124
// TransportFor returns an http.RoundTripper that will provide the authentication
// or transport level security defined by the provided Config. Will return the
// default http.DefaultTransport if no special case behavior is needed.
func TransportFor(config *Config) (http.RoundTripper, error) {
cfg, err := config.TransportConfig()
if err != nil {
return nil, err
}
return transport.New(cfg)
}
2 init endpoints.Resource.HttpClient
https://github.com/tektoncd/dashboard/blob/abbd6c1cd29b3d08c515c813c8db2be5db360a4f/cmd/dashboard/main.go#L143
3 proxy reqest by Resource.HttpClient
https://github.com/tektoncd/dashboard/blob/abbd6c1cd29b3d08c515c813c8db2be5db360a4f/pkg/endpoints/cluster.go#L69
Most helpful comment
The Dashboard uses
k8s.io/client-go/restas the REST client withInClusterConfigby default. This is a recommended approach for accessing the API server from a pod.https://github.com/tektoncd/dashboard/blob/abbd6c1cd29b3d08c515c813c8db2be5db360a4f/cmd/dashboard/main.go#L124
Here's an example showing the approach from the kubernetes/client-go repo: https://github.com/kubernetes/client-go/blob/60a0346672170c8e9f65795fb33e41527980c583/examples/in-cluster-client-configuration/main.go
More details from the Kubernetes documentation: https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod