Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Dec 9, 2024
1 parent 74cbf90 commit 4a83c29
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/http/pub/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pub
import (
"github.com/awakari/pub/api/grpc/events"
"github.com/awakari/pub/api/grpc/publisher"
grpc2 "github.com/awakari/pub/api/http/grpc"
"github.com/awakari/pub/api/http/grpc"
"github.com/awakari/pub/config"
"github.com/awakari/pub/model"
"github.com/cloudevents/sdk-go/binding/format/protobuf/v2/pb"
Expand Down Expand Up @@ -68,7 +68,7 @@ func (h handler) WriteInternal(ctx *gin.Context) {
}

func (h handler) write(ctx *gin.Context, evt *pb.CloudEvent, internal bool) {
grpcCtx, groupId, userId := grpc2.AuthRequestContext(ctx)
grpcCtx, groupId, userId := grpc.AuthRequestContext(ctx)
conn, err := h.connPoolEvts.Get(ctx)
var streamClient events.Service_PublishClient
if err == nil {
Expand Down Expand Up @@ -112,5 +112,5 @@ func (h handler) write(ctx *gin.Context, evt *pb.CloudEvent, internal bool) {
if err == nil && resp.AckCount == 0 {
err = status.Error(codes.Unavailable, "was unable to submit, retry later")
}
grpc2.RespondJson(ctx, resp, err)
grpc.RespondJson(ctx, resp, err)
}
4 changes: 4 additions & 0 deletions helm/pub/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ metadata:
nginx.ingress.kubernetes.io/limit-rps: "{{ .Values.ingress.limit.rate.second }}"
nginx.ingress.kubernetes.io/limit-rpm: "{{ .Values.ingress.limit.rate.second }}"
nginx.ingress.kubernetes.io/limit-connections: "{{ .Values.ingress.limit.connections }}"
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-origin: "{{ .Values.ingress.corsAllowOrigin }}"
nginx.ingress.kubernetes.io/cors-allow-methods: "HEAD, OPTIONS, GET, POST, DELETE"
nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Awakari-Group-Id,X-Awakari-User-Id,X-Awakari-Src-Addr"
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
Expand Down
1 change: 1 addition & 0 deletions helm/pub/values-awakari-com.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ingress:
corsAllowOrigin: "https://awakari.com"
hosts:
- host: pub.awakari.com
paths:
Expand Down
1 change: 1 addition & 0 deletions helm/pub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ service:

ingress:
enabled: true
corsAllowOrigin: "https://awakari.com"
# limits are per source IP address
limit:
connections: 1000
Expand Down

0 comments on commit 4a83c29

Please sign in to comment.