Skip to content
Merged
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
54 changes: 35 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
# function-template-go
[![CI](https://github.com/crossplane/function-template-go/actions/workflows/ci.yml/badge.svg)](https://github.com/crossplane/function-template-go/actions/workflows/ci.yml)

A template for writing a [composition function][functions] in [Go][go].

To learn how to use this template:

* [Follow the guide to writing a composition function in Go][function guide]
* [Learn about how composition functions work][functions]
* [Read the function-sdk-go package documentation][package docs]
# function-event-filter
[![CI](https://github.com/upbound/function-event-filter/actions/workflows/ci.yml/badge.svg)](https://github.com/upbound/function-event-filter/actions/workflows/ci.yml)
[![Slack](https://img.shields.io/badge/slack-upbound_crossplane-purple?logo=slack)](https://crossplane.slack.com/archives/C01TRKD4623)

A Crossplane function that can be used in a function pipeline to gate further
progress within the pipeline based on supplied `Event` details.

## Example usage
```yaml
apiVersion: ops.crossplane.io/v1alpha1
kind: WatchOperation
metadata:
name: analyze-events
spec:
watch:
apiVersion: v1
kind: Event
namespace: crossplane-system
concurrencyPolicy: Forbid
successfulHistoryLimit: 2
failedHistoryLimit: 1
operationTemplate:
spec:
mode: Pipeline
pipeline:
# Filter events to only pass those of type "Warning".
- step: filter-noisy-events
functionRef:
name: function-event-filter
input:
apiVersion: filter.event.fn.upbound.io/v1alpha1
kind: Input
type: Warning
```

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.)
1. Update `input/v1beta1/` to reflect your desired input (and run `go generate ./...`)
1. Add your logic to `RunFunction` in `fn.go`
1. Add tests for your logic in `fn_test.go`
1. Update this file, `README.md`, to be about your function!
## Development

This template uses [Go][go], [Docker][docker], and the [Crossplane CLI][cli] to
build functions.
Expand All @@ -41,4 +58,3 @@ $ crossplane xpkg build -f package --embed-runtime-image=runtime
[function guide]: https://docs.crossplane.io/knowledge-base/guides/write-a-composition-function-in-go
[package docs]: https://pkg.go.dev/github.com/crossplane/function-sdk-go
[docker]: https://www.docker.com
[cli]: https://docs.crossplane.io/latest/cli