Skip to content

Commit

Permalink
feat(cloudevents-server): add skaffold flow file (#3)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo authored Sep 27, 2023
1 parent 52b37fc commit 45ac622
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 3 deletions.
16 changes: 16 additions & 0 deletions cloudevents-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Cloud Events Server
===

## How to run


### With sqlite as backend database:
```bash
go run --tags sqlite3 . -config=configs/example-config-sqlite3.yaml
```

### With MySQL or TiDB as backend database:

```bash
go run . -config=configs/example-config.yaml
```
3 changes: 3 additions & 0 deletions cloudevents-server/configs/example-config-sqlite3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
store:
driver: sqlite3
dsn: file:ent?mode=memory&cache=shared&_fk=1
59 changes: 59 additions & 0 deletions cloudevents-server/deployments/k8s-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: v1
kind: Secret
metadata:
name: cloudevents-server-sqlite
type: Opaque
stringData:
config.yaml: |
store:
driver: sqlite3
dsn: file:ent?mode=memory&cache=shared&_fk=1
---
apiVersion: v1
kind: Service
metadata:
name: cloudevents-server
labels:
app: cloudevents-server
spec:
ports:
- port: 8080
protocol: TCP
clusterIP: None
selector:
app: cloudevents-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloudevents-server
labels:
app: cloudevents-server
spec:
replicas: 1
selector:
matchLabels:
app: cloudevents-server
template:
metadata:
labels:
app: cloudevents-server
spec:
containers:
- name: cloudevents-server
image: ghcr.io/pingcap-qe/ee-apps/cloudevents-server
resources:
requests:
cpu: '100m'
memory: 128Mi
limits:
cpu: '100m'
memory: 128Mi
args: [-config, "/config/config.yaml"]
volumeMounts:
- name: config
mountPath: /config
volumes:
- name: config
secret:
secretName: cloudevents-server-sqlite
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
"github.com/PingCAP-QE/ee-apps/cloudevents-server/ent"
cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/cloudevents/sdk-go/v2/types"

_ "github.com/go-sql-driver/mysql"
_ "github.com/mattn/go-sqlite3"
)

type Handler struct {
Expand Down
31 changes: 31 additions & 0 deletions cloudevents-server/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: skaffold/v4beta6
kind: Config
metadata:
name: cloudevents-server
build:
platforms: ["linux/amd64"]
artifacts:
- image: ghcr.io/pingcap-qe/ee-apps/cloudevents-server
ko:
env:
- GOPROXY={{.GOPROXY}}
- CGO_ENABLED=1 # need build in linux
labels:
org.opencontainers.image.licenses: MIT
org.opencontainers.image.source: https://github.com/PingCAP-QE/ee-apps
manifests:
rawYaml:
- deployments/k8s-dev.yaml
portForward:
- resourceType: service
resourceName: cloudevents-server
port: 8080
deploy:
kubectl: {}
profiles:
- name: dev
patches:
- op: add
path: /build/artifacts/0/ko/flags
value:
- --tags=sqlite3

0 comments on commit 45ac622

Please sign in to comment.