A template for writing a composition function in Go
Go to file
renovate[bot] 4253a274a9
chore(deps): update docker/build-push-action action to v6
2024-06-17 12:29:07 +00:00
.github chore(deps): update docker/build-push-action action to v6 2024-06-17 12:29:07 +00:00
example Add an example directory 2023-10-31 23:39:02 -07:00
input Run go generate 2023-10-31 22:51:21 -07:00
package Run go generate 2023-10-31 22:51:21 -07:00
.gitignore Initial commit 2023-09-14 20:43:42 -07:00
.golangci.yml Copy linter config from crossplane/crossplane 2023-11-01 17:43:51 -07:00
Dockerfile Add commentary to the Dockerfile, too 2023-10-25 16:03:55 -07:00
LICENSE Initial commit 2023-09-14 20:43:42 -07:00
NOTES.txt add init hooks 2024-01-19 12:23:16 +01:00
README.md add init hooks 2024-01-19 12:23:16 +01:00
fn.go Copy linter config from crossplane/crossplane 2023-11-01 17:43:51 -07:00
fn_test.go Copy linter config from crossplane/crossplane 2023-11-01 17:43:51 -07:00
go.mod Merge pull request #69 from crossplane/renovate/google.golang.org-protobuf-1.x 2024-05-30 16:39:55 -07:00
go.sum fix(deps): update module google.golang.org/protobuf to v1.34.1 2024-05-06 17:15:54 +00:00
init.sh add init hooks 2024-01-19 12:23:16 +01:00
main.go Add a Function template 2023-09-12 21:46:07 -07:00
renovate.json chore(renovate): bump examples using crossplane manager 2023-11-22 12:42:50 +01:00

README.md

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