@containercraft/projen-pulumi-crd-sdks
v0.0.27
Published
Projen project type to generate Pulumi SDKs for Kubernetes CRDs
Downloads
205
Readme
Projen.io project type for generating Pulumi SDKs of Kubernetes CRDs
Projen is a multi-language tool to automate the setup of a new project. It provides a consistent and opinionated way to bootstrap projects, manage dependencies, and enforce best practices across different programming languages and frameworks.
This project is specifically designed to generate Pulumi SDKs for Kubernetes Custom Resource Definitions (CRDs), allowing developers to easily integrate custom resources into their Pulumi-based infrastructure as code projects.
It is part 1 of a 3-part setup comprised of:
- ContainerCraft/projen-pulumi-crd-sdks - A Projen project type that manages projects handling Pulumi SDKs for Kubernetes Custom Resources. (this repository)
- ContainerCraft/git-tag-replay - A Github Action that replays Git tags from an upstream repository to a downstream repository.
- ContainerCraft/updatecli-policies - A repository
containing Updatecli policies to update dependencies when new versions are
detected by
git-tag-replay.
Usage
If you have a Kubernetes operator containing CRDs that you want to integrate into Pulumi, you can use this project type to generate the Pulumi SDKs for your CRDs. The generated SDKs provide a convenient way to interact with your custom resources from within your Pulumi code, enabling seamless integration and management of your Kubernetes resources as part of your infrastructure as code workflow.
Bootstrapping a new project
Due to an upstream projen issue, it is not
possible yet to perform the initialization in a single step. You will need to perform the
following steps:
- Create a new directory for your project and navigate into it.
- Run
npx projen new --from @containercraft/projen-pulumi-crd-sdks --synth=false --no-git. - Now paste the following template over your
.projenrc.jsonfile:
Note: The Python package name must be written with underscores instead of hyphens.{ "type": "@containercraft/projen-pulumi-crd-sdks.PulumiCrdSdksProject", "name": "<your-project-name>", "latestVersionOnBranch": "1.0.0", "localProject": { "owner": "<github-user-or-org>", "repository": "<github-repository>" }, "upstreamProject": { "owner": "<github-user-or-org>", "repository": "<github-repository>" }, "crdUrls": [ "https://raw.githubusercontent.com/<github-user-or-org>/<github-repository>/${VERSION}/<path>/<crd-schema-file>.yaml" ], "nodePackage": { "name": "<your-npm-package-name>", "namespace": "<your-npm-namespace-optional>" }, "pythonPackage": { "name": "<your_python_package_name>", "prefix": "<your_python_package_prefix_optional>" }, "goPackage": "github.com/<github-user-or-org>/<github-repository>/sdk/go/v<version>", "dotnetPackage": { "name": "<your-dotnet-package-name>", "namespace": "<your-dotnet-namespace-optional>" }, "javaPackage": { "name": "<your-java-package-name>", "basePackage": "<your-java-base-package-optional>" } } - Replace the placeholders in the template with the appropriate values.
- Create the file
.projen/tasks.jsonwith the following content:{ "tasks": { "default": { "name": "default", "description": "Synthesize project files", "env": { "FILENAME": ".projenrc.json" }, "steps": [ { "builtin": "run-projenrc-json" } ] } }, "//": "~~ Generated by projen. To modify, edit .projenrc.json and run \"npx projen\"." } - Run
npx projento generate the required build and release workflows. - Once the project is initialized, you can start using the generated SDKs in your Pulumi code.
