The PyPI connector is a platform-agnostic connector that you can use to connect to any PyPI registry.
You can use the PyPI Connector to securely perform PyPI operations in CICD pipelines, or use it in kubernetes workloads to perform PyPI operations without credentials.
Additionally, you can centralize the management of PyPI access configurations across namespaces, avoiding the need to repeat the PyPI credentials in each namespace.
This document covers:
PyPI Registries Prerequisites
Here's how to create a basic PyPI Connector:
spec.connectorClassName:
pypi (constant), specifies the ConnectorClass name for PyPI integration.
spec.address:
Target PyPI registry address, for example: https://pypi.org.
spec.auth(optional):
specifies the authentication method of the PyPI registry
spec.auth.name: should be basicAuth for PyPI connector.
spec.auth.secretRef: specifies the secret that contains the authentication information of the PyPI registry, the secret should be created in the same namespace as the connector. If your PyPI registry does not require authentication, you can omit this field.
Optional Metadata fields:
cpaas.io/description: Description information for the PyPI connector, for example:
The PyPI connector supports the following authentication types:
basicAuth: Username and password-based authentication, corresponding secret type: kubernetes.io/basic-authFor example:
If the secret is not correct, the status.conditions field in the PyPI connector will show the error message.
For comprehensive status information, see Connector Status Documentation.
If the PyPI registry does not require authentication, you can omit the secretRef field:
The required permissions for the configured credential depend on how you intend to use it in your Pods/Pipelines.
For example:
pip install, the credentials only require read permissions for the target PyPI registry.twine upload or similar tools, the credentials must have both read and write permissions for the target registry.For security best practices, we recommend creating credentials with minimal required permissions. When additional privileges are needed, create separate Connectors with more privileged secret and use namespace isolation to control which users can access each Connector.
To provide clients with the ability to access PyPI registry without credentials, the PyPI connector provides a proxy server to automatically inject authentication information.
Clients can use this proxy server to access PyPI registry without needing to configure credentials on the client side.
To simplify usage, the PyPI connectorclass provides pip.conf and .pypirc files that can be mounted into Pods via CSI. In the Pod, when executing PyPI operations, the proxy service can be automatically inject authentication information.
Upon Connector creation, the system automatically provisions a proxy service for the target PyPI registry.
The proxy endpoint is recorded in status.proxy.httpAddress:
For example:
The PyPI connector provides the following configuration:
pip.conf:
pip.conf configuration file. Combined with the connector-csi-driver, this configuration file will be mounted into the Pod, allowing access to the PyPI registry through the proxy without needing to configure credentials on the client side.Example of the configuration file generated in the Pod:
Provides a .pypirc configuration file. Combined with the connector-csi-driver, this configuration file will be mounted into the Pod, allowing access to the PyPI registry through the proxy without needing to configure credentials on the client side.
For detailed proxy mechanics, see How It Works in the Quick Start guide.
The PyPI connector provides a pip.conf and .pypirc file that can be mounted into the Pod via Connector CSI Driver.
For example:
parameter descriptions:
csi.readOnly: Fixed value truecsi.driver: The Connector CSI Driver, fixed as connectors-csi.csi.volumeAttributes: CSI Volume attributes
connector.name: Name of the PyPI Connectorconnector.namespace: Namespace of the PyPI Connector; if not specified, the Pod's namespace is usedconfiguration.names: Configuration name, provide by the PyPI Connector. As above, pipconf and pypirc are supported.For detailed information about how to use the pip.conf and .pypirc file in the Pod by connectors-csi-driver, please refer to Using PyPI Connectors in kubernetes jobs