Skip to content

Commit

Permalink
fix: smaller improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mati007thm committed Feb 2, 2024
1 parent 508ca85 commit 3591bd8
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
5 changes: 4 additions & 1 deletion dapr-distributed-calendar/go/go_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
)

var daprPort = os.Getenv("DAPR_HTTP_PORT") // Dapr's default is 3500 if not configured
var daprPort = os.Getenv("DAPR_HTTP_PORT")

const stateStoreName = `events`

Expand Down Expand Up @@ -270,6 +270,9 @@ func checkEvent(id string) ([]byte, error) {
}

func main() {
if daprPort == "" {
daprPort = "3500"
}
res, err := newResource()
if err != nil {
panic(err)
Expand Down
16 changes: 9 additions & 7 deletions dapr-distributed-calendar/test.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/bin/bash

ENDPOINT="${ENDPOINT:-localhost}"
PORT="${PORT:-3000}"

echo Endpoint: $ENDPOINT
echo Port: $PORT

# Get event 1 (should fail)
echo 'Get event 1 (should fail)'
curl --location 'http://'$ENDPOINT':3000/event/1' | jq
curl --location 'http://'$ENDPOINT':'$PORT'/event/1' | jq

# Create event 1
echo 'Create event 1'
curl --location 'http://'$ENDPOINT':3000/newevent' \
curl --location 'http://'$ENDPOINT':'$PORT'/newevent' \
--header 'Content-Type: application/json' \
--data '{
"data": {
Expand All @@ -22,7 +24,7 @@ curl --location 'http://'$ENDPOINT':3000/newevent' \

# Create event 1 again (should fail)
echo 'Create event 1 again (should fail)'
curl --location 'http://'$ENDPOINT':3000/newevent' \
curl --location 'http://'$ENDPOINT':'$PORT'/newevent' \
--header 'Content-Type: application/json' \
--data '{
"data": {
Expand All @@ -34,11 +36,11 @@ curl --location 'http://'$ENDPOINT':3000/newevent' \

# Get event 1
echo 'Get event 1'
curl --location 'http://'$ENDPOINT':3000/event/1' | jq
curl --location 'http://'$ENDPOINT':'$PORT'/event/1' | jq

# Update event 1
echo 'Update event 1'
curl --location --request PUT 'http://'$ENDPOINT':3000/updateevent/1' \
curl --location --request PUT 'http://'$ENDPOINT':'$PORT'/updateevent/1' \
--header 'Content-Type: application/json' \
--data '{
"data": {
Expand All @@ -49,12 +51,12 @@ curl --location --request PUT 'http://'$ENDPOINT':3000/updateevent/1' \

# Get updated event 1
echo 'Get updated event 1'
curl --location 'http://'$ENDPOINT':3000/event/1' | jq
curl --location 'http://'$ENDPOINT':'$PORT'/event/1' | jq

# Delete event 1
echo 'Delete event 1'
curl --location --request DELETE 'http://'$ENDPOINT':3000/event/1' | jq

# Delete event 1 again (should fail)
echo 'Delete event 1 again (should fail)'
curl --location --request DELETE 'http://'$ENDPOINT':3000/event/1' | jq
curl --location --request DELETE 'http://'$ENDPOINT':'$PORT'/event/1' | jq
20 changes: 20 additions & 0 deletions dapr-distributed-calendar/traefik/traefik-dashboard-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: traefik-ingress
namespace: kube-system
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: traefik.<ENV-NAME>-<ENV-USER-ID>-01.<ENV-ANIMAL>.<ENV-DOMAIN>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: traefik-dashboard
port:
number: 9000
18 changes: 18 additions & 0 deletions dapr-distributed-calendar/traefik/traefik-dashboard-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: traefik-dashboard
namespace: kube-system
labels:
app.kubernetes.io/instance: traefik-dashboard-kube-system
app.kubernetes.io/name: traefik-dashboard
spec:
type: ClusterIP
ports:
- name: traefik
port: 9000
targetPort: traefik
protocol: TCP
selector:
app.kubernetes.io/instance: traefik-kube-system
app.kubernetes.io/name: traefik

0 comments on commit 3591bd8

Please sign in to comment.