Connectors CSI Driver
TOC
OverviewQuick Start1. Create a ConnectorClass2. Create a Connector3. Create a Pod Using the CSI DriverBuilt-in ConfigurationsCSI Volume ParametersMultiple ConnectorsConfiguration MergingConfiguration File RenderingAvailable VariablesBuilt-in FunctionsAbout the Proxy ServiceConfiguration examplesOverview
The Connectors CSI Driver is a storage driver implemented based on the Container Storage Interface (CSI) specification. It can mount configurations from the Connector as volumes into Kubernetes workloads. Key features include:
- Mounting configuration files from the Connector into Pods
- Supporting dynamic variable rendering in configuration files to automatically inject runtime information
- Supporting the simultaneous mounting of multiple configuration files
All configuration data comes from the ConnectorClass configuration associated with the Connector.
Quick Start
1. Create a ConnectorClass
First, create a ConnectorClass that includes Git configuration:
2. Create a Connector
Then, create a Connector that connects to GitHub:
3. Create a Pod Using the CSI Driver
Create a Pod that mounts the configuration:
Verify the mounted files:
Built-in Configurations
The CSI Driver automatically provides built-in configuration files that are always mounted into Pods.
Forward Proxy Usage:
Reverse Proxy Usage:
CSI Volume Parameters
Volume Parameters
Volume Attributes
Examples
Mount a single configuration:
Mount multiple configurations:
Mount multiple connectors for proxy authentication:
Notes:
- If
configuration.namesis omitted, only built-in configurations are mounted - When multiple configurations contain files with the same name, later configurations overwrite earlier ones
- The
connectorsparameter is used to specify multiple connectors for mount config.
Multiple Connectors
The Connectors CSI Driver supports using multiple Connectors for configurations. You can specify multiple Connectors using the connectors volume attribute in the format namespace/name or name; if namespace is omitted, the Pod's namespace is used. Connectors should be separated by commas.
When multiple Connectors are specified, the CSI Driver merges configuration files based on the configuration.names attribute. The merging behavior is detailed in the Configuration Merging section.
There is no strict limit on how many connectors you may list; however, avoid specifying too many Connectors to prevent oversized request headers and other proxy-related issues.
Configuration Merging
When multiple Connectors are specified, the CSI Driver will merge the configuration files from all specified Connectors based on the configuration.names attribute.
There are several possible scenarios for processing configuration files; the cases below describe the behavior in each.
Same Configuration Name
For Connectors with the same configuration name, when multiple Connectors are specified, their configuration data will be merged into a single configuration file.
Configuration templates should support rendering data for multiple Connectors so a single file can incorporate multiple connector-specific data sets.
For example:
in the above example, the configuration file .multi-connector-config will include sections for each Connector specified in the connectors volume attribute.
If the merged connectors come from different ConnectorClasses and have configuration files with the same name, the configuration from the later ConnectorClass will override the configuration from the earlier ConnectorClass. Therefore, it is recommended to use different configuration file names in this scenario to avoid conflicts.
Different Configuration Names
When the specified Connectors have different configuration names, the CSI Driver will mount all configurations separately.
When mounting with both connectors and configuration names:
The mounted volume will contain both config.xml and settings.json, each populated with data from their respective Connectors.
Configuration File Rendering
The CSI Driver performs variable rendering when mounting configuration files, using Go template syntax.
Available Variables
Built-in Functions
Refer to sprig for supported functions
For example: b64enc: Base64 encoding of a string
About the Proxy Service
Connectors provide a proxy service for each Connector, allowing clients to access target resources without needing to store the original credentials. For more details, please refer to connectors-proxy.
Configuration examples
Constant content
Using connector.spec.params
The following ConnectorClass defines a parameter sslVerify to control the SSL verification during git clone.
Using proxy service and token
The following ConnectorClass provides a file named .gitconfig, which automatically injects headers and replaces the git URL during git clone by using the proxy service and token.