Releases: crossplane/function-template-typescript
v0.4.0
Release Notes - v0.4.0
Overview
This release updates the Function SDK to v0.5.0, introducing new capabilities for status condition checking and Crossplane version detection. These features enable functions to adapt to different Crossplane versions and reliably check the health status of managed resources.
What's New
SDK Update to v0.5.0
- Function SDK: Updated
@crossplane-org/function-sdk-typescriptfrom^0.4.0to^0.5.0 - New
getCondition()Function: Extract status conditions from Kubernetes resources with safe "Unknown" fallback - New
hasCapability()Function: Detect available Crossplane capabilities for version-aware feature enablement
New SDK Features
Condition Checking (getCondition)
The new getCondition() function allows safe extraction of status conditions from observed resources:
import { getCondition, getObservedComposedResources } from '@crossplane-org/function-sdk-typescript';
const observedComposed = getObservedComposedResources(req);
const observedDeployment = observedComposed['my-deployment'];
if (observedDeployment?.resource) {
const availableCondition = getCondition(observedDeployment.resource, 'Available');
const progressingCondition = getCondition(observedDeployment.resource, 'Progressing');
logger?.info({
deployment: observedDeployment.resource.metadata?.name,
available: availableCondition.status, // "True", "False", or "Unknown"
progressing: progressingCondition.status,
}, 'Deployment conditions');
}Returns a condition object with status: "Unknown" if the condition type is not found, making it safe to use even when resources are newly created.
Capability Detection (hasCapability)
The new hasCapability() function enables version-aware feature detection:
import { hasCapability, Capability } from '@crossplane-org/function-sdk-typescript';
const capabilities = {
requiredResources: hasCapability(req, Capability.CAPABILITY_REQUIRED_RESOURCES),
requiredSchemas: hasCapability(req, Capability.CAPABILITY_REQUIRED_SCHEMAS),
};
logger?.info({ capabilities }, 'Crossplane capabilities detected');
// Conditionally enable features based on capabilities
if (capabilities.requiredSchemas) {
// Use schema validation features available in Crossplane 2.2.0+
}This allows functions to gracefully adapt to different Crossplane versions.
Code Examples
- Function Implementation: Added practical examples in src/function.ts demonstrating:
- Capability detection on startup (lines 61-68)
- Condition checking for Deployment resources (lines 226-241)
Documentation Updates
- Enhanced README: Comprehensive documentation for SDK v0.5.0 features
- Organized "Key SDK Functions" section with categorized functions
- Added "Checking Resource Conditions" section with complete examples
- Added "Detecting Crossplane Capabilities" section with usage patterns
- Updated Dependencies section with version-specific feature notes
- Template Updates: Updated GitHub issue and PR templates with improved formatting
Package Configuration Updates
- Version Requirements: Updated package-configuration/crossplane.yaml to require
>=v0.3.0 - API Definition: Updated package-configuration/apis/apps/definition.yaml with improved metadata
Migration Guide
If you're upgrading from v0.3.x, you can optionally use the new SDK features:
Using Condition Checking
// Import new functions
import { getCondition, getObservedComposedResources } from '@crossplane-org/function-sdk-typescript';
// Check resource conditions safely
const observedComposed = getObservedComposedResources(req);
const resource = observedComposed['my-resource'];
if (resource?.resource) {
const condition = getCondition(resource.resource, 'Ready');
// condition.status will be "True", "False", or "Unknown"
}Using Capability Detection
// Import capability detection
import { hasCapability, Capability } from '@crossplane-org/function-sdk-typescript';
// Check for capabilities
if (hasCapability(req, Capability.CAPABILITY_REQUIRED_SCHEMAS)) {
// Use features only available in newer Crossplane versions
}Files Changed
package.json- Version bump to 0.4.0 and SDK update to v0.5.0package-lock.json- Updated dependency treesrc/function.ts- Added capability detection and condition checking examplessrc/test-helpers.ts- Minor formatting cleanupREADME.md- Comprehensive documentation updates for new SDK featurespackage-configuration/crossplane.yaml- Updated version requirementpackage-configuration/apis/apps/definition.yaml- Metadata improvements.github/ISSUE_TEMPLATE/bug_report.md- Template formatting improvements.github/ISSUE_TEMPLATE/feature_request.md- Template formatting improvements.github/PULL_REQUEST_TEMPLATE.md- Template formatting improvements
Installation
Install the Configuration package:
apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
name: crossplane-configuration-template-typescript
spec:
package: ghcr.io/crossplane/configuration-template-typescript:v0.4.0Or install the Function package directly:
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata:
name: crossplane-function-template-typescript
spec:
package: ghcr.io/crossplane/function-template-typescript:v0.4.0Breaking Changes
None. This release is fully backward compatible with v0.3.x. All new features are optional additions that enhance functionality without changing existing behavior.
Contributors
- Steven Borrelli (@stevendborrelli)
Full Changelog
Compare changes: v0.3.0...v0.4.0
v0.3.0
Release Notes - v0.3.0
Overview
This release updates the Function SDK to v0.4.0, which introduces the new fromModel helper function for simpler conversion of Kubernetes models to Crossplane Resources. This change simplifies the codebase and provides a better developer experience when working with kubernetes-models.
What's New
SDK Update to v0.4.0
- Function SDK: Updated
@crossplane-org/function-sdk-typescriptfrom^0.3.1to^0.4.0 - New
fromModelHelper: The SDK now includes afromModel()function that simplifies converting kubernetes-models objects to Crossplane Resources
Code Improvements
- Simplified Resource Creation: Replaced verbose
Resource.fromJSON({ resource: model.toJSON() })pattern with cleanerfromModel(model)calls - Improved Readability: Updated all resource creation in src/function.ts to use the new helper function
- ServiceAccount creation (line 103)
- Service creation (line 129)
- Deployment creation (line 211)
- Ingress creation (line 267)
Documentation Updates
- Enhanced README: Added comprehensive documentation for the
fromModelhelper function- Updated "Key SDK Functions" section to include
fromModel - Updated "Using Kubernetes Models" section with new usage examples
- Added migration notes explaining the difference between legacy and new approaches
- Updated dependency notes to reference SDK v0.4.0 features
- Updated "Key SDK Functions" section to include
Migration Guide
If you're upgrading from v0.2.x, you can optionally migrate your code to use the new fromModel helper:
Old approach (still supported):
import { Resource } from '@crossplane-org/function-sdk-typescript';
import { Pod } from 'kubernetes-models/v1';
const pod = new Pod({ /* ... */ });
desiredComposed['my-pod'] = Resource.fromJSON({ resource: pod.toJSON() });New approach (recommended):
import { fromModel } from '@crossplane-org/function-sdk-typescript';
import { Pod } from 'kubernetes-models/v1';
const pod = new Pod({ /* ... */ });
desiredComposed['my-pod'] = fromModel(pod);Files Changed
package.json- Version bump to 0.3.0 and SDK update to v0.4.0package-lock.json- Updated dependency tree (331 insertions, 279 deletions)src/function.ts- Migrated to usefromModelhelper functionREADME.md- Documentation updates for new SDK features
Installation
Install the Configuration package:
apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
name: crossplane-configuration-template-typescript
spec:
package: ghcr.io/crossplane/configuration-template-typescript:v0.3.0Or install the Function package directly:
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata:
name: crossplane-function-template-typescript
spec:
package: ghcr.io/crossplane/function-template-typescript:v0.3.0Breaking Changes
None. This release is fully backward compatible with v0.2.x. The legacy Resource.fromJSON() approach continues to work alongside the new fromModel helper.
Contributors
- Steven Borrelli (@stevendborrelli)
Full Changelog
Compare changes: v0.2.1...v0.3.0
v0.2.1
Release Notes - v0.2.1
Overview
This is a maintenance release focused on updating dependencies to their latest versions and ensuring compatibility with the latest tooling updates.
What's New
Dependency Updates
- Function SDK: Updated
@crossplane-org/function-sdk-typescriptfrom^0.3.0to^0.3.1 - ESLint: Upgraded from
^9.39.2to^10.0.2for improved linting capabilities - TypeScript ESLint: Updated from
^8.53.0to^8.56.0 - Package Overrides: Added
minimatchoverride to^10.2.2for security and compatibility
Improvements
- Reduced Package Size: Optimized
package-lock.jsonresulting in a cleaner dependency tree - Security Updates: Dependencies updated to include latest security patches
- Compatibility: Ensured compatibility with latest versions of development tools
Files Changed
package.json- Version bump to 0.2.1 and dependency updatespackage-lock.json- Refreshed dependency tree (333 insertions, 653 deletions)README.md- Documentation formatting improvements
Installation
Install the Configuration package:
apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
name: crossplane-configuration-template-typescript
spec:
package: ghcr.io/crossplane/configuration-template-typescript:v0.2.1Contributors
- Steven Borrelli (@stevendborrelli)
Full Changelog
Compare changes: v0.2.0...v0.2.1
v0.2.0
Release Notes - v0.2.0
Overview
This release includes significant organizational changes, improved documentation, enhanced GitHub workflows, and better project structure. The template has been migrated to use GitHub Container Registry (ghcr.io) and updated to reflect the official Crossplane organization.
What's New
Organization Changes
- Migrated to Crossplane Organization: Updated all package references from
upboundtocrossplaneorganization - GitHub Container Registry: Switched default package registry from Upbound registry to
ghcr.iofor better accessibility - Package Renaming: Updated package names to reflect the new organizational structure
- Configuration package:
ghcr.io/crossplane/configuration-template-typescript - Function package:
ghcr.io/crossplane/function-template-typescript
- Configuration package:
Documentation Improvements
- Enhanced README: Significantly expanded documentation with:
- Clearer TypeScript compiler information (TypeScript 5+ tsc and TypeScript 7 tsgo)
- Better structured sections with improved navigation
- Fixed broken links and formatting issues
- More detailed examples and explanations
- Issue Templates: Added GitHub issue templates for bug reports and feature requests
- Pull Request Template: Added standardized PR template to improve contribution workflow
CI/CD Enhancements
- Updated GitHub Actions: Modified CI workflow to support GitHub Container Registry
- Updated authentication mechanisms
- Improved permissions handling
- Cleaner workflow configuration
Code Quality
- Removed Unused Code: Cleaned up unnecessary annotations and test helper functions
- Fixed Typos: Corrected various typos throughout the codebase
- Code Cleanup: General refactoring and cleanup for better maintainability
Configuration Updates
- Updated Function References: Updated
examples/functions.yamlto reference new package locations - Crossplane Package Metadata: Updated
crossplane.yamlfiles in both function and configuration packages - Environment Variables: Simplified
envfile with updated registry defaults
Breaking Changes
Old (v0.1.0):
package: xpkg.upbound.io/upbound/function-template-typescriptNew (v0.2.0):
package: ghcr.io/crossplane/function-template-typescript:v0.2.0Update your Configuration packages and any references accordingly.
Files Changed
.github/ISSUE_TEMPLATE/bug_report.md- Added.github/ISSUE_TEMPLATE/feature_request.md- Added.github/PULL_REQUEST_TEMPLATE.md- Added.github/workflows/ci.yaml- Updated for ghcr.ioREADME.md- Major documentation improvementsenv- Updated registry configurationexamples/functions.yaml- Updated function referencespackage-configuration/apis/apps/composition.yaml- Updated function namespackage-configuration/crossplane.yaml- Updated package dependenciespackage-function/crossplane.yaml- Updated package metadatapackage.json- Version bump to 0.2.0src/function.ts- Code cleanupsrc/test-helpers.ts- Removed unused codetest-cases/README.md- Documentation updatestest-cases/example.yaml- Cleanup
Installation
Install the Configuration package:
apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
name: crossplane-configuration-template-typescript
spec:
package: ghcr.io/crossplane/configuration-template-typescript:v0.2.0Contributors
- Steven Borrelli (@stevendborrelli)
Full Changelog
Compare changes: v0.1.0...v0.2.0
v0.1.0
v0.1.0 - Initial Release
What's New
This is the initial release of the Crossplane Function Template for TypeScript. This template provides a complete starting point for building Crossplane composition functions using TypeScript and the official Function SDK.
Features
- Full TypeScript Support: Build Crossplane functions with TypeScript 5+ or TypeScript 7 (tsgo)
- Function SDK Integration: Uses @crossplane-org/function-sdk-typescript v0.3.0
- Example Implementation: Sample function that creates Kubernetes resources (Deployment, Service, ServiceAccount, Ingress)
- Testing Support: Jest-based testing with YAML test case support
- GitHub Actions CI/CD: Automated workflows for building, testing, and publishing packages
- Multi-Architecture Support: Docker images and packages for both amd64 and arm64
- Code Quality Tools: ESLint, Prettier, and TypeScript strict mode configuration
- Complete Documentation: Extensive README with implementation guide and examples
Package Structure
- Configuration Package: Contains the XRD and Composition for deploying the function
- Function Package: Embeds the TypeScript function in a distroless Node.js container
- Example Manifests: Examples in the
examples/directory
Installation
Install the configuration package to your Crossplane cluster:
apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
name: configuration-template-typescript
spec:
package: xpkg.upbound.io/upbound/function-template-typescript:v0.1.0Development
Clone and start developing:
git clone https://github.com/upbound/function-template-typescript.git
cd function-template-typescript
npm install
npm run build
npm testWhat's Included
- TypeScript function implementation with SDK integration
- YAML-based test case framework
- Multi-platform Docker build scripts
- Crossplane package build tooling
- GitHub Actions for automated CI/CD
- Comprehensive README and documentation
For more information, see the README.
Full Changelog: https://github.com/upbound/function-template-typescript/commits/v0.1.0