argoevents

package module
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 2 Imported by: 4

README

Argo Events - The Event-Based Dependency Manager for Kubernetes

Go Report Card slack Build Status Coverage Status GoDoc License

Logo

What is Argo Events?

Argo Events is an event-based dependency manager for Kubernetes which helps you define multiple dependencies from a variety of event sources like webhook, s3, schedules, streams etc. and trigger Kubernetes objects after successful event dependencies resolution.



High Level Overview


Features

  • Manage dependencies from a variety of event sources.
  • Ability to customize business-level constraint logic for event dependencies resolution.
  • Manage everything from simple, linear, real-time dependencies to complex, multi-source, batch job dependencies.
  • Ability to extends framework to add your own event source listener.
  • Define arbitrary boolean logic to resolve event dependencies.
  • CloudEvents compliant.
  • Ability to manage event sources at runtime.

Core Concepts

The framework is made up of two components:

  1. Gateway which is implemented as a Kubernetes-native Custom Resource Definition processes events from event source.

  2. Sensor which is implemented as a Kubernetes-native Custom Resource Definition defines a set of event dependencies and triggers K8s resources.

Install

  • Requirements
    • Kubernetes cluster >v1.9
    • Installed the kubectl command-line tool >v1.9.0
  • Helm Chart

    Make sure you have helm client installed and Tiller server is running. To install helm, follow https://docs.helm.sh/using_helm/

    1. Add argoproj repository
    helm repo add argo https://argoproj.github.io/argo-helm
    
    1. Install argo-events chart
    helm install argo/argo-events
    
  • Using kubectl
    • Deploy Argo Events SA, Roles, ConfigMap, Sensor Controller and Gateway Controller

      kubectl create namespace argo-events
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/argo-events-sa.yaml
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/argo-events-cluster-roles.yaml
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/sensor-crd.yaml
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/gateway-crd.yaml
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/sensor-controller-configmap.yaml
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/sensor-controller-deployment.yaml
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/gateway-controller-configmap.yaml
      kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/hack/k8s/manifests/gateway-controller-deployment.yaml
      

Note: If you have already deployed the argo workflow controller in another namespace and the controller is namespace scoped, make sure to deploy a new controller in argo-events namespace.

Get Started

Lets deploy a webhook gateway and sensor,

  • First, we need to setup event sources for gateway to listen. The event sources for any gateway are managed using K8s configmap.

    kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/webhook-gateway-configmap.yaml 
    
  • Create webhook gateway,

     kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/gateways/webhook-http.yaml
    

    After running above command, gateway controller will create corresponding gateway pod and a LoadBalancing service.

  • Create webhook sensor,

    kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/webhook-http.yaml
    

    Once sensor resource is created, sensor controller will create corresponding sensor pod and a ClusterIP service.

  • Once the gateway and sensor pods are running, trigger the webhook via a http POST request to /foo endpoint. Note: the WEBHOOK_SERVICE_URL will differ based on the Kubernetes cluster.

     export WEBHOOK_SERVICE_URL=$(minikube service -n argo-events --url <gateway_service_name>)
     echo $WEBHOOK_SERVICE_URL
     curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST $WEBHOOK_SERVICE_URL/foo
    

    Note:

    • If you are facing an issue getting service url by running minikube service -n argo-events --url <gateway_service_name>, you can use kubectl port-forward
    • Open another terminal window and enter kubectl port-forward -n argo-events <name_of_the_webhook_gateway_pod> 9003:<port_on_which_gateway_server_is_running>
    • You can now use localhost:9003 to query webhook gateway

    Verify that the Argo workflow was run when the trigger was executed.

    argo list -n argo-events
    
  • More examples can be found at examples

Further Reading

  1. Gateway
  2. Sensor
  3. Trigger
  4. Communication between gateway and sensor
  5. Controllers

Contribute

Read and abide by the Argo Events Code of Conduct

Contributions are more than welcome, if you are interested please take a look at our Contributing Guidelines.

License

Apache License Version 2.0, see LICENSE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Version

type Version struct {
	Version      string
	BuildDate    string
	GitCommit    string
	GitTag       string
	GitTreeState string
	GoVersion    string
	Compiler     string
	Platform     string
}

Version contains Argo-Events version information

func GetVersion

func GetVersion() Version

GetVersion returns the version information

func (Version) String

func (v Version) String() string

String outputs the version as a string

Directories

Path Synopsis
cmd
controllers
cmd
common
Package common contains structs and methods that are shared across different gateways.
Package common contains structs and methods that are shared across different gateways.
pkg
apis/common
+k8s:deepcopy-gen=package
+k8s:deepcopy-gen=package
apis/gateway/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
apis/sensor/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
client/gateway/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/gateway/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/gateway/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/gateway/clientset/versioned/typed/gateway/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/gateway/clientset/versioned/typed/gateway/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
client/sensor/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/sensor/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/sensor/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/sensor/clientset/versioned/typed/sensor/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/sensor/clientset/versioned/typed/sensor/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL