Skip to content

Commit

Permalink
feat: implement webhooks-processor scaling (#161)
Browse files Browse the repository at this point in the history
* feat: implement webhooks-processor scaling

* refactor: webhooks-processor ressource
  • Loading branch information
42atomys authored Jul 1, 2022
1 parent d914c47 commit 90a78fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
7 changes: 5 additions & 2 deletions deploy/app/webhooks-processor/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ spec:
mountPath: /config
readOnly: true
resources:
requests:
cpu: 20m
memory: 10Mi
limits:
memory: "42Mi"
cpu: "200m"
memory: "20Mi"
cpu: "30m"
volumes:
- name: config
configMap:
Expand Down
20 changes: 13 additions & 7 deletions internal/webhooks/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package webhooks
import (
"context"
"encoding/json"
"os"

"github.com/rs/zerolog/log"
"github.com/streadway/amqp"
Expand Down Expand Up @@ -46,14 +47,19 @@ func (p *processor) Serve(amqpUrl, channel string) error {
return err
}

consumerID := "webhooks-processor"
if os.Getenv("POD_IP") != "" {
consumerID = "webhooks-processor-" + os.Getenv("POD_IP")
}

msgs, err := ch.Consume(
channel, // queue
"webhooks-processor", // consumer
false, // auto-ack
false, // exclusive
false, // no-local
false, // no-wait
nil, // args
channel, // queue
consumerID, // consumer
false, // auto-ack
false, // exclusive
false, // no-local
false, // no-wait
nil, // args
)
if err != nil {
return err
Expand Down

0 comments on commit 90a78fb

Please sign in to comment.