Skip to content

Commit

Permalink
fix gcp-pubsub-gateway (#270)
Browse files Browse the repository at this point in the history
* Add root certificates in gcp-pubsub Dockerfile.

* Add value of event source id to EventSource.
  • Loading branch information
locona authored and VaibhavPage committed Apr 17, 2019
1 parent 9122d50 commit 68bbdd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gateways/community/gcp-pubsub/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
FROM alpine:3.9 as alpine
RUN apk add -U --no-cache ca-certificates

FROM scratch
COPY dist/gcp-pubsub-gateway /bin/
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT [ "/bin/gcp-pubsub-gateway" ]
6 changes: 4 additions & 2 deletions gateways/community/gcp-pubsub/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ limitations under the License.
package pubsub

import (
"cloud.google.com/go/pubsub"
"context"
"fmt"

"cloud.google.com/go/pubsub"
"github.com/argoproj/argo-events/gateways"
"google.golang.org/api/option"
)
Expand Down Expand Up @@ -66,7 +68,7 @@ func (ese *GcpPubSubEventSourceExecutor) listenEvents(ctx context.Context, sc *p
}

logger.Info("subscribing to GCP PubSub topic")
sub, err := client.CreateSubscription(ctx, eventSource.Id,
sub, err := client.CreateSubscription(ctx, fmt.Sprintf("%v-%v", eventSource.Name, eventSource.Id),
pubsub.SubscriptionConfig{Topic: topic})
if err != nil {
errorCh <- err
Expand Down
2 changes: 2 additions & 0 deletions gateways/event-sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (gc *GatewayConfig) startEventSources(eventSources map[string]*EventSourceC
if valid, _ := eventSource.Client.ValidateEventSource(eventSource.Ctx, &EventSource{
Data: eventSource.Data.Config,
Name: eventSource.Data.Src,
Id: eventSource.Data.ID,
}); !valid.IsValid {
gc.Log.WithFields(
map[string]interface{}{
Expand Down Expand Up @@ -185,6 +186,7 @@ func (gc *GatewayConfig) startEventSources(eventSources map[string]*EventSourceC
eventStream, err := eventSource.Client.StartEventSource(eventSource.Ctx, &EventSource{
Name: eventSource.Data.Src,
Data: eventSource.Data.Config,
Id: eventSource.Data.ID,
})
if err != nil {
gc.Log.WithError(err).Error("error occurred while starting event source")
Expand Down

0 comments on commit 68bbdd4

Please sign in to comment.