function-template-go

command module
v0.0.0-...-c09b736 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

function-template-go

CI

A template for writing a composition function in Go.

To learn how to use this template:

If you just want to jump in and get started:

  1. Replace function-template-go with your function in go.mod, package/crossplane.yaml, and any Go imports. (You can also do this automatically by running the ./init.sh <function-name> script.)
  2. Update input/v1beta1/ to reflect your desired input (and run go generate)
  3. Add your logic to RunFunction in fn.go
  4. Add tests for your logic in fn_test.go
  5. Update this file, README.md, to be about your function!

This template uses Go, Docker, and the Crossplane CLI to build functions.

# Run code generation - see input/generate.go
$ go generate ./...

# Run tests - see fn_test.go
$ go test ./...

# Build the function's runtime image - see Dockerfile
$ docker build . --tag=runtime

# Build a function package - see package/crossplane.yaml
$ crossplane xpkg build -f package --embed-runtime-image=runtime

Documentation

Overview

Package main implements a Composition Function.

Directories

Path Synopsis
input
v1beta1
Package v1beta1 contains the input type for this Function +kubebuilder:object:generate=true +groupName=template.fn.crossplane.io +versionName=v1beta1
Package v1beta1 contains the input type for this Function +kubebuilder:object:generate=true +groupName=template.fn.crossplane.io +versionName=v1beta1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL