Skip to content

Commit

Permalink
cmd/kube-rbac-proxy/app: add comments to explain the attached Request…
Browse files Browse the repository at this point in the history
…Info and different listeners/ports used
  • Loading branch information
liouk committed Jun 1, 2023
1 parent b410b96 commit c681496
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/kube-rbac-proxy/app/kube-rbac-proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func Run(cfg *server.KubeRBACProxyConfig) error {
handler := identityheaders.WithAuthHeaders(proxy, cfg.KubeRBACProxyInfo.UpstreamHeaders)
handler = kubefilters.WithAuthorization(handler, authz, scheme.Codecs)
handler = kubefilters.WithAuthentication(handler, authenticator, http.HandlerFunc(filters.UnauthorizedHandler), cfg.DelegatingAuthentication.APIAudiences)
// passing an empty RequestInfoFactory results in attaching a non-resource RequestInfo to the context
handler = kubefilters.WithRequestInfo(handler, &request.RequestInfoFactory{})
handler = rewrite.WithKubeRBACProxyParamsHandler(handler, cfg.KubeRBACProxyInfo.Authorization.RewriteAttributesConfig)

Expand All @@ -210,9 +211,12 @@ func Run(cfg *server.KubeRBACProxyConfig) error {

gr := &run.Group{}
{
// listener for proxying HTTPS with authentication and authorization (on port --secure-port)
gr.Add(secureServerRunner(ctx, cfg.SecureServing, mux))

if cfg.KubeRBACProxyInfo.ProxyEndpointsSecureServing != nil {
// we need a second listener in order to serve proxy-specific endpoints
// on a different port (--proxy-endpoints-port)
proxyEndpointsMux := http.NewServeMux()
proxyEndpointsMux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte("ok")) })

Expand Down

0 comments on commit c681496

Please sign in to comment.