Skip to content

Commit

Permalink
Fix resource gateway (#185)
Browse files Browse the repository at this point in the history
* chore(): adding gateway examples

* fix(): updating resource gateway. renew watch.

* fix(): adding informer factory to watch updates

* fix(): adding informer factory to watch updates

* fix(): renewing watch in resource gateway

* fix(): update example

* fix(): update makefile

* fix(): fix calendar gateway bug
  • Loading branch information
VaibhavPage authored and magaldima committed Feb 27, 2019
1 parent d5c4871 commit 3eee3c9
Show file tree
Hide file tree
Showing 11 changed files with 1,425 additions and 83 deletions.
1,157 changes: 1,157 additions & 0 deletions Gopkg.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ override LDFLAGS += \
# docker image publishing options
DOCKER_PUSH?=true
IMAGE_NAMESPACE?=argoproj
IMAGE_TAG?=v0.7
IMAGE_TAG?=v0.8

ifeq (${DOCKER_PUSH},true)
ifndef IMAGE_NAMESPACE
Expand Down
17 changes: 17 additions & 0 deletions examples/gateways/aws-sns-gateway-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# For more information, https://github.com/argoproj/argo-events/blob/e0242e7b00f7edc7e0cff314abd3a728ddf3c62b/gateways/community/aws-sns/config.go#L68
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-sns-gateway-configmap
data:
notification_1: |-
topicArn: "topic-arn"
endpoint: "/"
port: "9600"
accessKey:
name: aws-secret
key: access
secretKey:
name aws-secret
key: secret
region: "us-east-1"
35 changes: 35 additions & 0 deletions examples/gateways/aws-sns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: argoproj.io/v1alpha1
kind: Gateway
metadata:
name: aws-sns-gateway
labels:
gateways.argoproj.io/gateway-controller-instanceid: argo-events
gateway-name: "aws-sns-gateway"
spec:
processorPort: "9330"
eventProtocol:
type: "HTTP"
http:
port: "9300"
deploySpec:
metadata:
name: "aws-sns-gateway"
labels:
gateway-name: "aws-sns-gateway"
spec:
containers:
- name: "gateway-client"
image: "argoproj/gateway-client"
imagePullPolicy: "Always"
command: ["/bin/gateway-client"]
- name: "aws-sns-events"
image: "argoproj/aws-sns-gateway"
imagePullPolicy: "Always"
command: ["/bin/aws-sns-gateway"]
serviceAccountName: "argo-events-sa"
configMap: "aws-sns-gateway-configmap"
eventVersion: "1.0"
type: "aws-sns"
watchers:
sensors:
- name: "aws-sns-sensor"
5 changes: 3 additions & 2 deletions examples/gateways/resource-gateway-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# For more information, https://github.com/argoproj/argo-events/blob/e0242e7b00f7edc7e0cff314abd3a728ddf3c62b/gateways/core/resource/config.go#L34
apiVersion: v1
kind: ConfigMap
metadata:
name: resource-gateway-configmap
data:
foo: |-
workflow-success: |-
namespace: argo-events
group: "argoproj.io"
version: "v1alpha1"
Expand All @@ -12,7 +13,7 @@ data:
labels:
workflows.argoproj.io/phase: Succeeded
name: "my-workflow"
bar: |-
namespace: |-
namespace: argo-events
group: "k8s.io"
version: "v1"
Expand Down
2 changes: 1 addition & 1 deletion examples/sensors/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
http:
port: "9300"
dependencies:
- name: "resource-gateway:foo"
- name: "resource-gateway:workflow-success"
triggers:
- name: argo-workflow
resource:
Expand Down
85 changes: 85 additions & 0 deletions examples/sensors/webhook-http-boolean.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# The dependency grouping and selective workflow trigger execution is not supported in latest release
# This feature will be released in next release v0.8.
# You can try this example with sensor and sensor controller image v0.7.1
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: webhook-sensor-http-boolean-op
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
deploySpec:
containers:
- name: "sensor"
image: "argoproj/sensor"
imagePullPolicy: Always
serviceAccountName: argo-events-sa
# defines list of all events sensor will accept
dependencies:
- name: "webhook-gateway-http:foo"
- name: "webhook-gateway-http:index"
# divides event dependencies into groups
dependencyGroups:
- name: "group_1"
dependencies:
- "webhook-gateway-http:foo"
- name: "group_2"
dependencies:
- "webhook-gateway-http:index"
# either "webhook-gateway-http:foo" or "webhook-gateway-http:index" happens
circuit: "group_1 || group_2"
eventProtocol:
type: "HTTP"
http:
port: "9300"
triggers:
- name: webhook-workflow-trigger
when:
all:
- "group_1"
resource:
namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
source:
inline: |
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-
spec:
entrypoint: whalesay
templates:
- name: whalesay
container:
args:
- "hello world"
command:
- cowsay
image: "docker/whalesay:latest"
- name: webhook-workflow-trigger-2
when:
all:
- "group_2"
resource:
namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
source:
inline: |
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-2-
spec:
entrypoint: whalesay
templates:
- name: whalesay
container:
args:
- "hello world"
command:
- cowsay
image: "docker/whalesay:latest"
4 changes: 2 additions & 2 deletions gateways/community/aws-sns/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM scratch
COPY dist/sns-gateway /bin/
ENTRYPOINT [ "/bin/sns-gateway" ]
COPY dist/aws-sns-gateway /bin/
ENTRYPOINT [ "/bin/aws-sns-gateway" ]
3 changes: 2 additions & 1 deletion gateways/core/calendar/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ func (ese *CalendarEventSourceExecutor) listenEvents(cal *calSchedule, eventSour
for {
t := next(lastT)
timer := time.After(time.Until(t))
ese.Log.Info().Str("event-source-name", eventSource.Name).Str("time", t.String()).Msg("expected next calendar event")
ese.Log.Info().Str("event-source-name", eventSource.Name).Str("time", t.UTC().String()).Msg("expected next calendar event")
select {
case tx := <-timer:
lastT = tx
response := &calResponse{
EventTime: tx,
UserPayload: cal.UserPayload,
Expand Down
2 changes: 1 addition & 1 deletion gateways/core/resource/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM centos:7
FROM scratch
COPY dist/resource-gateway /bin/
ENTRYPOINT [ "/bin/resource-gateway" ]

0 comments on commit 3eee3c9

Please sign in to comment.