Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ env:

# The OCI/Docker Repository to push our images to.
# By Default this points to Github Package Registry.
# XPKG_REPO: ghcr.io/${{ github.repository_owner }}
XPKG_REPO: ghcr.io/${{ github.repository_owner }}

# The example template pushes to Upbound Marketplace
XPKG_REPO: xpkg.upbound.io/${{ github.repository_owner }}
#XPKG_REPO: xpkg.upbound.io/${{ github.repository_owner }}

# Names for the Configuration and corresponding Function Packages
XPKG_NAME: ${{ github.event.repository.name }}
Expand Down
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Crossplane Function Template - TypeScript <!-- omit in toc -->

This repository is a template for building Crossplane composition functions in TypeScript using the [@crossplane-org/function-sdk-typescript](https://github.com/upbound/function-sdk-typescript).
This repository is a template for building Crossplane composition functions in TypeScript using the [@crossplane-org/function-sdk-typescript](https://github.com/crossplane/function-sdk-typescript).

- [Overview](#overview)
- [Quick Start](#quick-start)
- [Running the Example Package](#running-the-example-package)
- [Installing the Package](#installing-the-package)
- [Deploy the Example Manifest](#deploy-the-example-manifest)
Expand Down Expand Up @@ -55,6 +56,15 @@ create any type of Kubernetes resource.

For an example of configuring cloud resources, refer to [configuration-aws-network-ts](https://github.com/upbound/configuration-aws-network-ts).

## Quick Start

1. Clone this repository
2. Update [package.json](package.json) for your Project.
3. Update the code at [src/function.ts](src/function.ts)
4. Create your API (`CompositeResourceDefinition`) like the one for `App` in [package-configuration/apis/apps/definition.yaml](package-configuration/apis/apps/definition.yaml)
5. Create an example in the `examples` directory like [examples/apps/example.yaml](examples/apps/example.yaml)
6. Build, locally-run and `crossplane render` your Composition. See the [Development](#development) section.

## Running the Example Package

The configuration and function are published to the [Upbound Marketplace](https://marketplace.upbound.io),
Expand All @@ -71,7 +81,7 @@ kind: Configuration
metadata:
name: configuration-template-typescript
spec:
package: xpkg.upbound.io/function-template-typescript:v0.1.0
package: xpkg.upbound.io/crossplane/function-template-typescript:v0.1.0
```

Once installed, confirm that the package and dependencies are installed:
Expand All @@ -84,8 +94,8 @@ Configuration/configuration-template-typescript
├─ ConfigurationRevision/configuration-template-typescript-93b73b00eb21 v0.1.0 - - Active
├─ Function/crossplane-contrib-function-auto-ready v0.6.0 True True - HealthyPackageRevision
│ └─ FunctionRevision/crossplane-contrib-function-auto-ready-59868730b9a9 v0.6.0 - - Active
└─ Function/upbound-function-template-typescript-function v0.1.0 True True - HealthyPackageRevision
└─ FunctionRevision/upbound-function-template-typescript-function-cd83fe939bc7 v0.1.0 -
└─ Function/crossplane-function-template-typescript-function v0.1.0 True True - HealthyPackageRevision
└─ FunctionRevision/crossplane-function-template-typescript-function-cd83fe939bc7 v0.1.0 -
```

### Deploy the Example Manifest
Expand Down Expand Up @@ -261,7 +271,7 @@ node dist/main.js --insecure --debug
Once the function is running locally, `crossplane render` can be used to render examples:

```shell
crossplane render examples/app/example.yaml package-configuration/apis/apps/composition.yaml examples/functions.yaml
crossplane render examples/apps/example.yaml package-configuration/apis/apps/composition.yaml examples/functions.yaml
```

### Available CLI Options
Expand Down Expand Up @@ -392,7 +402,7 @@ spec:
# Make this match your function
- apiVersion: pkg.crossplane.io/v1
kind: Function
package: xpkg.upbound.io/upbound/function-template-typescript-function
package: xpkg.upbound.io/crossplane/function-template-typescript-function
version: '>=v0.1.0'
```

Expand All @@ -406,14 +416,14 @@ Since the Kind in the template function is an `App`, we create a subdirectory `a

Update the `composition.yaml` file to have the functionRef of the first pipeline step to refer to the name
of the function once it is installed. Crossplane creates a function name of `<docker repository>-<function-name>`,
so `xpkg.upbound.io/upbound/function-template-typescript-function` would have a `functionRef.name` of
`upbound-function-template-typescript-function`.
so `xpkg.upbound.io/crossplane/function-template-typescript-function` would have a `functionRef.name` of
`crossplane-function-template-typescript-function`.

Update the value with the name that represents the Docker registry and image where the function was pushed.

```yaml
- functionRef:
name: upbound-function-template-typescript-function
name: crossplane-function-template-typescript-function
step: app
```

Expand Down
4 changes: 2 additions & 2 deletions env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ CONFIGURATION_NAME=$(npm pkg get name | tr -d '"')
FN_NAME=${CONFIGURATION_NAME}-function

# Change this to your docker repo
# XPKG_REPO=ghcr.io/crossplane
XPKG_REPO=xpkg.upbound.io/upbound
XPKG_REPO=ghcr.io/crossplane

BUILD_PLATFORMS="amd64 arm64"
BUILD_DIR=_build
DOCKER_IMAGE_DIR=${BUILD_DIR}/docker_images
Expand Down
2 changes: 1 addition & 1 deletion examples/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
# This tells crossplane beta render to connect to the function locally.
render.crossplane.io/runtime: Development
spec:
package: xpkg.upbound.io/upbound/function-template-typescript:v0.1.0
package: xpkg.upbound.io/crossplane/function-template-typescript:v0.1.0
---
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
Expand Down
4 changes: 2 additions & 2 deletions package-configuration/crossplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ metadata:
name: function-template-typescript
annotations:
meta.crossplane.io/maintainer: Crossplane Maintainers <info@crossplane.io>
meta.crossplane.io/source: https://github.com/upbound/function-template-typescript
meta.crossplane.io/source: https://github.com/crossplane/function-template-typescript
meta.crossplane.io/license: Apache-2.0
meta.crossplane.io/description: |
This function is an example Crossplane function written in Typescript.
meta.crossplane.io/readme: |
See https://github.com/upbound/function-template-typescript/blob/main/README.md for
See https://github.com/crossplane/function-template-typescript/blob/main/README.md for
customizing this function.
spec:
capabilities:
Expand Down
4 changes: 2 additions & 2 deletions package-function/crossplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ metadata:
name: function-template-typescript-function
annotations:
meta.crossplane.io/maintainer: Crossplane Maintainers <info@crossplane.io>
meta.crossplane.io/source: https://github.com/upbound/function-template-typescript
meta.crossplane.io/source: https://github.com/crossplane/function-template-typescript
meta.crossplane.io/license: Apache-2.0
meta.crossplane.io/description: |
This function is an example Crossplane function written in Typescript.
meta.crossplane.io/readme: |
See https://github.com/upbound/function-template-typescript/blob/main/README.md for
See https://github.com/crossplane/function-template-typescript/blob/main/README.md for
customizing this function.
spec:
capabilities:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"repository": {
"type": "git",
"url": "github.com/upbound/function-template-typescript"
"url": "github.com/crossplane/function-template-typescript"
},
"license": "Apache-2.0",
"author": "Crossplane Authors <info@crossplane.org>",
Expand Down
Loading