Skip to content

Commit a73bb0d

Browse files
authored
Merge pull request #121 from wanjunlei/main
update function API version to v1beta2
2 parents 4007f8b + 7d435cb commit a73bb0d

File tree

32 files changed

+649
-582
lines changed

32 files changed

+649
-582
lines changed

apps/buildah/go/sample-go-app.yaml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
apiVersion: core.openfunction.io/v1beta1
1+
apiVersion: core.openfunction.io/v1beta2
22
kind: Function
33
metadata:
44
name: sample-go-app
5+
namespace: default
56
spec:
6-
version: "v1.0.0"
7-
image: "openfunctiondev/sample-go-app:v1"
8-
imageCredentials:
9-
name: push-secret
10-
#port: 8080 # default to 8080
117
build:
128
builder: openfunction/buildah:v1.23.1
13-
srcRepo:
14-
url: "https://github.com/OpenFunction/samples.git"
15-
sourceSubPath: "apps/buildah/go"
16-
revision: "main"
179
shipwright:
1810
strategy:
19-
name: buildah
2011
kind: ClusterBuildStrategy
12+
name: buildah
13+
srcRepo:
14+
revision: main
15+
sourceSubPath: apps/buildah/go
16+
url: https://github.com/OpenFunction/samples.git
17+
image: openfunctiondev/sample-go-app:v1
18+
imageCredentials:
19+
name: push-secret
2120
serving:
22-
runtime: knative
2321
template:
2422
containers:
25-
- name: function
26-
imagePullPolicy: IfNotPresent
27-
23+
- imagePullPolicy: IfNotPresent
24+
name: function
25+
triggers:
26+
http:
27+
port: 8080
28+
version: v1.0.0
29+
workloadRuntime: OCIContainer
Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1-
apiVersion: core.openfunction.io/v1beta1
1+
apiVersion: core.openfunction.io/v1beta2
22
kind: Function
33
metadata:
44
name: sample-java-app
5+
namespace: default
56
spec:
6-
version: "v1.0.0"
7-
image: "openfunctiondev/sample-java-app:v1"
8-
imageCredentials:
9-
name: push-secret
10-
#port: 8080 # default to 8080
117
build:
128
builder: openfunction/buildah:v1.23.1
13-
srcRepo:
14-
url: "https://github.com/OpenFunction/samples.git"
15-
sourceSubPath: "apps/buildah/java"
16-
revision: "main"
179
shipwright:
1810
strategy:
19-
name: buildah
2011
kind: ClusterBuildStrategy
12+
name: buildah
13+
srcRepo:
14+
revision: main
15+
sourceSubPath: apps/buildah/java
16+
url: https://github.com/OpenFunction/samples.git
17+
image: openfunctiondev/sample-java-app:v1
18+
imageCredentials:
19+
name: push-secret
2120
serving:
22-
runtime: knative
2321
template:
2422
containers:
25-
- name: function
26-
imagePullPolicy: IfNotPresent
27-
23+
- imagePullPolicy: IfNotPresent
24+
name: function
25+
resources: {}
26+
triggers:
27+
http:
28+
port: 8080
29+
route:
30+
gatewayRef:
31+
name: openfunction
32+
namespace: openfunction
33+
version: v1.0.0
34+
workloadRuntime: OCIContainer
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
apiVersion: core.openfunction.io/v1beta1
1+
apiVersion: core.openfunction.io/v1beta2
22
kind: Function
33
metadata:
44
name: sample-java-app-buildpacks
5+
namespace: default
56
spec:
6-
version: "v1.0.0"
7-
image: "openfunction/sample-java-app-buildpacks:v1"
8-
imageCredentials:
9-
name: push-secret
10-
port: 8080 # default to 8080
117
build:
12-
builder: "cnbs/sample-builder:alpine"
8+
builder: cnbs/sample-builder:alpine
139
srcRepo:
14-
url: "https://github.com/buildpacks/samples.git"
15-
sourceSubPath: "apps/java-maven"
16-
revision: "main"
10+
revision: main
11+
sourceSubPath: apps/java-maven
12+
url: https://github.com/buildpacks/samples.git
13+
image: openfunction/sample-java-app-buildpacks:v1
14+
imageCredentials:
15+
name: push-secret
1716
serving:
18-
runtime: "knative" # default to knative
1917
template:
2018
containers:
21-
- name: function
22-
imagePullPolicy: IfNotPresent
19+
- imagePullPolicy: IfNotPresent
20+
name: function
21+
resources: {}
22+
triggers:
23+
http:
24+
port: 8080
25+
version: v1.0.0
26+
workloadRuntime: OCIContainer

apps/kaniko/function-kaniko.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
apiVersion: core.openfunction.io/v1beta1
1+
apiVersion: core.openfunction.io/v1beta2
22
kind: Function
33
metadata:
44
name: function-kaniko
5+
namespace: default
56
spec:
6-
version: "v1.0.0"
7-
image: "openfunctiondev/sample-kankio-go:latest"
8-
imageCredentials:
9-
name: push-secret
10-
#port: 8080 # default to 8080
117
build:
128
builder: openfunction/kaniko-executor:v1.7.0
13-
srcRepo:
14-
url: "https://github.com/OpenFunction/samples.git"
15-
sourceSubPath: "apps/with-dockerfile"
16-
revision: "main"
179
shipwright:
1810
strategy:
19-
name: kaniko
2011
kind: ClusterBuildStrategy
12+
name: kaniko
13+
srcRepo:
14+
revision: main
15+
sourceSubPath: apps/buildah/go
16+
url: https://github.com/OpenFunction/samples.git
17+
image: openfunctiondev/sample-kankio-go:latest
18+
imageCredentials:
19+
name: push-secret
2120
serving:
22-
runtime: knative
2321
template:
2422
containers:
25-
- name: function
26-
imagePullPolicy: Always
23+
- imagePullPolicy: Always
24+
name: function
25+
resources: {}
26+
triggers:
27+
http:
28+
port: 8080
29+
version: v1.0.0
30+
workloadRuntime: OCIContainer

apps/ko/function-ko.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
apiVersion: core.openfunction.io/v1beta1
1+
apiVersion: core.openfunction.io/v1beta2
22
kind: Function
33
metadata:
44
name: function-ko
5+
namespace: default
56
spec:
6-
version: "v1.0.0"
7-
image: "openfunctiondev/sample-ko:latest"
8-
imageCredentials:
9-
name: push-secret
10-
#port: 8080 # default to 8080
117
build:
128
builder: golang:1.17
13-
srcRepo:
14-
url: "https://github.com/OpenFunction/samples.git"
15-
sourceSubPath: "apps/with-dockerfile"
16-
revision: "main"
179
shipwright:
1810
strategy:
19-
name: ko
2011
kind: ClusterBuildStrategy
12+
name: ko
13+
srcRepo:
14+
revision: main
15+
sourceSubPath: apps/buildah/go
16+
url: https://github.com/OpenFunction/samples.git
17+
image: openfunctiondev/sample-ko:latest
18+
imageCredentials:
19+
name: push-secret
2120
serving:
22-
runtime: knative
2321
template:
2422
containers:
25-
- name: function
26-
imagePullPolicy: Always
23+
- imagePullPolicy: Always
24+
name: function
25+
resources: {}
26+
triggers:
27+
http:
28+
port: 8080
29+
version: v1.0.0
30+
workloadRuntime: OCIContainer

functions/async/bindings/cron-input-kafka-output/cron-input-kafka-output.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ func HandleCronInput(ctx ofctx.Context, in []byte) (ofctx.Out, error) {
1717
greeting, _ = json.Marshal(map[string]string{"message": "Hello"})
1818
}
1919

20-
_, err := ctx.Send("sample", greeting)
20+
_, err := ctx.Send("kafka-server", greeting)
2121
if err != nil {
2222
log.Printf("Error: %v\n", err)
2323
return ctx.ReturnOnInternalError(), err
2424
}
25+
2526
return ctx.ReturnOnSuccess(), nil
2627
}
Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,66 @@
1-
apiVersion: core.openfunction.io/v1beta1
1+
apiVersion: core.openfunction.io/v1beta2
22
kind: Function
33
metadata:
44
name: cron-input-kafka-output
5-
annotations:
6-
plugins: |
7-
pre:
8-
- plugin-custom
9-
- plugin-example
10-
post:
11-
- plugin-custom
12-
- plugin-example
5+
namespace: default
136
spec:
14-
version: "v2.0.0"
15-
image: openfunctiondev/cron-input-kafka-output:v1
16-
imageCredentials:
17-
name: push-secret
187
build:
198
builder: openfunction/builder-go:latest
209
env:
21-
FUNC_NAME: "HandleCronInput"
2210
FUNC_CLEAR_SOURCE: "true"
23-
# # Use FUNC_GOPROXY to set the goproxy if failed to fetch go modules
24-
# FUNC_GOPROXY: "https://goproxy.cn"
11+
FUNC_NAME: HandleCronInput
12+
# # Use FUNC_GOPROXY to set the goproxy if failed to fetch go modules
13+
# FUNC_GOPROXY: "https://goproxy.cn"
2514
srcRepo:
26-
url: "https://github.com/OpenFunction/samples.git"
27-
sourceSubPath: "functions/async/bindings/cron-input-kafka-output"
28-
revision: "main"
15+
revision: main
16+
sourceSubPath: functions/async/bindings/cron-input-kafka-output
17+
url: https://github.com/OpenFunction/samples.git
18+
image: openfunctiondev/cron-input-kafka-output:v1
19+
imageCredentials:
20+
name: push-secret
2921
serving:
30-
template:
31-
containers:
32-
- name: function # DO NOT change this
33-
imagePullPolicy: IfNotPresent
34-
runtime: "async"
35-
inputs:
36-
- name: cron
37-
component: cron
38-
outputs:
39-
- name: sample
40-
component: kafka-server
41-
operation: "create"
4222
bindings:
4323
cron:
24+
metadata:
25+
- name: schedule
26+
value: '@every 2s'
4427
type: bindings.cron
4528
version: v1
46-
metadata:
47-
- name: schedule
48-
value: "@every 2s"
4929
kafka-server:
30+
ignoreErrors: false
31+
initTimeout: ""
32+
metadata:
33+
- name: brokers
34+
value: kafka-server-kafka-brokers:9092
35+
- name: topics
36+
value: sample-topic
37+
- name: consumerGroup
38+
value: bindings-with-output
39+
- name: publishTopic
40+
value: sample-topic
41+
- name: authRequired
42+
value: "false"
5043
type: bindings.kafka
5144
version: v1
52-
metadata:
53-
- name: brokers
54-
value: "kafka-server-kafka-brokers:9092"
55-
- name: topics
56-
value: "sample-topic"
57-
- name: consumerGroup
58-
value: "bindings-with-output"
59-
- name: publishTopic
60-
value: "sample-topic"
61-
- name: authRequired
62-
value: "false"
45+
hooks:
46+
post:
47+
- plugin-custom
48+
- plugin-example
49+
pre:
50+
- plugin-example
51+
- plugin-custom
52+
outputs:
53+
- dapr:
54+
name: kafka-server
55+
operation: create
56+
type: bindings.kafka
57+
template:
58+
containers:
59+
- imagePullPolicy: IfNotPresent
60+
name: function
61+
triggers:
62+
dapr:
63+
- name: cron
64+
type: bindings.cron
65+
version: v2.0.0
66+
workloadRuntime: OCIContainer

0 commit comments

Comments
 (0)