ConnectorsProxy
Connectors Proxy is a core capability of the Connectors system that provides secure, secretless access to integrated tools. It typically operates as an HTTP service that can function as either a forward proxy or a reverse proxy for client applications.
When clients access tool resources through Connectors Proxy, the proxy automatically injects the necessary authentication credentials into requests, enabling seamless access without requiring clients to handle credentials directly. This approach delivers a significant security benefit:
- Secretless Access: Eliminates the need to distribute tool credentials directly to clients by using short-lived tokens issued by Kubernetes. This prevents credential exposure in client environments such as logs or environment variables.
To accommodate diverse tool authentication requirements, the platform supports both built-in and custom proxy implementations. Each ConnectorClass can provide its own proxy service, offering flexibility to meet specific tool authentication needs.
TOC
Built-in Connectors ProxyForward ProxyReverse ProxyCustom Connectors ProxyConnector Proxy AddressUse with Connectors CSI DriverDeep Understanding of Connectors ProxySpecifying Proxy in ConnectorClassConnectors Proxy AuthenticationBuilt-in Forward Proxy AuthenticationBuilt-in Reverse Proxy AuthenticationCustom Rego-based AuthenticationInjecting Authentication Credentials into Backend Request when using built-in Reverse ProxyBasic AuthBearer TokenCustom RegoReferencesBuilt-in Connectors Proxy
The built-in ConnectorsProxy implementation provides comprehensive HTTP/HTTPS protocol support with Basic Auth and Bearer Token authentication methods. It offers both forward proxy and reverse proxy capabilities.
Forward Proxy
Operates as a standard HTTP proxy using http_proxy and https_proxy environment variables. When the proxy receives client requests, it:
- Authenticates the client
- Injects tool credentials specified in the Connector into the request if current request path is pointing to the target tool specified by the Connector
- Forwards the authenticated request to the target tool
Connectors Proxy does not support the CONNECT method for HTTP tunneling. Clients must send HTTP requests directly to the proxy server.
Reverse Proxy
Clients access tools by connecting directly to the Connector Proxy Address instead of the original tool URL. The proxy:
- Receives client requests at the proxy endpoint
- Performs client authentication
- Injects tool credentials specified in the Connector and forwards requests to the backend tool
Custom Connectors Proxy
For tools requiring specialized authentication mechanisms, custom proxy implementations can be developed. These proxies can be implemented as either forward or reverse proxies based on specific requirements.
Example: The OCI Connector uses a custom OCI Plugin Proxy that supports OCI protocol with Bearer Token authorization for registries like Harbor and CNCF Distribution Registry..
User can develop a custom proxy server and specified in the connectorclass.
Connector Proxy Address
Each Connector has a unique proxy address for accessing tool resources. The proxy address is stored in the status.proxy.httpAddress field:
Clients use this proxy address to access resources within the tool specified by the Connector.
For more fields about connectorclass, please refer to ConnectorClass
Use with Connectors CSI Driver
Connectors Proxy works seamlessly with the Connectors CSI Driver to provide a complete secretless access solution:
- The Connectors CSI Driver mounts necessary configuration files that contains the proxy address and proxy authentication information
Connectors Proxyhandles authentication injection and request routing to target tool.- Clients can access resources without credential management.
This integration is particularly useful in scenarios like:
- Git clone operations in Kubernetes Jobs
- Image push/pull operations in Tekton Pipelines
- API access in custom workloads
For complete secretless access scenarios using Connectors Proxy and Connectors CSI Driver, see How to use the Git Connector to complete Git clone without storing credentials on the client
Deep Understanding of Connectors Proxy
Specifying Proxy in ConnectorClass
You can specify the proxy server to use in the ConnectorClass:
Connectors created from this ConnectorClass will use connectors-proxy-service as their real proxy server.
Built-in Proxy Configuration:
Custom Proxy Configuration:
Custom proxies can point to any address capable of handling proxy requests.
Connectors Proxy Authentication
When using Connectors Proxy, clients must provide proper authentication credentials to access the proxy. The authentication process requires two key elements:
- Connector Identification: Specify which connector to use for credential injection
- Authorization Token: Provide a ServiceAccount token with read permissions for the target Connector
The proxy server validates the provided ServiceAccount token to ensure it has the necessary permissions for the specified Connector before processing requests and injects the authentication credentials into the request when valid.
For detailed information about ServiceAccount tokens and RBAC configuration, see the Kubernetes Authentication documentation.
Built-in Forward Proxy Authentication
For forward proxy mode, authentication information is passed through the Proxy-Authorization header using HTTP Proxy Basic Authentication.
- Username:
<connector-namespace>/<connector-name> - Password: ServiceAccount token with read permissions for the Connector
Proxy-Authorization Header:
HTTP Proxy Environment Example:
You can configure proxy authentication using standard HTTP proxy environment variables:
Note: The
%2Fis the URL-encoded form of/in the connector namespace/name format.
Built-in Reverse Proxy Authentication
For reverse proxy mode, clients connect directly to the connector's proxy address. The authentication token can be provided using either Basic Auth or Bearer Token methods, while connector identification is handled through the connector proxy address.
Basic Authentication
- Username: Any value (ignored)
- Password: ServiceAccount token with read permissions for the Connector
Example:
Bearer Token Authentication
- Authorization Header:
Bearer <service-account-token>
Example:
Custom Rego-based Authentication
When using the built-in HTTP reverse proxy with tools that use non-standard authentication methods, clients may be unable to provide tokens using standard Basic Auth or Bearer Token methods. Instead, they must use the tool's original credential format.
To support these custom authentication formats, you can use Rego rules to customize token extraction from client requests. This allows the built-in HTTP reverse proxy to extract and validate tokens regardless of how they are provided by the client.
For example:
This configuration extracts the token from the Private-Token header in client requests, which the proxy then uses to validate client authentication.
This approach provides significant flexibility for non-standard HTTP authentication mechanisms. Client CLIs can provide Kubernetes tokens using the tool's original credential format, and the proxy extracts the token through Rego rules to complete authentication validation.
For more detailed configuration on using Rego rules to extract tokens, see ConnectorClass.
For more about injecting authentication credentials into backend request, see Injecting Authentication Credentials into Backend Request when using built-in Reverse Proxy.
Connector Identification
The connector can be identified through different proxy address formats:
- Service Format: e.g.
http://c-<connector-name>.<namespace>.svc.cluster.local - Path Format:
http://<proxy-address>/namespaces/<connector-namespace>/connectors/<connector-name>
The connector proxy address is automatically generated by the system and is unique for each connector. You must retrieve the connector proxy address from the status.proxy.httpAddress field of the connector resource before using it.
Example:
For a github connector in the default namespace:
The proxy will validate the authentication token and automatically inject the default/github connector's authentication credentials when forwarding requests to GitHub services.
Injecting Authentication Credentials into Backend Request when using built-in Reverse Proxy
After the built-in reverse proxy validates the client request, it injects authentication credentials into the backend request based on the credential type configured in the Connector. The following injection methods are supported:
- Basic Auth
- Bearer Token
- Custom Rego
Basic Auth
When a Connector is configured with the secret type kubernetes.io/basic-auth, the proxy injects the credentials into the backend request headers using Basic Authentication.
Bearer Token
When a Connector is configured with the secret type connectors.cpaas.io/bearer-token, the proxy injects the credentials into the backend request headers using Bearer Token authentication.
Custom Rego
In addition to the standard Basic Auth and Bearer Token methods, you can use Rego rules to define custom authentication injection logic. For example:
This configuration injects the token value from the connector's secret data into the Private-Token header of backend requests.
For more detailed configuration, see ConnectorClass.
When using custom Rego authentication, you typically need to configure spec.proxy.authExtractor to extract tokens from client requests, enabling the built-in HTTP reverse proxy to validate client authentication.
Simultaneously, use spec.auth.types[].generator.rego to inject authentication credentials into backend requests.
This combination enables support for custom authentication mechanisms when using the built-in HTTP reverse proxy.