packaged by Chainguard
Contact our team to test out this image for free. Please also indicate any other images you would like to evaluate.
This composition function runs Python scripts written inline in a Crossplane Composition or Operation to compose resources and perform operational tasks.
Chainguard Containers are regularly-updated, secure-by-default container images.
For those with access, this container image is available on cgr.dev:
Be sure to replace the ORGANIZATION placeholder with the name used for your organization's private repository within the Chainguard Registry.
The Chainguard crossplane-function-python container image is a drop-in replacement for the upstream function-python Crossplane package published at xpkg.upbound.io/crossplane-contrib/function-python.
The image ships the function together with the Crossplane package metadata and the Script CRD in /package.yaml, so you can reference it directly in a Function resource.
Like the upstream image, it installs the function into a virtual environment at /venv/fn and uses /venv/fn/bin/function as the entrypoint, so a DeploymentRuntimeConfig that overrides the container command keeps working.
The image differs from upstream in the following ways:
gcr.io/distroless/python3-debian13, which removes the operating system packages that account for most of the upstream image's vulnerabilities.pyproject.toml supports a range of minor releases that includes it, and upstream runs lint and its unit tests on the newer one, so scripts run on an interpreter upstream tests against.grpcio is the PyPI wheel, as upstream ships it, which statically vendors its own copy of BoringSSL. The version is the same one upstream resolves.pip is not kept in the virtual environment. The environment is managed by the package manager, and the function does not install anything at runtime.ExposedPorts. The gRPC server still listens on port 9443 by default, and Crossplane names that port on the runtime container itself.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH to the system CA bundle, which upstream does not. Without it, a gRPC client created inside a script would trust grpcio's bundled roots.pem rather than the image's trust store.You need a Kubernetes cluster with Crossplane v2.0 or later installed. If Crossplane is not installed yet, install it with Helm:
Crossplane's package manager pulls the package itself, so it needs credentials for your private repository in the namespace Crossplane runs in. Create a pull token, export its username and password as CGR_USERNAME and CGR_PASSWORD, then run:
Create a Function resource that points at the Chainguard image:
Wait for Crossplane to install the function and report it as healthy:
Composition steps pass Python code to the function through a Script input.
The script defines a compose function that receives the RunFunctionRequest and a pre-populated RunFunctionResponse, and modifies the response.
Writing to the desired composite resource is a convenient way to surface computed values in the composite resource's status.
Define the XGreeting composite resource type the script computes a status for:
The following Composition computes the three status fields:
Create a composite resource and the function fills in its status:
Scripts have access to the function-sdk-python package as crossplane.function and to the full Python standard library.
This image also ships aioboto3, which upstream includes so that scripts can call AWS APIs.
Defining the function as async def compose lets the function serve other requests while the script waits on network calls.
Operations are an alpha feature, so Crossplane must run with --enable-operations (chart value args: ["--enable-operations"]). A script that defines an operate function instead of compose runs as part of a Crossplane Operation:
A script must define exactly one of compose or operate; the function reports anything else as a fatal result.
By default the function serves gRPC over mTLS on port 9443 and reads its certificates from the directory named by TLS_SERVER_CERTS_DIR, which Crossplane sets and populates.
Run it with --insecure only for local development.
Chainguard's free tier of Starter container images are built with Wolfi, our minimal Linux undistro.
All other Chainguard Containers are built with Chainguard OS, Chainguard's minimal Linux operating system designed to produce container images that meet the requirements of a more secure software supply chain.
The main features of Chainguard Containers include:
For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a development, or -dev, variant.
In all other cases, including Chainguard Containers tagged as :latest or with a specific version number, the container images include only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager.
Although the -dev container image variants have similar security features as their more minimal versions, they include additional software that is typically not necessary in production environments. We recommend using multi-stage builds to copy artifacts from the -dev variant into a more minimal production image.
To improve security, Chainguard Containers include only essential dependencies. Need more packages? Chainguard customers can use Custom Assembly to add packages, either through the Console, chainctl, or API.
To use Custom Assembly in the Chainguard Console: navigate to the image you'd like to customize in your Organization's list of images, and click on the Customize image button at the top of the page.
Refer to our Chainguard Containers documentation on Chainguard Academy. Chainguard also offers VMs and Libraries — contact us for access.
This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.
Chainguard's container images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" tag of this image:
For a complete list of licenses, please refer to this Image's SBOM.
Software license agreementChainguard Containers are SLSA Level 3 compliant with detailed metadata and documentation about how it was built. We generate build provenance and a Software Bill of Materials (SBOM) for each release, with complete visibility into the software supply chain.
SLSA compliance at ChainguardThis image helps reduce time and effort in establishing PCI DSS 4.0 compliance with low-to-no CVEs.
PCI DSS at Chainguard