Using Harbor Connector Forward Proxy in Tekton Task
Using Harbor Connector Forward Proxy in Tekton Tasks enables centralized management of Harbor credentials and secure access to Harbor registries during Tekton Task execution.
TOC
Requirements for Tekton TaskUsage InstructionsUsing Forward Proxy with .env WorkspaceUsing Forward Proxy with Custom CommandsFurther ReadingRequirements for Tekton Task
Not all Tekton Tasks can use Harbor Connector Forward Proxy.
Harbor Connector injects proxy configurations through a CSI Driver. It provides built-in configuration files for forward proxy usage:
.env: Environment variables file containinghttp_proxy,https_proxy, andno_proxyinkey=valueformathttp.proxy: Forward proxy URL with authentication for HTTPhttps.proxy: Forward proxy URL with authentication for HTTPS
Therefore, Tekton Tasks must meet the following requirements to use Harbor Connector Forward Proxy:
1. The CLI tools used in the Task must support HTTP proxy environment variables
2. The Task must support configuring HTTP proxy environment variables.
This can be done by:
- Mounting a workspace containing a
.envfile- Using custom commands to read environment variables from files
3. The Task must support configuring insecure registries
This can be done by:
- Mounting a workspace containing a configuration file that supports insecure registries that connectorclass provides
- Using cli arguments to configure insecure registries
Usage Instructions
Using Forward Proxy with .env Workspace
If the Task natively supports a workspace containing a .env file, and will expose the .env file to the environment variable, you can directly mount the Harbor Connector's configurations via CSI.
In the following example, we use a buildah Task that accepts a docker-config workspace with a .env file containing http_proxy, https_proxy, and no_proxy environment variables:
Using Forward Proxy with Custom Commands
If the Task does not natively support a .env workspace, but allows custom commands, you can source the .env file manually in the command.
In the following example, we use a buildah-cli Task that accepts a cmd parameter for custom shell commands. The Task mounts the docker-config workspace to /workspace/docker-config:
Note: The --tls-verify=false flag is required because the forward proxy intercepts and re-signs TLS traffic. Different CLI tools have different ways to configure insecure registries. Please refer to your CLI documentation for details.
Further Reading
- Using Harbor Connector Proxy in K8S Workload - Learn about the general logic of using Harbor Connector proxy
- Harbor ConnectorClass Forward Proxy - Learn about forward proxy configurations
- Connectors CSI Built-in Configurations - Learn about built-in configuration files
- Using CSI Volumes in Tekton - Tekton CSI workspace documentation