diff --git a/dapr-distributed-calendar/go/go_events.go b/dapr-distributed-calendar/go/go_events.go index 49fce12..a517ce4 100644 --- a/dapr-distributed-calendar/go/go_events.go +++ b/dapr-distributed-calendar/go/go_events.go @@ -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` @@ -270,6 +270,9 @@ func checkEvent(id string) ([]byte, error) { } func main() { + if daprPort == "" { + daprPort = "3500" + } res, err := newResource() if err != nil { panic(err) diff --git a/dapr-distributed-calendar/test.sh b/dapr-distributed-calendar/test.sh index f64f319..c1f3eb2 100755 --- a/dapr-distributed-calendar/test.sh +++ b/dapr-distributed-calendar/test.sh @@ -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": { @@ -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": { @@ -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": { @@ -49,7 +51,7 @@ 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' @@ -57,4 +59,4 @@ 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 \ No newline at end of file +curl --location --request DELETE 'http://'$ENDPOINT':'$PORT'/event/1' | jq \ No newline at end of file diff --git a/dapr-distributed-calendar/traefik/traefik-dashboard-ingress.yaml b/dapr-distributed-calendar/traefik/traefik-dashboard-ingress.yaml new file mode 100644 index 0000000..a097e93 --- /dev/null +++ b/dapr-distributed-calendar/traefik/traefik-dashboard-ingress.yaml @@ -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.--01.. + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: traefik-dashboard + port: + number: 9000 diff --git a/dapr-distributed-calendar/traefik/traefik-dashboard-service.yaml b/dapr-distributed-calendar/traefik/traefik-dashboard-service.yaml new file mode 100644 index 0000000..d71c2d0 --- /dev/null +++ b/dapr-distributed-calendar/traefik/traefik-dashboard-service.yaml @@ -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 \ No newline at end of file