Documentation ¶
Index ¶
- Constants
- func GetProxyType(reqURI string) int
- func GetServiceProxyURL(cluster, namespace, service string) string
- func GetTargetServiceURLFromRequest(req *http.Request) (*url.URL, error)
- func ServeHealthProbes(healthProbeBindAddress string, customChecks ...healthz.Checker) error
- func UpdateRequest(t TargetServiceConfig, req *http.Request) *http.Request
- type TargetServiceConfig
Constants ¶
const ( HEADERSERVICECA = "Service-Root-Ca" HEADERSERVICECERT = "Service-Client-Cert" HEADERSERVICEKEY = "Service-Client-Key" )
const ( ProxyTypeService = iota ProxyTypeKubeAPIServer )
Variables ¶
This section is empty.
Functions ¶
func GetProxyType ¶
GetProxyType determines whether a request meant to proxy to a regular service or the kube-apiserver of the managed cluster. An example of service: https://<route location cluster-proxy>/<managed_cluster_name>/api/v1/namespaces/<namespace_name>/services/<[https:]service_name[:port_name]>/proxy-service/<service_path> An example of kube-apiserver: https://<route location cluster-proxy>/<managed_cluster_name>/api/pods?timeout=32s
func GetServiceProxyURL ¶
func GetTargetServiceURLFromRequest ¶
GetTargetServiceURLFromRequest is used on the agent side, the service-proxy agent recived a request from the proxy-agent, and need to know the target service URL to do further proxy.
func ServeHealthProbes ¶
ServeHealthProbes serves health probes and configchecker.
func UpdateRequest ¶
func UpdateRequest(t TargetServiceConfig, req *http.Request) *http.Request
Types ¶
type TargetServiceConfig ¶
type TargetServiceConfig struct { Cluster string Proto string Service string Namespace string Port string Path string }
TargetServiceConfig is a collection of data extrict from the request URL description the target service we can to access on the managed cluster. There are 2 usages of it: 1. used in function `ServiceProxyURL` to construct the target service URL. 2. used in function `UpdateRequest` to update the request object.
func GetTargetServiceConfig ¶
func GetTargetServiceConfig(requestURL string) (ts TargetServiceConfig, err error)
GetTargetServiceConfig extrict the target service config from requestURL input: https://<route location cluster-proxy>/cluster1/api/v1/namespaces/default/services/<https:helloworld:8080>/proxy-service/ping?time-out=32s output: TargetServiceConfig{Cluster: cluster1, Proto: https, Service: helloworld, Namespace: default, Port: 8080, Path: /ping}
func GetTargetServiceConfigForKubeAPIServer ¶
func GetTargetServiceConfigForKubeAPIServer(requestURL string) (ts TargetServiceConfig, err error)
GetTargetServiceConfigForKubeAPIServer extrict the kube apiserver config from requestURL input: https://<route location cluster-proxy>/cluster1/api/pods?timeout=32s output: TargetServiceConfig{Cluster: cluster1, Proto: https, Service: kubernetes, Namespace: default, Port: 443, Path: api/pods}