Skip to content

Commit 98696eb

Browse files
authored
Merge pull request #4 from turkenh/readme-installation
Add marketplace link to the readme
2 parents 39145b7 + 672676d commit 98696eb

File tree

4 files changed

+9
-43
lines changed

4 files changed

+9
-43
lines changed

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,4 @@ See `example/composition.yaml` for a complete example.
2626

2727
## Installation
2828

29-
Currently it could be installed as follows:
30-
31-
```
32-
apiVersion: pkg.crossplane.io/v1beta1
33-
kind: Function
34-
metadata:
35-
name: function-sequencer
36-
spec:
37-
package: xpkg.upbound.io/hasan/function-sequencer:v0.0.3
38-
```
39-
40-
29+
It can be installed as follows from the Upbound marketplace: https://marketplace.upbound.io/functions/crossplane-contrib/function-sequencer

fn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package main
33
import (
44
"context"
55
"fmt"
6-
"github.com/crossplane/function-sdk-go/resource"
76

87
"github.com/crossplane/crossplane-runtime/pkg/errors"
98
"github.com/crossplane/crossplane-runtime/pkg/logging"
109
fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1"
1110
"github.com/crossplane/function-sdk-go/request"
11+
"github.com/crossplane/function-sdk-go/resource"
1212
"github.com/crossplane/function-sdk-go/response"
1313
"github.com/crossplane/function-sequencer/input/v1beta1"
1414
)
@@ -21,7 +21,7 @@ type Function struct {
2121
}
2222

2323
// RunFunction runs the Function.
24-
func (f *Function) RunFunction(_ context.Context, req *fnv1beta1.RunFunctionRequest) (*fnv1beta1.RunFunctionResponse, error) {
24+
func (f *Function) RunFunction(_ context.Context, req *fnv1beta1.RunFunctionRequest) (*fnv1beta1.RunFunctionResponse, error) { //nolint:gocyclo // This function is unavoidably complex.
2525
f.log.Info("Running function", "tag", req.GetMeta().GetTag())
2626

2727
rsp := response.To(req, response.DefaultTTL)

fn_test.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ import (
77
"github.com/google/go-cmp/cmp"
88
"github.com/google/go-cmp/cmp/cmpopts"
99
"google.golang.org/protobuf/testing/protocmp"
10-
"google.golang.org/protobuf/types/known/durationpb"
1110

1211
"github.com/crossplane/crossplane-runtime/pkg/logging"
1312
fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1"
14-
"github.com/crossplane/function-sdk-go/resource"
15-
"github.com/crossplane/function-sdk-go/response"
1613
)
1714

1815
func TestRunFunction(t *testing.T) {
@@ -31,30 +28,7 @@ func TestRunFunction(t *testing.T) {
3128
args args
3229
want want
3330
}{
34-
"ResponseIsReturned": {
35-
reason: "The Function should return a fatal result if no input was specified",
36-
args: args{
37-
req: &fnv1beta1.RunFunctionRequest{
38-
Meta: &fnv1beta1.RequestMeta{Tag: "hello"},
39-
Input: resource.MustStructJSON(`{
40-
"apiVersion": "template.fn.crossplane.io/v1beta1",
41-
"kind": "Input",
42-
"example": "Hello, world"
43-
}`),
44-
},
45-
},
46-
want: want{
47-
rsp: &fnv1beta1.RunFunctionResponse{
48-
Meta: &fnv1beta1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)},
49-
Results: []*fnv1beta1.Result{
50-
{
51-
Severity: fnv1beta1.Severity_SEVERITY_NORMAL,
52-
Message: "I was run with input \"Hello, world\"!",
53-
},
54-
},
55-
},
56-
},
57-
},
31+
// TODO: Add test cases.
5832
}
5933

6034
for name, tc := range cases {

input/v1beta1/input.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
package v1beta1
66

77
import (
8-
"github.com/crossplane/function-sdk-go/resource"
98
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
9+
10+
"github.com/crossplane/function-sdk-go/resource"
1011
)
1112

1213
// This isn't a custom resource, in the sense that we never install its CRD.
1314
// It is a KRM-like object, so we generate a CRD to describe its schema.
1415

16+
// SequencingRule is a rule that describes a sequence of resources.
1517
type SequencingRule struct {
16-
// TODO: InferFromUsages
18+
// TODO: Should we add a way to infer sequencing from usages? e.g. InferFromUsages: true
1719
// InferFromUsages bool `json:"inferFromUsages,omitempty"`
1820
Sequence []resource.Name `json:"sequence,omitempty"`
1921
}
@@ -26,5 +28,6 @@ type Input struct {
2628
metav1.TypeMeta `json:",inline"`
2729
metav1.ObjectMeta `json:"metadata,omitempty"`
2830

31+
// Rules is a list of rules that describe sequences of resources.
2932
Rules []SequencingRule `json:"rules"`
3033
}

0 commit comments

Comments
 (0)