diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bf52cc98ab..29cf610c82 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -40,7 +40,7 @@ minikube start
eval $(minikube docker-env)
```
-#### 5. Build the project & Docker images
+#### 5. Build the project
```
make all
```
diff --git a/Makefile b/Makefile
index e36663bc35..9c23e42571 100644
--- a/Makefile
+++ b/Makefile
@@ -35,13 +35,13 @@ endif
# Build the project images
.DELETE_ON_ERROR:
-all: sensor-linux sensor-controller-linux gateway-controller-linux gateway-transformer-linux webhook-linux calendar-linux artifact-linux nats-linux kafka-linux amqp-linux mqtt-linux
+all: sensor-linux sensor-controller-linux gateway-controller-linux gateway-http-transformer-linux webhook-linux calendar-linux resource-linux artifact-linux nats-linux kafka-linux amqp-linux mqtt-linux gateway-processor-grpc-client-linux calendar-grpc-linux gateway-processor-http-client-linux calendar-http-linux
-all-images: sensor-image sensor-controller-image gateway-controller-image gateway-http-transformer-image webhook-image calendar-image artifact-image nats-image kafka-image amqp-image mqtt-image gateway-processor-grpc-client-image calendar-grpc-image gateway-processor-http-client-image calendar-http-image
+all-images: sensor-image sensor-controller-image gateway-controller-image gateway-http-transformer-image webhook-image calendar-image resource-image artifact-image nats-image kafka-image amqp-image mqtt-image gateway-processor-grpc-client-image calendar-grpc-image gateway-processor-http-client-image calendar-http-image
all-controller-images: sensor-controller-image gateway-controller-image
-all-gateway-images: webhook-image calendar-image artifact-image nats-image kafka-image amqp-image mqtt-image
+all-core-gateway-images: webhook-image calendar-image artifact-image nats-image kafka-image amqp-image mqtt-image resource-image
.PHONY: all clean test
@@ -115,6 +115,18 @@ calendar-image: calendar-linux
@if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)calendar-gateway:$(IMAGE_TAG) ; fi
+resource:
+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/resource-gateway ./gateways/core/resource/
+
+resource-linux:
+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make resource
+
+resource-image: resource-linux
+ docker build -t $(IMAGE_PREFIX)resource-gateway:$(IMAGE_TAG) -f ./gateways/core/resource/Dockerfile .
+ @if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)resource-gateway:$(IMAGE_TAG) ; fi
+
+
+
artifact:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/artifact-gateway ./gateways/core/artifact/
diff --git a/README.md b/README.md
index 78cd414509..c969b363ac 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Argo Events is an open source event-based dependency manager for Kubernetes. The
- Runtime agnostic. The first runtime and package agnostic event framework for Kubernetes.
- Containers. Designed from the ground-up as Kubernetes-native.
- Extremely lightweight. All gateways, with the exception of calendar-based gateways, are event-driven, meaning that there is no polling involved.
-- Configurable. Select gateways you want to support, deploy those to Kubernetes and configure them on the fly
+- Configurable. Configure gateways at runtime
- Scalable & Resilient.
- Simple or Complex dependencies. Manage everything from simple, linear, real-time dependencies to complex, multi-source, batch job dependencies.
diff --git a/cmd/controllers/gateway/main.go b/cmd/controllers/gateway/main.go
index 42b88f758f..186e7492d2 100644
--- a/cmd/controllers/gateway/main.go
+++ b/cmd/controllers/gateway/main.go
@@ -23,7 +23,7 @@ func main() {
namespace, ok := os.LookupEnv(common.GatewayNamespace)
if !ok {
- namespace = common.DefaultGatewayControllerNamespace
+ namespace = common.DefaultControllerNamespace
}
// create new gateway controller
diff --git a/cmd/controllers/sensor/main.go b/cmd/controllers/sensor/main.go
index e002cc9f75..8a04e36d74 100644
--- a/cmd/controllers/sensor/main.go
+++ b/cmd/controllers/sensor/main.go
@@ -39,7 +39,7 @@ func main() {
namespace, ok := os.LookupEnv(common.SensorNamespace)
if !ok {
- namespace = common.DefaultGatewayControllerNamespace
+ namespace = common.DefaultControllerNamespace
}
// create a new sensor controller
diff --git a/common/common.go b/common/common.go
index 334b8b6b11..4ae3eb30e7 100644
--- a/common/common.go
+++ b/common/common.go
@@ -40,6 +40,9 @@ const (
// StandardTimeFormat is time format reference for golang
StandardTimeFormat = "2006-01-02 15:04:05"
+
+ // StandardYYYYMMDDFormat formats date in yyyy-mm-dd format
+ StandardYYYYMMDDFormat = "2006-01-02"
)
// SENSOR CONTROLLER CONSTANTS
diff --git a/common/namespace.go b/common/namespace.go
index 12fcf73a14..4d9b972083 100644
--- a/common/namespace.go
+++ b/common/namespace.go
@@ -25,15 +25,11 @@ import (
const namespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
var (
- // DefaultSensorControllerNamespace is the default namespace where the sensor sensor-controller is installed
- DefaultSensorControllerNamespace = "argo-events"
-
- // Todo: Does this even have to be separate
- // DefaultGatewayControllerNamespace is the default namespace where the sensor sensor-controller is installed
- DefaultGatewayControllerNamespace = "argo-events"
+ // DefaultControllerNamespace is the default namespace where the sensor and gateways controllers are installed
+ DefaultControllerNamespace = "argo-events"
// ErrReadNamespace occurs when the namespace cannot be read from a Kubernetes pod's service account token
- ErrReadNamespace = errors.New("Could not read namespace from service account secret")
+ ErrReadNamespace = errors.New("could not read namespace from service account secret")
)
func init() {
@@ -61,16 +57,16 @@ func RefreshNamespace() {
// 1 - env variable
nm, ok := os.LookupEnv(EnvVarNamespace)
if ok {
- DefaultSensorControllerNamespace = nm
+ DefaultControllerNamespace = nm
return
}
// 2 - pod service account token
nm, err := detectNamespace()
if err == nil {
- DefaultSensorControllerNamespace = nm
+ DefaultControllerNamespace = nm
}
- // 3 - use the DefaultSensorControllerNamespace
+ // 3 - use the DefaultControllerNamespace
return
}
diff --git a/common/namespace_test.go b/common/namespace_test.go
index 2f7e55d395..3580cab716 100644
--- a/common/namespace_test.go
+++ b/common/namespace_test.go
@@ -25,8 +25,7 @@ import (
func TestResolveNamespace(t *testing.T) {
defer os.Unsetenv(EnvVarNamespace)
- RefreshNamespace()
- assert.Equal(t, "argo-events", DefaultSensorControllerNamespace)
+ assert.Equal(t, "argo-events", DefaultControllerNamespace)
// TODO: now write the namespace file
@@ -37,5 +36,5 @@ func TestResolveNamespace(t *testing.T) {
}
RefreshNamespace()
- assert.Equal(t, "test", DefaultSensorControllerNamespace)
+ assert.Equal(t, "test", DefaultControllerNamespace)
}
diff --git a/controllers/gateway/config.go b/controllers/gateway/config.go
index c4334cd518..c3a10af061 100644
--- a/controllers/gateway/config.go
+++ b/controllers/gateway/config.go
@@ -98,7 +98,7 @@ func (c *GatewayController) updateConfig(cm *apiv1.ConfigMap) error {
return err
}
if config.Namespace == "" {
- config.Namespace = common.DefaultGatewayControllerNamespace
+ config.Namespace = common.DefaultControllerNamespace
}
c.Config = config
return nil
diff --git a/controllers/gateway/config_test.go b/controllers/gateway/config_test.go
index bc7bf0ee58..e74c8bc202 100644
--- a/controllers/gateway/config_test.go
+++ b/controllers/gateway/config_test.go
@@ -56,5 +56,5 @@ func TestGatewayController_ResyncConfig(t *testing.T) {
assert.NotNil(t, cm)
assert.NotNil(t, gc.Config)
assert.NotEqual(t, gc.Config.Namespace, gc.ConfigMapNS)
- assert.Equal(t, gc.Config.Namespace, common.DefaultGatewayControllerNamespace)
+ assert.Equal(t, gc.Config.Namespace, common.DefaultControllerNamespace)
}
diff --git a/controllers/sensor/config.go b/controllers/sensor/config.go
index ee33893f9b..2a91579b39 100644
--- a/controllers/sensor/config.go
+++ b/controllers/sensor/config.go
@@ -114,7 +114,7 @@ func (c *SensorController) updateConfig(cm *apiv1.ConfigMap) error {
return err
}
if config.Namespace == "" {
- config.Namespace = common.DefaultSensorControllerNamespace
+ config.Namespace = common.DefaultControllerNamespace
}
c.Config = config
return nil
diff --git a/controllers/sensor/controller.go b/controllers/sensor/controller.go
index e07bdf0b2b..300f8ac50e 100644
--- a/controllers/sensor/controller.go
+++ b/controllers/sensor/controller.go
@@ -20,20 +20,18 @@ import (
"context"
"errors"
"time"
-
+ "fmt"
+ "log"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
-
base "github.com/argoproj/argo-events"
"github.com/argoproj/argo-events/common"
"github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1"
sensorclientset "github.com/argoproj/argo-events/pkg/client/sensor/clientset/versioned"
- "fmt"
- "log"
)
const (
diff --git a/controllers/sensor/notification-handler.go b/controllers/sensor/notification-handler.go
index 113159ee03..e4be64983e 100644
--- a/controllers/sensor/notification-handler.go
+++ b/controllers/sensor/notification-handler.go
@@ -166,7 +166,6 @@ func (se *sensorExecutionCtx) processSignal(gwEventWrapper *sensorEventWrapper)
// apply filters if any.
// error is thrown if some problem occurs during filtering the signal
- // apply filters if any
ok, err := se.filterEvent(gwEventWrapper.signal.Filters, gwEventWrapper.event)
if err != nil {
se.log.Error().Err(err).Str("signal-name", gwEventWrapper.event.Context.Source.Host).Err(err).Msg("failed to apply filter")
diff --git a/controllers/sensor/signal-filter.go b/controllers/sensor/signal-filter.go
index 2e01e54593..186c0844f7 100644
--- a/controllers/sensor/signal-filter.go
+++ b/controllers/sensor/signal-filter.go
@@ -91,13 +91,9 @@ func (se *sensorExecutionCtx) filterTime(timeFilter *v1alpha1.TimeFilter, eventT
if timeFilter != nil {
se.log.Info().Str("event-time", eventTime.String()).Msg("event time")
currentT := time.Now().UTC()
- se.log.Info().Str("current-time", currentT.String()).Msg("current time")
- currentMonth := fmt.Sprintf("%d", int(currentT.Month()))
- if int(currentT.Month()) < 10 {
- currentMonth = "0" + currentMonth
- }
- currentTStr := fmt.Sprintf("%d-%s-%d", currentT.Year(), currentMonth, currentT.Day())
-
+ currentT = time.Date(currentT.Year(), currentT.Month(), currentT.Day(), 0, 0, 0, 0, time.UTC)
+ currentTStr := currentT.Format(common.StandardYYYYMMDDFormat)
+ se.log.Info().Str("date", currentTStr).Msg("current date")
if timeFilter.Start != "" && timeFilter.Stop != "" {
se.log.Info().Str("start time format", currentTStr+" "+timeFilter.Start).Msg("start time format")
startTime, err := time.Parse(common.StandardTimeFormat, currentTStr+" "+timeFilter.Start)
diff --git a/controllers/sensor/signal-filter_test.go b/controllers/sensor/signal-filter_test.go
index 26783be7f7..756e4a85b8 100644
--- a/controllers/sensor/signal-filter_test.go
+++ b/controllers/sensor/signal-filter_test.go
@@ -16,7 +16,6 @@ limitations under the License.
package sensor
import (
- "fmt"
"github.com/argoproj/argo-events/common"
"github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1"
"github.com/stretchr/testify/assert"
@@ -36,12 +35,10 @@ func Test_filterTime(t *testing.T) {
Start: "10:11:00",
}
event := getCloudEvent()
+
currentT := time.Now().UTC()
- currentMonth := fmt.Sprintf("%d", int(currentT.Month()))
- if int(currentT.Month()) < 10 {
- currentMonth = "0" + currentMonth
- }
- currentTStr := fmt.Sprintf("%d-%s-%d", currentT.Year(), currentMonth, currentT.Day())
+ currentT = time.Date(currentT.Year(), currentT.Month(), currentT.Day(), 0, 0, 0, 0, time.UTC)
+ currentTStr := currentT.Format(common.StandardYYYYMMDDFormat)
parsedTime, err := time.Parse(common.StandardTimeFormat, currentTStr+" 16:36:34")
assert.Nil(t, err)
event.Context.EventTime = metav1.MicroTime{
diff --git a/controllers/sensor/trigger-params.go b/controllers/sensor/trigger-params.go
index 54eb9ab97f..2a5fca47b5 100644
--- a/controllers/sensor/trigger-params.go
+++ b/controllers/sensor/trigger-params.go
@@ -55,6 +55,10 @@ func resolveParamValue(src *v1alpha1.ResourceParameterSource, events map[string]
}
return "", err
}
+ // check if complete payload needs to be passed to the trigger
+ if src.Path == "" {
+ return string(js), nil
+ }
res := gjson.GetBytes(js, src.Path)
if res.Exists() {
return res.String(), nil
diff --git a/controllers/sensor/validate.go b/controllers/sensor/validate.go
index 7aea03fc33..2789bbb451 100644
--- a/controllers/sensor/validate.go
+++ b/controllers/sensor/validate.go
@@ -22,7 +22,6 @@ import (
"github.com/argoproj/argo-events/common"
"github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ValidateSensor accepts a sensor and performs validation against it
@@ -83,8 +82,9 @@ func validateSignalFilter(filter v1alpha1.SignalFilter) error {
}
func validateSignalTimeFilter(tFilter *v1alpha1.TimeFilter) error {
- currentT := metav1.Time{Time: time.Now().UTC()}
- currentTStr := fmt.Sprintf("%d-%d-%d", currentT.Year(), int(currentT.Month()), currentT.Day())
+ currentT := time.Now().UTC()
+ currentT = time.Date(currentT.Year(), currentT.Month(), currentT.Day(), 0, 0, 0, 0, time.UTC)
+ currentTStr := currentT.Format(common.StandardYYYYMMDDFormat)
if tFilter.Start != "" && tFilter.Stop != "" {
startTime, err := time.Parse(common.StandardTimeFormat, currentTStr+" "+tFilter.Start)
if err != nil {
@@ -104,7 +104,7 @@ func validateSignalTimeFilter(tFilter *v1alpha1.TimeFilter) error {
return err
}
stopTime = stopTime.UTC()
- if stopTime.Before(currentT.Time) {
+ if stopTime.Before(currentT.UTC()) {
return fmt.Errorf("invalid signal time filter: stop '%s' is before the current time '%s'", tFilter.Stop, currentT)
}
}
diff --git a/docs/artifact-guide.md b/docs/artifact-guide.md
index 0a6a34131e..c01e620e47 100644
--- a/docs/artifact-guide.md
+++ b/docs/artifact-guide.md
@@ -1,7 +1,5 @@
# Artifact Guide
-This is a guide for help in utilizing artifacts within Argo Events. Sensors use artifacts for two purposes:
-1. Object notifications for use in `Artifact` signals. (currently S3 bucket notifications are only supported)
-2. A Resource Object store for use in `Resource` triggers
+This is a guide for help in utilizing artifacts within Argo Events. Sensors use artifacts for Resource Object store for use in `Resource` triggers
## Inline
Inlined artifacts are included directly within the sensor resource and decoded as a string.
diff --git a/docs/custom-gateway.md b/docs/custom-gateway.md
index 5507f64b0d..129c10e0e4 100644
--- a/docs/custom-gateway.md
+++ b/docs/custom-gateway.md
@@ -11,7 +11,7 @@ Difference between first three options and fourth is that in options 1,2 and 3,
to watch configuration updates, start/stop a configuration dynamically. In option 4, its up to
user to watch configuration updates and take actions.
-##### Below are the environment variables provided to all kinds of gateways
+ Below are the environment variables provided to all types of gateways
| Field | Description |
|----------------------|--------------|
@@ -23,15 +23,13 @@ user to watch configuration updates and take actions.
| GATEWAY_CONTROLLER_NAME | Contains name of gateway controller |
## Core Gateway Style
-It is the most straightforward option. The gateway consists of two components,
+The most straightforward option. The gateway consists of two components,
1. Gateway Processor: either generates events internally or listens for external events and then
passes those events to gateway-transformer
2. Gateway Transformer: transforms incoming events into cloudevents specification compliant events
-and dispatches them to interested sensors.
-
-* gateway-processor can be exposed via a service using gateway's `serviceSpec`
+and dispatches them to watchers.
![](core-gateway-style.png)
@@ -58,40 +56,6 @@ type ConfigData struct {
}
```
-Lets's look at excerpt from NATS gateway's RunConfiguration implementation
-
-```go
- var wg sync.WaitGroup
- wg.Add(1)
-
- // waits till stop signal.
- go func() {
- <-config.StopCh
- n.gatewayConfig.Log.Info().Str("config", config.Src).Msg("stopping the configuration...")
- n.gatewayConfig.Log.Info().Str("config-key", config.Src).Msg("client disconnected. stopping the configuration...")
- wg.Done()
- }()
-
- n.gatewayConfig.Log.Info().Str("config-name", config.Src).Msg("running...")
- config.Active = true
-
- sub, err := conn.Subscribe(s.Attributes[subjectKey], func(msg *natsio.Msg) {
- n.gatewayConfig.Log.Info().Str("config-key", config.Src).Msg("dispatching event to gateway-processor")
- n.gatewayConfig.DispatchEvent(msg.Data, config.Src)
- })
- if err != nil {
- n.gatewayConfig.Log.Error().Str("url", s.URL).Str("subject", s.Attributes[subjectKey]).Err(err).Msg("failed to subscribe to subject")
- } else {
- n.gatewayConfig.Log.Info().Str("config-key", config.Src).Msg("running...")
- }
-
- wg.Wait()
-```
-
-First we create a wait-group and wait for stop signal. We mark configuration as active, subscribe to subject
-and listens to incoming messages. As soon as message is consumed, we dispatch the event to framwork code
-which takes further actions.
-
GatewayConfig contains generic configuration for a gateway
```go
type GatewayConfig struct {
@@ -108,13 +72,12 @@ type GatewayConfig struct {
}
```
-* To send events back to framework code for further processing, use
+* To send events back to framework for further processing, use
```go
gatewayConfig.DispatchEvent(event []byte, src string) error
```
-
-For detailed implementation, check core gateways [Core Gateways](https://github.com/argoproj/argo-events/tree/eventing/gateways/core)
+For detailed implementation, check out [Core Gateways](https://github.com/argoproj/argo-events/tree/eventing/gateways/core)
## gRPC gateway
A gRPC gateway has 3 components,
@@ -124,19 +87,19 @@ external events and streams them back to gateway-processor-client
2. Gateway Processor Client - gRPC client provided by framework that connects to gateway processor server.
3. Gateway Transformer: transforms incoming events into cloudevents specification compliant events
- and dispatches them to interested sensors.
+ and dispatches them to interested watchers.
### Architecture
![](grpc-gateway.png)
-To implement gateway processor server, you will need to implement
+To implement gateway processor server, you will need to implement
```proto
RunGateway(GatewayConfig) returns (stream Event)
```
-`RunGateway` method takes an gateway configuration and sends events over a stream.
+`RunGateway` method takes a gateway configuration and sends events over a stream.
-The gateway processor client opens a new connection for each gateway configuration and start listening to
-events on the stream.
+The gateway processor client opens a new connection for each gateway configuration and starts listening to
+events on a stream.
For detailed implementation, check out [Calendar gRPC gateway](https://github.com/argoproj/argo-events/tree/eventing/gateways/grpc/calendar)
@@ -156,7 +119,7 @@ a new configuration or `/stop` endpoint to stop a configuration. Processor clien
running internally listening for events from gateway-processor-server.
3. Gateway Transformer: transforms incoming events into cloudevents specification compliant events
- and dispatches them to interested sensors.
+ and dispatches them to watchers.
### Architecture
@@ -175,11 +138,8 @@ List of environment variables available to user code
For detailed implementation, check out [Calendar HTTP gateway](https://github.com/argoproj/argo-events/tree/eventing/gateways/rest/calendar)
-###### Advantage of writing a gRPC or http gateway is that you can use other languages for implementation of gateway processor server.
-
-
-## No framework gateway code
-The third option is you provide gateway implementation from scratch, watch the configuration
+## Framework independent
+The fourth option is you provide gateway implementation from scratch: watch the configuration
updates, start/stop configuration if needed. Only requirement is that events must be
dispatched to gateway-transformer using HTTP post request. The port to dispatch the request
is made available through environment variable `TRANSFORMER_PORT`.
@@ -194,4 +154,4 @@ List of environment variables available to user code
| GATEWAY_NAME | Gateway name |
### Gateway Examples
-* Example gateways are available at [gateway examples](https://github.com/argoproj/argo-events/tree/eventing/examples/gateways)
\ No newline at end of file
+* Example gateway definitions are available at [here](https://github.com/argoproj/argo-events/tree/eventing/examples/gateways)
\ No newline at end of file
diff --git a/docs/gateway-guide.md b/docs/gateway-guide.md
index 80428b7f7d..c3670113ab 100644
--- a/docs/gateway-guide.md
+++ b/docs/gateway-guide.md
@@ -2,16 +2,18 @@
## What is a gateway?
A gateway is a long running/repeatable process whose tasks are to process and transform either the internally produced events or
-incoming events into the cloudevents specification compliant events and dispatching them to sensors.
+external events into the [cloudevents specification](https://github.com/cloudevents/spec) compliant events and dispatch them to watchers(sensors and/or gateways).
## Gateway Components
A gateway has two components:
- 1. gateway-processor: Either generates the events internally or listens to incoming events. It then passes the events to gateway-transformer.
- The implementation of gateway-processor is provided by the user which means the user can easily create a custom gateway that has the business logic pertaining to a use-case.
+ 1. gateway-processor: Either generates the events internally or listens to external events.
+ The implementation of gateway-processor is provided by the user which means the user can easily create a custom gateway.
- 2. gateway-transformer: Transforms the incoming event from gateway-processor into a cloudevents specification compliant event. The event is then dispatched to sensors who are interested in listening to this gateway.
- Refer https://github.com/cloudevents/spec for more info on cloudevents.
+ 2. gateway-transformer: Transforms the incoming events from gateway-processor into a cloudevents specification compliant events.
+ The event is then dispatched to watchers.
+
+ Refer https://github.com/cloudevents/spec for more info on cloudevents specifications.
Core gateways come in 5 types:
@@ -44,24 +46,25 @@ The `gateway-controller` is responsible for managing the `Gateway` resources.
| ConfigMap | Name of the configmap containing gateway configuration/s |
| Type | Type of gateway |
| Version | To mark event version |
-| Service | Name of the service to expose the gateway |
-| Sensors | List of sensors to dispatch events to |
+| ServiceSpec | Specifications of the service to expose the gateway |
+| Watchers | Watchers are components which are interested listening to notifications from the gateway |
+| RPCPort | Used to communicate between gRPC gateway client and gRPC gateway server |
+| HTTPServerPort | Used to communicate between gateway client and server over http |
+| DispatchMechanism | Messaging mechanism used to send events from gateway to watchers |
## Gateway Deployment
All core gateways use kubernetes configmap to keep track of current gateway configurations. Multiple configurations can be defined for a single gateway and
each configuration will run in a separate go routine. The gateway watches updates to configmap which let us add new configuration at run time.
-[Checkout core gateways specs.](https://github.com/argoproj/argo-events/tree/eventing/examples/gateways)
## How to write a custom gateway?
-Follow the gateway tutorial
+Follow this tutorial to learn more
[Custom Gateways](custom-gateway.md)
-## Types of Gateways & their configurations
-
-###### Gateway can have zero configuration(won't be doing anything useful) to multiple configurations. A configuration can be added or removed during the runtime.
+## Gateway configurations
+Gateway can have zero configuration(idle) or many configurations. A configuration can be added or removed during the runtime.
### Calendars
Events produced can be based on a [cron](https://crontab.guru/) schedule or an [interval duration](https://golang.org/pkg/time/#ParseDuration). In addition, calendar gateway currently supports a `recurrence` field in which to specify special exclusion dates for which this gateway will not produce an event.
@@ -138,10 +141,10 @@ Artifact gateway support S3 `bucket-notifications` via [Minio](https://docs.mini
```
### Streams
-Stream signals contain a generic specification for messages received on a queue and/or though messaging server. The following are the `builtin` supported stream signals. Users can build their own signals by adding implementations to the [custom](../signals/stream/custom/doc.go) package.
+Stream gateways contain a generic specification for messages received on a queue and/or though messaging server. The following are the `builtin` supported stream gateways.
#### NATS
-[Nats](https://nats.io/) is an open-sourced, lightweight, secure, and scalable messaging system for cloud native applications and microservices architecture. It is currently a hosted CNCF Project. We are currently experimenting with using NATS as a solution for gateway (inputs) and triggers (outputs), however `NATS Streaming`, the data streaming system powered by NATS, offers many additional [features](https://nats.io/documentation/streaming/nats-streaming-intro/) on top of the core NATS platform that we believe are very desirable and definite future enhancements.
+[Nats](https://nats.io/) is an open-sourced, lightweight, secure, and scalable messaging system for cloud native applications and microservices architecture. It is currently a hosted CNCF Project.
```
nats.fooConfig: |-
url: nats://nats.argo-events:4222
@@ -207,4 +210,4 @@ Stream signals contain a generic specification for messages received on a queue
```
### Examples
-[Gateway Examples](https://github.com/argoproj/argo-events/tree/eventing/examples/gateways)
+Explore [Gateway Examples](https://github.com/argoproj/argo-events/tree/eventing/examples/gateways)
diff --git a/docs/index.md b/docs/index.md
index c394762351..ec0e11138e 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -3,8 +3,8 @@
## Why Argo Events?
- Containers. Designed from the ground-up as Kubernetes-native.
- Extremely lightweight. All gateways, with exception of calendar based gateway, are event-driven, meaning there is no polling involved.
-- Configurable. Select gateways you want to support, deploy those to Kubernetes and configure them on the fly
-- Extensible. Write custom gateways that cater to your business use cases in any language of your choice
+- Configurable. Configure gateways at runtime
+- Extensible. Write custom gateways for any business use case in the language of your choice
- Scalability & Resilient.
- Simple or Complex dependencies. Manage everything from simple, linear, real-time dependencies to complex, multi-source batch job dependencies.
diff --git a/docs/quickstart.md b/docs/quickstart.md
index cb2fab0196..10a60ccfb9 100644
--- a/docs/quickstart.md
+++ b/docs/quickstart.md
@@ -14,9 +14,10 @@ cd $GOPATH/src/github.com/argoproj/argo-events
```
## 2. Deploy Argo Events SA, ClusterRoles, ConfigMap, Sensor Controller and Gateway Controller
-Note 1: This process is manual right now, but we're working on providing a Helm chart or integrating as a Ksonnet application.
-Note 2: Modify the [argo-events-cluster-roles.yaml](../hack/k8s/manifests/argo-events-cluster-roles.yaml) file to use the correct namespace that you wish to deploy the sensor controller + signal microservices.
+Note: Modify the [argo-events-cluster-roles.yaml](../hack/k8s/manifests/argo-events-cluster-roles.yaml) file to use the correct namespace that you wish to deploy the sensor controller and gateway controller.
+
```
+kubectl create namespace argo-events
kubectl apply -f hack/k8s/manifests/argo-events-sa.yaml
kubectl apply -f hack/k8s/manifests/argo-events-cluster-roles.yaml
kubectl apply -f hack/k8s/manifests/sensor-crd.yaml
@@ -27,9 +28,14 @@ kubectl apply -f hack/k8s/manifests/gateway-controller-configmap.yaml
kubectl apply -f hack/k8s/manifests/gateway-controller-deployment.yaml
```
+Note If you want to use a different namespace for deployments, make sure to update namespace references
+to your-namespace in above files
+
## 3. Install Argo
Follow instructions from https://github.com/argoproj/argo/blob/master/demo.md
+Note: Make sure to install Argo in `argo-events` namespace
+
## 4. Create a webhook gateway
```
kubectl apply -f examples/gateways/webhook-gateway-configmap.yaml
@@ -42,12 +48,12 @@ kubectl apply -f examples/sensors/webhook.yaml
```
## 6. Trigger the webhook & corresponding Argo workflow
-Trigger the webhook via sending a http POST request to `\app` endpoint. You can add different endpoint to
+Trigger the webhook via sending a http POST request to `/foo` endpoint. You can add different endpoint to
gateway configuration at run time as well.
Note: the `WEBHOOK_SERVICE_URL` will differ based on the Kubernetes cluster.
```
-export WEBHOOK_SERVICE_URL=$(minikube service --url webhook-svc)
-curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST $WEBHOOK_SERVICE_URL/app
+export WEBHOOK_SERVICE_URL=$(minikube service --url webhook-gateway-gateway-svc)
+curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST $WEBHOOK_SERVICE_URL/foo
```
Verify that the Argo workflow was run when the trigger was executed.
@@ -57,15 +63,11 @@ argo list
Verify that the sensor was updated correctly and moved to a "Complete" phase.
```
-kubectl get sensor webhook -n default -o yaml
-```
-
-Check the logs of the Argo workflow pod for the message you posted.
-```
-kubectl logs arguments-via-webhook-event main
+kubectl get sensor webhook-sensor -o yaml
```
-Check the logs of the sensor-controller pod, gateway-controller, associated gateway and sensor if there are problems.
+Check the logs of the sensor-controller pod, gateway-controller, associated gateways and sensors if there are problems.
-## 7. Write your own gateway
-Now, its time to write your first gateway. Follow the tutorial [Custom Gateways](custom-gateway.md)
\ No newline at end of file
+## 7. Next steps
+* [Follow tutorial on gateways and sensors](tutorial.md)
+* Write your first gateway. Follow the tutorial [Custom Gateways](custom-gateway.md).
diff --git a/docs/sensor-guide.md b/docs/sensor-guide.md
index 2bcfa61b59..325e497c78 100644
--- a/docs/sensor-guide.md
+++ b/docs/sensor-guide.md
@@ -1,33 +1,55 @@
## Sensor Guide
Sensors define a set of dependencies (inputs) and actions (outputs). The sensor's actions will only be triggered after it's dependencies have been resolved.
-[Checkout sensor examples](https://github.com/argoproj/argo-events/tree/eventing/examples/sensors)
+[Sensor examples](https://github.com/argoproj/argo-events/tree/eventing/examples/sensors)
### Dependencies
-Dependencies(also called signals) are the name/s of gateway/s from whom the sensor expects to get the notifications.
+Dependencies(also called signals) are defined as "gateway-name/specific-configuration"
```
signals:
- - name: calendar-gateway
- - name: foo-gateway
- - name: bar-gateway
+ - name: calendar-gateway/calendar.fooConfig
+ - name: webhook-gateway/webhook.barConfig
```
-### Triggers
-Refer [Triggers](trigger-guide.md) guide.
-
### Repeating the sensor
Sensor can be configured to rerun by setting repeat property to `true`
```
spec:
repeat: true
- signals:
- - name: calendar-example-gateway
```
+### Triggers
+Refer [Triggers](trigger-guide.md) guide.
+
+
+### Event payload
+Event payload of any signal can be passed to any trigger. To pass complete payload without applying any filter,
+do not set ```path```
+e.g.
+```yaml
+parameters:
+ - src:
+ signal: webhook-gateway/webhook.fooConfig
+ path:
+ dest: spec.templates.0.container.args.0
+```
+
+Complete example to pass payload from signal to trigger can be found [here](https://github.com/argoproj/argo-events/blob/master/examples/sensors/webhook.yaml)
+
+To pass a particular field from payload to trigger, set ```path```. e.g.
+```yaml
+parameters:
+ - src:
+ signal: webhook-gateway/webhook.fooConfig
+ path: name
+ dest: spec.templates.0.container.args.0
+```
+
+In above example, the object/value corresponding to key ```name``` will be passed to trigger.
+
### Filters
-The payload received from gateways to trigger resources as input. You can apply filters
-on the payload.
+Additionally, you can apply filters on the payload.
There are 3 types of filters:
diff --git a/docs/tutorial.md b/docs/tutorial.md
new file mode 100644
index 0000000000..54e7ac6f49
--- /dev/null
+++ b/docs/tutorial.md
@@ -0,0 +1,693 @@
+# Tutorial
+
+Follow [getting started](https://github.com/argoproj/argo-events/blob/master/docs/quickstart.md) to setup namespace, service account and controllers
+
+## Controller
+
+## Controller configmap
+Provide the `instance-id` and the namespace for controller
+controller configmap
+e.g.
+```yaml
+# The gateway-controller configmap includes configuration information for the gateway-controller
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: gateway-controller-configmap
+data:
+ config: |
+ instanceID: argo-events # mandatory
+ namespace: my-custom-namespace # optional
+```
+Note on `instance-id`: it is used to map a gateway or sensor to a controller.
+e.g. when you create a gateway with label `gateways.argoproj.io/gateway-controller-instanceid: argo-events`, a
+ controller with label `argo-events` will process that gateway. `instance-id` for controller are managed using [controller-configmap](https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/gateway-controller-configmap.yaml)
+Basically `instance-id` is used to horizontally scale controllers, so you won't end up overwhelming a controller with large
+ number of gateways or sensors. Also keep in mind that `instance-id` has nothing to do with namespace where you are
+ deploying controllers and gateways/sensors.
+
+
+### Gateway controller
+Gateway controller watches gateway resource and manages lifecycle of a gateway.
+```yaml
+# The gateway-controller listens for changes on the gateway CRD and creates gateway
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+ name: gateway-controller
+spec:
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: gateway-controller
+ spec:
+ serviceAccountName: argo-events-sa
+ containers:
+ - name: gateway-controller
+ image: argoproj/gateway-controller:latest
+ imagePullPolicy: Always
+ env:
+ - name: GATEWAY_NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: GATEWAY_CONTROLLER_CONFIG_MAP
+ value: gateway-controller-configmap
+```
+
+### Sensor controller
+Sensor controller watches sensor resource and manages lifecycle of a sensor.
+```yaml
+# The sensor sensor-controller listens for changes on the sensor CRD and creates sensor executor jobs
+apiVersion: apps/v1beta1
+kind: Deployment
+metadata:
+ name: sensor-controller
+spec:
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: sensor-controller
+ spec:
+ serviceAccountName: argo-events-sa
+ containers:
+ - name: sensor-controller
+ image: argoproj/sensor-controller:latest
+ imagePullPolicy: Always
+ env:
+ - name: SENSOR_NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: SENSOR_CONFIG_MAP
+ value: sensor-controller-configmap
+```
+
+## Lets get started with gateways and sensors
+
+#### Webhook
+Create webhook gateway configmap
+
+```yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: webhook-gateway-configmap
+data:
+ # run http server on 12000
+ webhook.portConfig: |-
+ port: "12000"
+ # listen to /bar endpoint for POST requests
+ webhook.barConfig: |-
+ endpoint: "/bar"
+ method: "POST"
+ # listen to /foo endpoint for POST requests
+ webhook.fooConfig: |-
+ endpoint: "/foo"
+ method: "POST"
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/webhook-gateway-configmap.yaml
+```
+
+Create webhook gateway. Make sure to create it in same namespace as configmap above.
+
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Gateway
+metadata:
+ # name of the gateway
+ name: webhook-gateway
+ labels:
+ # must match with instance id of one of the gateway controllers.
+ gateways.argoproj.io/gateway-controller-instanceid: argo-events
+ gateway-name: "webhook-gateway"
+spec:
+ # configmap to read configurations from
+ configMap: "webhook-gateway-configmap"
+ # type of gateway
+ type: "webhook"
+ # event dispatch protocol between gateway and it's watchers
+ dispatchMechanism: "HTTP"
+ # version of events this gateway is generating. Required for cloudevents specification
+ version: "1.0"
+ # these are pod specifications
+ deploySpec:
+ containers:
+ - name: "webhook-events"
+ image: "argoproj/webhook-gateway"
+ imagePullPolicy: "Always"
+ command: ["/bin/webhook-gateway"]
+ serviceAccountName: "argo-events-sa"
+ # service specifications to expose gateway
+ serviceSpec:
+ selector:
+ gateway-name: "webhook-gateway"
+ ports:
+ - port: 12000
+ targetPort: 12000
+ type: LoadBalancer
+ # watchers are components interested in listening to events produced by this gateway
+ watchers:
+ sensors:
+ - name: "webhook-sensor"
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/webhook.yaml
+```
+
+Check whether all configurations are running and gateway is active
+```bash
+kubectl get gateway webhook-gateway -o yaml
+```
+
+Create webhook sensor,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Sensor
+metadata:
+ # name of sensor
+ name: webhook-sensor
+ labels:
+ # instance-id must match with one of the deployed sensor controller's instance-id
+ sensors.argoproj.io/sensor-controller-instanceid: argo-events
+spec:
+ # make this sensor as long running.
+ repeat: true
+ serviceAccountName: argo-events-sa
+ # signals/notifications this sensor is interested in.
+ signals:
+ # event must be from webhook-gateway and the configuration that produced this event must be
+ # webhook.fooConfig
+ - name: webhook-gateway/webhook.fooConfig
+ triggers:
+ - name: webhook-workflow-trigger
+ 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"
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/webhook.yaml
+```
+
+Send a POST request to the gateway service, and monitor namespace for new workflow
+```bash
+curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST $WEBHOOK_SERVICE_URL/foo
+```
+```bash
+argo list
+```
+
+### Passing payload from signal to trigger
+
+#### Complete payload
+Create a webhook sensor,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Sensor
+metadata:
+ name: webhook-with-resource-param-sensor
+ labels:
+ sensors.argoproj.io/sensor-controller-instanceid: argo-events
+spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
+ signals:
+ - name: webhook-gateway/webhook.fooConfig
+ triggers:
+ - name: argo-workflow
+ resource:
+ namespace: argo-events
+ group: argoproj.io
+ version: v1alpha1
+ kind: Workflow
+ parameters:
+ - src:
+ signal: webhook-gateway/webhook.fooConfig
+ # pass payload of webhook-gateway/webhook.fooConfig signal to first parameter value
+ # of arguments.
+ dest: spec.arguments.parameters.0.value
+ source:
+ inline: |
+ apiVersion: argoproj.io/v1alpha1
+ kind: Workflow
+ metadata:
+ name: arguments-via-webhook-event
+ spec:
+ entrypoint: whalesay
+ arguments:
+ parameters:
+ - name: message
+ # this is the value that should be overridden
+ value: hello world
+ templates:
+ - name: whalesay
+ inputs:
+ parameters:
+ - name: message
+ container:
+ image: docker/whalesay:latest
+ command: [cowsay]
+ args: ["{{inputs.parameters.message}}"]
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/trigger-param-fix/examples/sensors/webhook-with-complete-payload.yaml
+```
+
+Make sure to update webhook gateway with `webhook-with-resource-param-sensor` as it's watcher.
+
+Send a POST request to your webhook gateway,
+```bash
+curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST $WEBHOOK_SERVICE_URL/foo
+```
+
+and inspect the logs of the new argo workflow using `argo logs`.
+
+#### Filter event payload
+Create a webhook sensor,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Sensor
+metadata:
+ name: webhook-with-resource-param-sensor
+ labels:
+ sensors.argoproj.io/sensor-controller-instanceid: argo-events
+spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
+ signals:
+ - name: webhook-gateway/webhook.fooConfig
+ triggers:
+ - name: argo-workflow
+ resource:
+ namespace: argo-events
+ group: argoproj.io
+ version: v1alpha1
+ kind: Workflow
+ # The parameters from the workflow are overridden by the webhook's message
+ parameters:
+ - src:
+ signal: webhook-gateway/webhook.fooConfig
+ # extract the object corresponding to `message` key from event payload
+ # of webhook-gateway/webhook.fooConfig signal
+ path: message
+ # if `message` key doesn't exists in event payload then default value of payload
+ # passed to trigger will be `hello default`
+ value: hello default
+ # override the value of first parameter in arguments with above payload.
+ dest: spec.arguments.parameters.0.value
+ source:
+ inline: |
+ apiVersion: argoproj.io/v1alpha1
+ kind: Workflow
+ metadata:
+ name: arguments-via-webhook-event
+ spec:
+ entrypoint: whalesay
+ arguments:
+ parameters:
+ - name: message
+ # this is the value that should be overridden
+ value: hello world
+ templates:
+ - name: whalesay
+ inputs:
+ parameters:
+ - name: message
+ container:
+ image: docker/whalesay:latest
+ command: [cowsay]
+ args: ["{{inputs.parameters.message}}"]
+
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/trigger-param-fix/examples/sensors/webhook-with-resource-param.yaml
+```
+
+Post request to webhook gateway and watch new workflow being created
+
+#### Calendar
+Create configmap,
+```yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: calendar-gateway-configmap
+data:
+ # generate event after every 55s
+ calendar.barConfig: |-
+ interval: 55s
+ # generate event after every 10s
+ calendar.fooConfig: |-
+ interval: 10s
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/calendar-gateway-configmap.yaml
+```
+
+Create a calendar gateway,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Gateway
+metadata:
+ name: calendar-gateway
+ labels:
+ gateways.argoproj.io/gateway-controller-instanceid: argo-events
+ gateway-name: "calendar-gateway"
+spec:
+ deploySpec:
+ containers:
+ - name: "calendar-events"
+ image: "argoproj/calendar-gateway"
+ imagePullPolicy: "Always"
+ command: ["/bin/calendar-gateway"]
+ serviceAccountName: "argo-events-sa"
+ configMap: "calendar-gateway-configmap"
+ type: "calendar"
+ dispatchMechanism: "HTTP"
+ version: "1.0"
+ watchers:
+ sensors:
+ - name: "calendar-sensor"
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/calendar.yaml
+```
+
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Sensor
+metadata:
+ name: calendar-sensor
+ labels:
+ sensors.argoproj.io/sensor-controller-instanceid: argo-events
+spec:
+ serviceAccountName: argo-events-sa
+ imagePullPolicy: Always
+ repeat: true
+ signals:
+ - name: calendar-gateway/calendar.fooConfig
+ triggers:
+ - name: calendar-workflow-trigger
+ 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:
+ -
+ container:
+ args:
+ - "hello world"
+ command:
+ - cowsay
+ image: "docker/whalesay:latest"
+ name: whalesay
+```
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/trigger-param-fix/examples/sensors/calendar.yaml
+```
+
+
+Monitor your namespace for argo workflows,
+
+```bash
+argo list
+```
+
+#### Artifact
+Make sure to have Minio service deployed in your namespace. Follow https://www.minio.io/kubernetes.html
+
+Create configmap,
+```yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: artifact-gateway-configmap
+data:
+ s3.fooConfig: |-
+ s3EventConfig:
+ # name of bucket on which gateway should listen for notifications
+ bucket: input
+ # minio service
+ endpoint: minio-service.argo-events:9000
+ # type of notification
+ event: s3:ObjectCreated:Put
+ filter:
+ prefix: ""
+ suffix: ""
+ insecure: true
+ # k8 secret that contains minio access and secret keys
+ accessKey:
+ key: accesskey
+ name: artifacts-minio
+ secretKey:
+ key: secretkey
+ name: artifacts-minio
+```
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/artifact-gateway-configmap.yaml
+```
+
+Create gateway,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Gateway
+metadata:
+ name: artifact-gateway
+ labels:
+ gateways.argoproj.io/gateway-controller-instanceid: argo-events
+ gateway-name: "artifact-gateway"
+spec:
+ deploySpec:
+ containers:
+ - name: "artifact-events"
+ image: "argoproj/artifact-gateway"
+ imagePullPolicy: "Always"
+ command: ["/bin/artifact-gateway"]
+ serviceAccountName: "argo-events-sa"
+ configMap: "artifact-gateway-configmap"
+ version: "1.0"
+ type: "artifact"
+ dispatchMechanism: "HTTP"
+ watchers:
+ sensors:
+ - name: "artifact-sensor"
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/artifact.yaml
+```
+
+Create sensor,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Sensor
+metadata:
+ name: artifact-sensor
+ labels:
+ sensors.argoproj.io/sensor-controller-instanceid: argo-events
+spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
+ signals:
+ - name: artifact-gateway/s3.fooConfig
+ triggers:
+ - name: artifact-workflow-trigger
+ 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:
+ -
+ container:
+ args:
+ - "hello world"
+ command:
+ - cowsay
+ image: "docker/whalesay:latest"
+ name: whalesay
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/trigger-param-fix/examples/sensors/s3.yaml
+```
+
+Drop a file into `input` bucket and monitor namespace for argo workflow.
+
+#### Resource
+Create resource configmap,
+```yaml
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: resource-gateway-configmap
+data:
+ resource.fooConfig: |-
+ namespace: argo-events
+ group: "argoproj.io"
+ version: "v1alpha1"
+ kind: "Workflow"
+ filter:
+ labels:
+ # watch workflows that have label `name: my-workflow`
+ name: "my-workflow"
+ resource.barConfig: |-
+ namespace: argo-events
+ group: "argoproj.io"
+ version: "v1alpha1"
+ kind: "Workflow"
+ filter:
+ # watch workflows that has phase as failed
+ labels:
+ workflows.argoproj.io/phase: Failed
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/resource-gateway.configmap.yaml
+```
+
+Create resource gateway,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Gateway
+metadata:
+ name: resource-gateway
+ labels:
+ gateways.argoproj.io/gateway-controller-instanceid: argo-events
+ gateway-name: "resource-gateway"
+spec:
+ deploySpec:
+ containers:
+ - name: "resource-events"
+ image: "argoproj/resource-gateway"
+ imagePullPolicy: "Always"
+ command: ["/bin/resource-gateway"]
+ serviceAccountName: "argo-events-sa"
+ configMap: "resource-gateway-configmap"
+ type: "resource"
+ dispatchMechanism: "HTTP"
+ version: "1.0"
+ watchers:
+ sensors:
+ - name: "resource-sensor"
+```
+
+```bash
+kubectl create -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/resource.yaml
+```
+
+Create resource sensor,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Sensor
+metadata:
+ name: resource-sensor
+ labels:
+ sensors.argoproj.io/sensor-controller-instanceid: argo-events
+spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
+ signals:
+ - name: resource-gateway/resource.fooConfig
+ triggers:
+ - name: argo-workflow
+ 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:
+ -
+ container:
+ args:
+ - "hello world"
+ command:
+ - cowsay
+ image: "docker/whalesay:latest"
+ name: whalesay
+```
+
+```bash
+https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/resource.yaml
+```
+
+Now, create a workflow with label `name: my-workflow`,
+```yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Workflow
+metadata:
+ generateName: hello-world-
+ namespace: argo-events
+ labels:
+ name: my-workflow
+spec:
+ entrypoint: whalesay
+ serviceAccountName: argo-events-sa
+ templates:
+ - container:
+ args:
+ - "hello world"
+ command:
+ - cowsay
+ image: docker/whalesay:latest
+ name: whalesay
+```
+
+Once workflow is created, resource sensor will trigger workflow.
+
+#### Streams
+Deploying stream gateways and sensors are pretty much same as other gateways. Just make sure you have
+streaming solutions(NATS, KAFKA etc.) deployed in your namespace.
diff --git a/examples/gateways/amqp.yaml b/examples/gateways/amqp.yaml
index 3278c8ad64..6a9b7aa22d 100644
--- a/examples/gateways/amqp.yaml
+++ b/examples/gateways/amqp.yaml
@@ -8,7 +8,7 @@ metadata:
spec:
deploySpec:
containers:
- - name: webhook-events
+ - name: amqp-events
image: "argoproj/amqp-gateway"
imagePullPolicy: "Always"
command: ["/bin/amqp-gateway"]
diff --git a/examples/gateways/artifact-gateway-configmap.yaml b/examples/gateways/artifact-gateway-configmap.yaml
index 68b4492642..e2d175cbfc 100644
--- a/examples/gateways/artifact-gateway-configmap.yaml
+++ b/examples/gateways/artifact-gateway-configmap.yaml
@@ -18,33 +18,3 @@ data:
secretKey:
key: secretkey
name: artifacts-minio
- s3.ratingsConfig: |-
- s3EventConfig:
- bucket: ratings
- endpoint: minio-service.argo-events:9000
- event: s3:ObjectCreated:Put
- filter:
- prefix: ""
- suffix: ""
- insecure: true
- accessKey:
- key: accesskey
- name: artifacts-minio
- secretKey:
- key: secretkey
- name: artifacts-minio
- s3.secMasterConfig: |-
- s3EventConfig:
- bucket: sec-master
- endpoint: minio-service.argo-events:9000
- event: s3:ObjectCreated:Put
- filter:
- prefix: ""
- suffix: ""
- insecure: true
- accessKey:
- key: accesskey
- name: artifacts-minio
- secretKey:
- key: secretkey
- name: artifacts-minio
diff --git a/examples/gateways/artifact.yaml b/examples/gateways/artifact.yaml
index 0ba2c59b01..27823a31ef 100644
--- a/examples/gateways/artifact.yaml
+++ b/examples/gateways/artifact.yaml
@@ -19,6 +19,4 @@ spec:
dispatchMechanism: "HTTP"
watchers:
sensors:
- - name: "etl-sensor"
- - name: "s3-k8-events-sensor-1"
- - name: "s3-k8-events-sensor-2"
+ - name: "artifact-sensor"
diff --git a/examples/gateways/calendar-grpc.yaml b/examples/gateways/calendar-grpc.yaml
index a79e28f0ba..d24494e630 100644
--- a/examples/gateways/calendar-grpc.yaml
+++ b/examples/gateways/calendar-grpc.yaml
@@ -19,10 +19,5 @@ spec:
serviceAccountName: "argo-events-sa"
rpcPort: "9898"
watchers:
- gateways:
- - name: "webhook-gateway-2"
- port: "9070"
- endpoint: "/notifications"
sensors:
- name: "calendar-sensor"
- - name: "multi-signal-sensor"
diff --git a/examples/gateways/calendar.yaml b/examples/gateways/calendar.yaml
index 1f4f71f4a1..3337e231af 100644
--- a/examples/gateways/calendar.yaml
+++ b/examples/gateways/calendar.yaml
@@ -12,16 +12,11 @@ spec:
image: "argoproj/calendar-gateway"
imagePullPolicy: "Always"
command: ["/bin/calendar-gateway"]
- serviceAccountName: "axis-sa"
+ serviceAccountName: "argo-events-sa"
configMap: "calendar-gateway-configmap"
type: "calendar"
dispatchMechanism: "HTTP"
version: "1.0"
watchers:
- gateways:
- - name: "webhook-gateway-2"
- port: "9070"
- endpoint: "/notifications"
sensors:
- name: "calendar-sensor"
- - name: "multi-signal-sensor"
diff --git a/examples/gateways/multi-watchers.yaml b/examples/gateways/multi-watchers.yaml
new file mode 100644
index 0000000000..e35b3827df
--- /dev/null
+++ b/examples/gateways/multi-watchers.yaml
@@ -0,0 +1,38 @@
+apiVersion: argoproj.io/v1alpha1
+kind: Gateway
+metadata:
+ name: webhook-gateway-multi-watchers
+ labels:
+ gateways.argoproj.io/gateway-controller-instanceid: argo-events
+ gateway-name: "webhook-gateway-multi-watchers"
+spec:
+ configMap: "webhook-gateway-configmap"
+ type: "webhook"
+ dispatchMechanism: "HTTP"
+ version: "1.0"
+ deploySpec:
+ containers:
+ - name: "webhook-events"
+ image: "argoproj/webhook-gateway"
+ imagePullPolicy: "Always"
+ command: ["/bin/webhook-gateway"]
+ serviceAccountName: "argo-events-sa"
+ serviceSpec:
+ selector:
+ gateway-name: "webhook-gateway-multi-watchers"
+ ports:
+ - port: 12000
+ targetPort: 12000
+ type: LoadBalancer
+ watchers:
+ # requirement for adding gateway as watcher is there should be a http server running in watcher gateway
+ # and user must provide port and endpoint on which event should be dispatched.
+ # Adding gateways as watchers are particularly useful when you want to chain events.
+ gateways:
+ - name: "webhook-gateway"
+ port: "9070"
+ endpoint: "/notifications"
+ sensors:
+ - name: "webhook-sensor"
+ - name: "multi-signal-sensor"
+ - name: "webhook-time-filter-sensor"
diff --git a/examples/gateways/resource-gateway-configmap.yaml b/examples/gateways/resource-gateway-configmap.yaml
new file mode 100644
index 0000000000..a34a182c0e
--- /dev/null
+++ b/examples/gateways/resource-gateway-configmap.yaml
@@ -0,0 +1,23 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: resource-gateway-configmap
+data:
+ resource.fooConfig: |-
+ namespace: argo-events
+ group: "argoproj.io"
+ version: "v1alpha1"
+ kind: "Workflow"
+ filter:
+ labels:
+ workflows.argoproj.io/phase: Succeeded
+ name: "my-workflow"
+ resource.barConfig: |-
+ namespace: argo-events
+ group: "argoproj.io"
+ version: "v1alpha1"
+ kind: "Workflow"
+ filter:
+ prefix: scripts-bash
+ labels:
+ workflows.argoproj.io/phase: Failed
diff --git a/examples/gateways/resource-gateway.configmap.yaml b/examples/gateways/resource-gateway.configmap.yaml
deleted file mode 100644
index c6e3b490df..0000000000
--- a/examples/gateways/resource-gateway.configmap.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: resource-gateway-configmap
-data:
- resource.fooConfig: |-
- namespace: default
- group: "argoproj.io"
- version: "v1alpha1"
- kind: "Workflow"
- filter:
- prefix: scripts-bash
- labels:
- workflows.argoproj.io/phase: Succeeded
\ No newline at end of file
diff --git a/examples/gateways/webhook.yaml b/examples/gateways/webhook.yaml
index 42ee9a56a4..a7f6ab577b 100644
--- a/examples/gateways/webhook.yaml
+++ b/examples/gateways/webhook.yaml
@@ -25,12 +25,5 @@ spec:
targetPort: 12000
type: LoadBalancer
watchers:
- gateways:
- - name: "webhook-gateway-2"
- port: "9070"
- endpoint: "/notifications"
sensors:
- name: "webhook-sensor"
- - name: "multi-signal-sensor"
- - name: "webhook-time-filter-sensor"
- - name: "dsp-sensor"
diff --git a/examples/sensors/amqp.yaml b/examples/sensors/amqp.yaml
index 15bbc2dfa6..93a34a6cb4 100644
--- a/examples/sensors/amqp.yaml
+++ b/examples/sensors/amqp.yaml
@@ -5,11 +5,15 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
+ imagePullPolicy: Always
signals:
- name: amqp-gateway/amqp.fooConfig
triggers:
- name: amqp-workflow-trigger
resource:
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
@@ -22,11 +26,10 @@ spec:
spec:
entrypoint: whalesay
templates:
- -
+ - name: whalesay
container:
args:
- "hello world"
command:
- cowsay
image: "docker/whalesay:latest"
- name: whalesay
diff --git a/examples/sensors/calendar.yaml b/examples/sensors/calendar.yaml
index c5a51bb795..5c8bea1524 100644
--- a/examples/sensors/calendar.yaml
+++ b/examples/sensors/calendar.yaml
@@ -5,7 +5,7 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
- serviceAccountName: axis-sa
+ serviceAccountName: argo-events-sa
imagePullPolicy: Always
repeat: true
signals:
@@ -13,17 +13,16 @@ spec:
triggers:
- name: calendar-workflow-trigger
resource:
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
- namespace: "argo-events"
source:
inline: |
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-
- namespace: "dev-raspberry"
spec:
entrypoint: whalesay
templates:
diff --git a/examples/sensors/context-filter-webhook.yaml b/examples/sensors/context-filter-webhook.yaml
index 4132b109c2..c6490cfe74 100644
--- a/examples/sensors/context-filter-webhook.yaml
+++ b/examples/sensors/context-filter-webhook.yaml
@@ -5,16 +5,19 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
signals:
- name: webhook-gateway/webhook.fooConfig
filters:
context:
source:
- host: dev.blackrock.com
+ host: xyz.com
contentType: application/json
triggers:
- name: done-workflow
resource:
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
@@ -22,7 +25,7 @@ spec:
s3:
bucket: workflows
key: hello-world.yaml
- endpoint: minio-service.default:9000
+ endpoint: minio-service.argo-events:9000
insecure: true
accessKey:
key: accesskey
diff --git a/examples/sensors/data-filter-webhook.yaml b/examples/sensors/data-filter-webhook.yaml
index ce8a5e7146..399133eb63 100644
--- a/examples/sensors/data-filter-webhook.yaml
+++ b/examples/sensors/data-filter-webhook.yaml
@@ -1,3 +1,4 @@
+# this is a non-repeatable sensor. To make it repeatable, set `repeat` as true in `spec`
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
@@ -5,6 +6,7 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ serviceAccountName: argo-events-sa
signals:
- name: webhook-gateway/webhook.barConfig
filters:
@@ -15,6 +17,7 @@ spec:
triggers:
- name: done-workflow
resource:
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
diff --git a/examples/sensors/file-sensor.yaml b/examples/sensors/file-sensor.yaml
index b287dedecc..e0acf66641 100644
--- a/examples/sensors/file-sensor.yaml
+++ b/examples/sensors/file-sensor.yaml
@@ -5,16 +5,17 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ serviceAccountName: argo-events-sa
signals:
- name: calendar-gateway/calendar.fooConfig
triggers:
- name: file-workflow-trigger
resource:
- namespace: default
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
- # The following requires that the sensor-sensor-controller be run with a
+ # The following requires that the sensor-controller be run with a
# volume mount that has the workflow yamls in it.
source:
file:
diff --git a/examples/sensors/inline-sensor.yaml b/examples/sensors/inline-sensor.yaml
index 1aa9d6ce90..80de04a940 100644
--- a/examples/sensors/inline-sensor.yaml
+++ b/examples/sensors/inline-sensor.yaml
@@ -5,12 +5,13 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ serviceAccountName: argo-events-sa
signals:
- name: calendar-gateway/calendar.barConfig
triggers:
- name: inline-workflow-trigger
resource:
- namespace: default
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
diff --git a/examples/sensors/kafka.yaml b/examples/sensors/kafka.yaml
index e5fad62f21..259a874003 100644
--- a/examples/sensors/kafka.yaml
+++ b/examples/sensors/kafka.yaml
@@ -5,11 +5,13 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ serviceAccountName: argo-events-sa
signals:
- name: kafka-gateway/kafka.fooConfig
triggers:
- name: kafka-workflow-trigger
resource:
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
diff --git a/examples/sensors/mqtt-sensor.yaml b/examples/sensors/mqtt-sensor.yaml
index 12e3b5d653..43ce6cc7e4 100644
--- a/examples/sensors/mqtt-sensor.yaml
+++ b/examples/sensors/mqtt-sensor.yaml
@@ -5,11 +5,13 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ serviceAccountName: argo-events-sa
signals:
- name: mqtt-gateway/mqtt.fooConfig
triggers:
- name: mqtt-workflow-trigger
resource:
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
diff --git a/examples/sensors/multi-trigger-sensor.yaml b/examples/sensors/multi-trigger-sensor.yaml
index 7171643fe1..ae4ee4765f 100644
--- a/examples/sensors/multi-trigger-sensor.yaml
+++ b/examples/sensors/multi-trigger-sensor.yaml
@@ -5,18 +5,21 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
signals:
- name: nats-gateway/nats.fooConfig
triggers:
- - name: "workflow"
+ - name: multi-trigger-workflow-1
resource:
+ namespace: argo-events
version: v1
kind: Pod
source:
s3:
bucket: workflows
key: hello-world.yaml
- endpoint: artifacts-minio.default:9000
+ endpoint: minio-service.argo-events:9000
insecure: true
accessKey:
key: accesskey
@@ -26,6 +29,7 @@ spec:
name: artifacts-minio
- name: multi-trigger-workflow-2
resource:
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
diff --git a/examples/sensors/nats.yaml b/examples/sensors/nats.yaml
index 72836eaf82..b451369f38 100644
--- a/examples/sensors/nats.yaml
+++ b/examples/sensors/nats.yaml
@@ -1,4 +1,3 @@
-# This examples demonstrates the use of using NATS as a signal source and message trigger mechanism.
# This example assumes the following prerequisites:
# 1. you have a gnats server/cluster up & running
apiVersion: argoproj.io/v1alpha1
@@ -8,6 +7,7 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
serviceAccountName: argo-events-sa
signals:
- name: nats-gateway/nats.fooConfig
diff --git a/examples/sensors/resource.yaml b/examples/sensors/resource.yaml
index 40ab9ad56b..58886f2073 100644
--- a/examples/sensors/resource.yaml
+++ b/examples/sensors/resource.yaml
@@ -5,6 +5,8 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
signals:
- name: resource-gateway/resource.fooConfig
triggers:
@@ -14,37 +16,20 @@ spec:
group: argoproj.io
version: v1alpha1
kind: Workflow
- # The artifact key from the workflow are overridden by the s3 notification key
- parameters:
- - src:
- signal: minioS3
- path: s3.object.key
- dest: spec.templates.0.inputs.artifacts.0.key
source:
inline: |
- apiVersion: argoproj.io/v1alpha1
- kind: Workflow
- metadata:
- generateName: input-artifact-s3-
- spec:
- entrypoint: input-artifact-s3-example
- templates:
- - name: input-artifact-s3-example
- inputs:
- artifacts:
- - name: my-art
- path: /my-artifact
- s3:
- endpoint: artifacts-minio.default:9000
- bucket: hello
- key: path/in/bucket
- accessKey:
- key: accesskey
- name: artifacts-minio
- secretKey:
- key: secretkey
- name: artifacts-minio
- container:
- image: debian:latest
- command: [sh, -c]
- args: ["ls -l /my-artifact"]
+ apiVersion: argoproj.io/v1alpha1
+ kind: Workflow
+ metadata:
+ generateName: hello-world-
+ spec:
+ entrypoint: whalesay
+ templates:
+ -
+ container:
+ args:
+ - "hello world"
+ command:
+ - cowsay
+ image: "docker/whalesay:latest"
+ name: whalesay
diff --git a/examples/sensors/s3-with-param.yaml b/examples/sensors/s3-with-param.yaml
index 5ac8e02bc0..54a32503ff 100644
--- a/examples/sensors/s3-with-param.yaml
+++ b/examples/sensors/s3-with-param.yaml
@@ -5,46 +5,34 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
signals:
- name: artifact-gateway/s3.fooConfig
triggers:
- name: argo-workflow
resource:
- namespace: default
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
- # The artifact key from the workflow are overridden by the s3 notification key
+ # The container args from the workflow are overridden by the s3 notification key
parameters:
- - src:
- signal: artifact-gateway/s3.fooConfig
- path: s3.object.key
- dest: spec.templates.0.inputs.artifacts.0.key
+ - src:
+ signal: artifact-gateway/s3.fooConfig
+ path: s3.object.key
+ dest: spec.templates.0.container.args.0
source:
inline: |
- apiVersion: argoproj.io/v1alpha1
- kind: Workflow
- metadata:
- generateName: input-artifact-s3-
- spec:
- entrypoint: input-artifact-s3-example
- templates:
- - name: input-artifact-s3-example
- inputs:
- artifacts:
- - name: my-art
- path: /my-artifact
- s3:
- endpoint: artifacts-minio.default:9000
- bucket: hello
- key: path/in/bucket
- accessKey:
- key: accesskey
- name: artifacts-minio
- secretKey:
- key: secretkey
- name: artifacts-minio
- container:
- image: debian:latest
- command: [sh, -c]
- args: ["ls -l /my-artifact"]
+ apiVersion: argoproj.io/v1alpha1
+ kind: Workflow
+ metadata:
+ generateName: artifact-workflow-
+ spec:
+ entrypoint: whalesay
+ templates:
+ - name: whalesay
+ container:
+ command:
+ - cowsay
+ image: "docker/whalesay:latest"
diff --git a/examples/sensors/s3.yaml b/examples/sensors/s3.yaml
index 65c9857694..f307509d4a 100644
--- a/examples/sensors/s3.yaml
+++ b/examples/sensors/s3.yaml
@@ -10,7 +10,7 @@ spec:
signals:
- name: artifact-gateway/s3.fooConfig
triggers:
- - name: hello-world-workflow-trigger
+ - name: artifact-workflow-trigger
resource:
namespace: argo-events
group: argoproj.io
@@ -21,7 +21,7 @@ spec:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
- generateName: s3-
+ generateName: hello-world-
spec:
entrypoint: whalesay
templates:
diff --git a/examples/sensors/time-filter-webhook.yaml b/examples/sensors/time-filter-webhook.yaml
index 40a6b0d74c..b34ac9b5c4 100644
--- a/examples/sensors/time-filter-webhook.yaml
+++ b/examples/sensors/time-filter-webhook.yaml
@@ -5,6 +5,8 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
signals:
- name: webhook-gateway/webhook.barConfig
filters:
diff --git a/examples/sensors/url-sensor.yaml b/examples/sensors/url-sensor.yaml
index 80fdebb17c..85674df421 100644
--- a/examples/sensors/url-sensor.yaml
+++ b/examples/sensors/url-sensor.yaml
@@ -5,12 +5,14 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
signals:
- name: calendar-gateway/calendar.fooConfig
triggers:
- name: url-workflow-trigger
resource:
- namespace: default
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
diff --git a/examples/sensors/webhook-with-complete-payload.yaml b/examples/sensors/webhook-with-complete-payload.yaml
new file mode 100644
index 0000000000..19f2cf60ea
--- /dev/null
+++ b/examples/sensors/webhook-with-complete-payload.yaml
@@ -0,0 +1,46 @@
+apiVersion: argoproj.io/v1alpha1
+kind: Sensor
+metadata:
+ name: webhook-with-resource-param-sensor
+ labels:
+ sensors.argoproj.io/sensor-controller-instanceid: argo-events
+spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
+ signals:
+ - name: webhook-gateway/webhook.fooConfig
+ triggers:
+ - name: argo-workflow
+ resource:
+ namespace: argo-events
+ group: argoproj.io
+ version: v1alpha1
+ kind: Workflow
+ # The parameters from the workflow are overridden by the webhook's message
+ # An empty path means complete payload will be passed to trigger
+ parameters:
+ - src:
+ signal: webhook-gateway/webhook.fooConfig
+ dest: spec.arguments.parameters.0.value
+ source:
+ inline: |
+ apiVersion: argoproj.io/v1alpha1
+ kind: Workflow
+ metadata:
+ name: arguments-via-webhook-event
+ spec:
+ entrypoint: whalesay
+ arguments:
+ parameters:
+ - name: message
+ # this is the value that should be overridden
+ value: hello world
+ templates:
+ - name: whalesay
+ inputs:
+ parameters:
+ - name: message
+ container:
+ image: docker/whalesay:latest
+ command: [cowsay]
+ args: ["{{inputs.parameters.message}}"]
diff --git a/examples/sensors/webhook-with-resource-param.yaml b/examples/sensors/webhook-with-resource-param.yaml
index 1ddb66e5f1..f6f5ce8ec5 100644
--- a/examples/sensors/webhook-with-resource-param.yaml
+++ b/examples/sensors/webhook-with-resource-param.yaml
@@ -5,19 +5,21 @@ metadata:
labels:
sensors.argoproj.io/sensor-controller-instanceid: argo-events
spec:
+ repeat: true
+ serviceAccountName: argo-events-sa
signals:
- name: webhook-gateway/webhook.fooConfig
triggers:
- name: argo-workflow
resource:
- namespace: default
+ namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
# The parameters from the workflow are overridden by the webhook's message
parameters:
- src:
- signal: webhook
+ signal: webhook-gateway/webhook.fooConfig
path: message
value: hello default
dest: spec.arguments.parameters.0.value
diff --git a/examples/sensors/webhook.yaml b/examples/sensors/webhook.yaml
index 373596a26e..329618fe74 100644
--- a/examples/sensors/webhook.yaml
+++ b/examples/sensors/webhook.yaml
@@ -9,19 +9,13 @@ spec:
serviceAccountName: argo-events-sa
signals:
- name: webhook-gateway/webhook.fooConfig
- - name: webhook-gateway/webhook.barConfig
triggers:
- - name: hello-world-workflow-trigger
+ - name: webhook-workflow-trigger
resource:
namespace: argo-events
group: argoproj.io
version: v1alpha1
kind: Workflow
- parameters:
- - src:
- signal: webhook-gateway/webhook.fooConfig
- path: cusip
- dest: spec.templates.0.container.args.0
source:
inline: |
apiVersion: argoproj.io/v1alpha1
@@ -33,6 +27,8 @@ spec:
templates:
- name: whalesay
container:
+ args:
+ - "hello world"
command:
- cowsay
- image: "docker/whalesay:latest"
+ image: "docker/whalesay:latest"
\ No newline at end of file
diff --git a/gateways/core/resource/Dockerfile b/gateways/core/resource/Dockerfile
new file mode 100644
index 0000000000..b293d6dd01
--- /dev/null
+++ b/gateways/core/resource/Dockerfile
@@ -0,0 +1,3 @@
+FROM centos:7
+COPY dist/resource-gateway /bin/
+ENTRYPOINT [ "/bin/resource-gateway" ]
\ No newline at end of file
diff --git a/gateways/core/resource/resource.go b/gateways/core/resource/resource.go
index 0f781532f3..ac49c09179 100644
--- a/gateways/core/resource/resource.go
+++ b/gateways/core/resource/resource.go
@@ -114,6 +114,7 @@ func (rce *resourceConfigExecutor) StartConfig(config *gateways.ConfigContext) e
for item := range w.ResultChan() {
itemObj := item.Object.(*unstructured.Unstructured)
b, err := itemObj.MarshalJSON()
+ gatewayConfig.Log.Info().Str("config-key", config.Data.Src).Msg("resource notification")
if err != nil {
errMessage = "failed to marshal resource"
return
diff --git a/hack/k8s/manifests/gateway-controller-configmap.yaml b/hack/k8s/manifests/gateway-controller-configmap.yaml
index 2225c3d467..8adcbd0bd8 100644
--- a/hack/k8s/manifests/gateway-controller-configmap.yaml
+++ b/hack/k8s/manifests/gateway-controller-configmap.yaml
@@ -1,4 +1,5 @@
# The gateway-controller configmap includes configuration information for the gateway-controller
+# NOTE: if namespace is not provided in `config`, namespace defaults to 'argo-events'
apiVersion: v1
kind: ConfigMap
metadata:
@@ -6,3 +7,4 @@ metadata:
data:
config: |
instanceID: argo-events
+ namespace: argo-events
diff --git a/hack/k8s/manifests/sensor-controller-configmap.yaml b/hack/k8s/manifests/sensor-controller-configmap.yaml
index 6ebda8f6dc..b0830f49bc 100644
--- a/hack/k8s/manifests/sensor-controller-configmap.yaml
+++ b/hack/k8s/manifests/sensor-controller-configmap.yaml
@@ -1,4 +1,5 @@
# The sensor sensor-controller configmap includes configuration information for the sensor sensor-controller
+# NOTE: if namespace is not provided in `config`, namespace defaults to 'argo-events'
apiVersion: v1
kind: ConfigMap
metadata:
@@ -6,3 +7,4 @@ metadata:
data:
config: |
instanceID: argo-events
+ namespace: argo-events