Skip to content

Commit

Permalink
Merge pull request OpenFunction#121 from wanjunlei/main
Browse files Browse the repository at this point in the history
update function API version to v1beta2
  • Loading branch information
benjaminhuo authored May 19, 2023
2 parents 4007f8b + 7d435cb commit a73bb0d
Show file tree
Hide file tree
Showing 32 changed files with 649 additions and 582 deletions.
32 changes: 17 additions & 15 deletions apps/buildah/go/sample-go-app.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
apiVersion: core.openfunction.io/v1beta1
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
name: sample-go-app
namespace: default
spec:
version: "v1.0.0"
image: "openfunctiondev/sample-go-app:v1"
imageCredentials:
name: push-secret
#port: 8080 # default to 8080
build:
builder: openfunction/buildah:v1.23.1
srcRepo:
url: "https://github.com/OpenFunction/samples.git"
sourceSubPath: "apps/buildah/go"
revision: "main"
shipwright:
strategy:
name: buildah
kind: ClusterBuildStrategy
name: buildah
srcRepo:
revision: main
sourceSubPath: apps/buildah/go
url: https://github.com/OpenFunction/samples.git
image: openfunctiondev/sample-go-app:v1
imageCredentials:
name: push-secret
serving:
runtime: knative
template:
containers:
- name: function
imagePullPolicy: IfNotPresent

- imagePullPolicy: IfNotPresent
name: function
triggers:
http:
port: 8080
version: v1.0.0
workloadRuntime: OCIContainer
37 changes: 22 additions & 15 deletions apps/buildah/java/sample-java-app.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
apiVersion: core.openfunction.io/v1beta1
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
name: sample-java-app
namespace: default
spec:
version: "v1.0.0"
image: "openfunctiondev/sample-java-app:v1"
imageCredentials:
name: push-secret
#port: 8080 # default to 8080
build:
builder: openfunction/buildah:v1.23.1
srcRepo:
url: "https://github.com/OpenFunction/samples.git"
sourceSubPath: "apps/buildah/java"
revision: "main"
shipwright:
strategy:
name: buildah
kind: ClusterBuildStrategy
name: buildah
srcRepo:
revision: main
sourceSubPath: apps/buildah/java
url: https://github.com/OpenFunction/samples.git
image: openfunctiondev/sample-java-app:v1
imageCredentials:
name: push-secret
serving:
runtime: knative
template:
containers:
- name: function
imagePullPolicy: IfNotPresent

- imagePullPolicy: IfNotPresent
name: function
resources: {}
triggers:
http:
port: 8080
route:
gatewayRef:
name: openfunction
namespace: openfunction
version: v1.0.0
workloadRuntime: OCIContainer
30 changes: 17 additions & 13 deletions apps/buildpacks/java/sample-java-app-buildpacks.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
apiVersion: core.openfunction.io/v1beta1
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
name: sample-java-app-buildpacks
namespace: default
spec:
version: "v1.0.0"
image: "openfunction/sample-java-app-buildpacks:v1"
imageCredentials:
name: push-secret
port: 8080 # default to 8080
build:
builder: "cnbs/sample-builder:alpine"
builder: cnbs/sample-builder:alpine
srcRepo:
url: "https://github.com/buildpacks/samples.git"
sourceSubPath: "apps/java-maven"
revision: "main"
revision: main
sourceSubPath: apps/java-maven
url: https://github.com/buildpacks/samples.git
image: openfunction/sample-java-app-buildpacks:v1
imageCredentials:
name: push-secret
serving:
runtime: "knative" # default to knative
template:
containers:
- name: function
imagePullPolicy: IfNotPresent
- imagePullPolicy: IfNotPresent
name: function
resources: {}
triggers:
http:
port: 8080
version: v1.0.0
workloadRuntime: OCIContainer
32 changes: 18 additions & 14 deletions apps/kaniko/function-kaniko.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
apiVersion: core.openfunction.io/v1beta1
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
name: function-kaniko
namespace: default
spec:
version: "v1.0.0"
image: "openfunctiondev/sample-kankio-go:latest"
imageCredentials:
name: push-secret
#port: 8080 # default to 8080
build:
builder: openfunction/kaniko-executor:v1.7.0
srcRepo:
url: "https://github.com/OpenFunction/samples.git"
sourceSubPath: "apps/with-dockerfile"
revision: "main"
shipwright:
strategy:
name: kaniko
kind: ClusterBuildStrategy
name: kaniko
srcRepo:
revision: main
sourceSubPath: apps/buildah/go
url: https://github.com/OpenFunction/samples.git
image: openfunctiondev/sample-kankio-go:latest
imageCredentials:
name: push-secret
serving:
runtime: knative
template:
containers:
- name: function
imagePullPolicy: Always
- imagePullPolicy: Always
name: function
resources: {}
triggers:
http:
port: 8080
version: v1.0.0
workloadRuntime: OCIContainer
32 changes: 18 additions & 14 deletions apps/ko/function-ko.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
apiVersion: core.openfunction.io/v1beta1
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
name: function-ko
namespace: default
spec:
version: "v1.0.0"
image: "openfunctiondev/sample-ko:latest"
imageCredentials:
name: push-secret
#port: 8080 # default to 8080
build:
builder: golang:1.17
srcRepo:
url: "https://github.com/OpenFunction/samples.git"
sourceSubPath: "apps/with-dockerfile"
revision: "main"
shipwright:
strategy:
name: ko
kind: ClusterBuildStrategy
name: ko
srcRepo:
revision: main
sourceSubPath: apps/buildah/go
url: https://github.com/OpenFunction/samples.git
image: openfunctiondev/sample-ko:latest
imageCredentials:
name: push-secret
serving:
runtime: knative
template:
containers:
- name: function
imagePullPolicy: Always
- imagePullPolicy: Always
name: function
resources: {}
triggers:
http:
port: 8080
version: v1.0.0
workloadRuntime: OCIContainer
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ func HandleCronInput(ctx ofctx.Context, in []byte) (ofctx.Out, error) {
greeting, _ = json.Marshal(map[string]string{"message": "Hello"})
}

_, err := ctx.Send("sample", greeting)
_, err := ctx.Send("kafka-server", greeting)
if err != nil {
log.Printf("Error: %v\n", err)
return ctx.ReturnOnInternalError(), err
}

return ctx.ReturnOnSuccess(), nil
}
Original file line number Diff line number Diff line change
@@ -1,62 +1,66 @@
apiVersion: core.openfunction.io/v1beta1
apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
name: cron-input-kafka-output
annotations:
plugins: |
pre:
- plugin-custom
- plugin-example
post:
- plugin-custom
- plugin-example
namespace: default
spec:
version: "v2.0.0"
image: openfunctiondev/cron-input-kafka-output:v1
imageCredentials:
name: push-secret
build:
builder: openfunction/builder-go:latest
env:
FUNC_NAME: "HandleCronInput"
FUNC_CLEAR_SOURCE: "true"
# # Use FUNC_GOPROXY to set the goproxy if failed to fetch go modules
# FUNC_GOPROXY: "https://goproxy.cn"
FUNC_NAME: HandleCronInput
# # Use FUNC_GOPROXY to set the goproxy if failed to fetch go modules
# FUNC_GOPROXY: "https://goproxy.cn"
srcRepo:
url: "https://github.com/OpenFunction/samples.git"
sourceSubPath: "functions/async/bindings/cron-input-kafka-output"
revision: "main"
revision: main
sourceSubPath: functions/async/bindings/cron-input-kafka-output
url: https://github.com/OpenFunction/samples.git
image: openfunctiondev/cron-input-kafka-output:v1
imageCredentials:
name: push-secret
serving:
template:
containers:
- name: function # DO NOT change this
imagePullPolicy: IfNotPresent
runtime: "async"
inputs:
- name: cron
component: cron
outputs:
- name: sample
component: kafka-server
operation: "create"
bindings:
cron:
metadata:
- name: schedule
value: '@every 2s'
type: bindings.cron
version: v1
metadata:
- name: schedule
value: "@every 2s"
kafka-server:
ignoreErrors: false
initTimeout: ""
metadata:
- name: brokers
value: kafka-server-kafka-brokers:9092
- name: topics
value: sample-topic
- name: consumerGroup
value: bindings-with-output
- name: publishTopic
value: sample-topic
- name: authRequired
value: "false"
type: bindings.kafka
version: v1
metadata:
- name: brokers
value: "kafka-server-kafka-brokers:9092"
- name: topics
value: "sample-topic"
- name: consumerGroup
value: "bindings-with-output"
- name: publishTopic
value: "sample-topic"
- name: authRequired
value: "false"
hooks:
post:
- plugin-custom
- plugin-example
pre:
- plugin-example
- plugin-custom
outputs:
- dapr:
name: kafka-server
operation: create
type: bindings.kafka
template:
containers:
- imagePullPolicy: IfNotPresent
name: function
triggers:
dapr:
- name: cron
type: bindings.cron
version: v2.0.0
workloadRuntime: OCIContainer
Loading

0 comments on commit a73bb0d

Please sign in to comment.