数据结构
31 分钟阅读
简要概述
TODO;
github.com/argoproj/argo-events/pkg/apis/eventsource/v1alpha1
事件源
EventSource
https://github.com/argoproj/argo-events/blob/master/pkg/apis/eventsource/v1alpha1/types.go
type EventSource struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
Spec EventSourceSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
// +optional
Status EventSourceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
EventSourceSpec
// EventSourceSpec refers to specification of event-source resource
type EventSourceSpec struct {
// EventBusName references to a EventBus name. By default the value is "default"
EventBusName string `json:"eventBusName,omitempty" protobuf:"bytes,1,opt,name=eventBusName"`
// Template is the pod specification for the event source
// +optional
Template *Template `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"`
// Service is the specifications of the service to expose the event source
// +optional
Service *Service `json:"service,omitempty" protobuf:"bytes,3,opt,name=service"`
// Minio event sources
Minio map[string]apicommon.S3Artifact `json:"minio,omitempty" protobuf:"bytes,4,rep,name=minio"`
// Calendar event sources
Calendar map[string]CalendarEventSource `json:"calendar,omitempty" protobuf:"bytes,5,rep,name=calendar"`
// File event sources
File map[string]FileEventSource `json:"file,omitempty" protobuf:"bytes,6,rep,name=file"`
// Resource event sources
Resource map[string]ResourceEventSource `json:"resource,omitempty" protobuf:"bytes,7,rep,name=resource"`
// Webhook event sources
Webhook map[string]WebhookEventSource `json:"webhook,omitempty" protobuf:"bytes,8,rep,name=webhook"`
// AMQP event sources
AMQP map[string]AMQPEventSource `json:"amqp,omitempty" protobuf:"bytes,9,rep,name=amqp"`
// Kafka event sources
Kafka map[string]KafkaEventSource `json:"kafka,omitempty" protobuf:"bytes,10,rep,name=kafka"`
// MQTT event sources
MQTT map[string]MQTTEventSource `json:"mqtt,omitempty" protobuf:"bytes,11,rep,name=mqtt"`
// NATS event sources
NATS map[string]NATSEventsSource `json:"nats,omitempty" protobuf:"bytes,12,rep,name=nats"`
// SNS event sources
SNS map[string]SNSEventSource `json:"sns,omitempty" protobuf:"bytes,13,rep,name=sns"`
// SQS event sources
SQS map[string]SQSEventSource `json:"sqs,omitempty" protobuf:"bytes,14,rep,name=sqs"`
// PubSub event sources
PubSub map[string]PubSubEventSource `json:"pubSub,omitempty" protobuf:"bytes,15,rep,name=pubSub"`
// Github event sources
Github map[string]GithubEventSource `json:"github,omitempty" protobuf:"bytes,16,rep,name=github"`
// Gitlab event sources
Gitlab map[string]GitlabEventSource `json:"gitlab,omitempty" protobuf:"bytes,17,rep,name=gitlab"`
// HDFS event sources
HDFS map[string]HDFSEventSource `json:"hdfs,omitempty" protobuf:"bytes,18,rep,name=hdfs"`
// Slack event sources
Slack map[string]SlackEventSource `json:"slack,omitempty" protobuf:"bytes,19,rep,name=slack"`
// StorageGrid event sources
StorageGrid map[string]StorageGridEventSource `json:"storageGrid,omitempty" protobuf:"bytes,20,rep,name=storageGrid"`
// AzureEventsHub event sources
AzureEventsHub map[string]AzureEventsHubEventSource `json:"azureEventsHub,omitempty" protobuf:"bytes,21,rep,name=azureEventsHub"`
// Stripe event sources
Stripe map[string]StripeEventSource `json:"stripe,omitempty" protobuf:"bytes,22,rep,name=stripe"`
// Emitter event source
Emitter map[string]EmitterEventSource `json:"emitter,omitempty" protobuf:"bytes,23,rep,name=emitter"`
// Redis event source
Redis map[string]RedisEventSource `json:"redis,omitempty" protobuf:"bytes,24,rep,name=redis"`
// NSQ event source
NSQ map[string]NSQEventSource `json:"nsq,omitempty" protobuf:"bytes,25,rep,name=nsq"`
// Pulsar event source
Pulsar map[string]PulsarEventSource `json:"pulsar,omitempty" protobuf:"bytes,26,opt,name=pulsar"`
// Generic event source
Generic map[string]GenericEventSource `json:"generic,omitempty" protobuf:"bytes,27,rep,name=generic"`
// Replicas is the event source deployment replicas
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,28,opt,name=replicas"`
// Bitbucket Server event sources
BitbucketServer map[string]BitbucketServerEventSource `json:"bitbucketserver,omitempty" protobuf:"bytes,29,rep,name=bitbucketserver"`
// Bitbucket event sources
Bitbucket map[string]BitbucketEventSource `json:"bitbucket,omitempty" protobuf:"bytes,30,rep,name=bitbucket"`
// Redis stream source
RedisStream map[string]RedisStreamEventSource `json:"redisStream,omitempty" protobuf:"bytes,31,rep,name=redisStream"`
// Azure Service Bus event source
AzureServiceBus map[string]AzureServiceBusEventSource `json:"azureServiceBus,omitempty" protobuf:"bytes,32,rep,name=azureServiceBus"`
// AzureQueueStorage event source
AzureQueueStorage map[string]AzureQueueStorageEventSource `json:"azureQueueStorage,omitempty" protobuf:"bytes,33,rep,name=azureQueueStorage"`
// SFTP event sources
SFTP map[string]SFTPEventSource `json:"sftp,omitempty" protobuf:"bytes,34,rep,name=sftp"`
// Gerrit event source
Gerrit map[string]GerritEventSource `json:"gerrit,omitempty" protobuf:"bytes,35,rep,name=gerrit"`
}
Template
// Template holds the information of an EventSource deployment template
type Template struct {
// Metadata sets the pods's metadata, i.e. annotations and labels
Metadata *apicommon.Metadata `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// ServiceAccountName is the name of the ServiceAccount to use to run event source pod.
// More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,2,opt,name=serviceAccountName"`
// Container is the main container image to run in the event source pod
// +optional
Container *corev1.Container `json:"container,omitempty" protobuf:"bytes,3,opt,name=container"`
// Volumes is a list of volumes that can be mounted by containers in an eventsource.
// +patchStrategy=merge
// +patchMergeKey=name
// +optional
Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,4,rep,name=volumes"`
// SecurityContext holds pod-level security attributes and common container settings.
// Optional: Defaults to empty. See type description for default values of each field.
// +optional
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty" protobuf:"bytes,5,opt,name=securityContext"`
// If specified, the pod's scheduling constraints
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,6,opt,name=affinity"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,7,rep,name=tolerations"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,8,rep,name=nodeSelector"`
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
// in the case of docker, only DockerConfig type secrets are honored.
// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
// +optional
// +patchMergeKey=name
// +patchStrategy=merge
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,9,rep,name=imagePullSecrets"`
// If specified, indicates the EventSource pod's priority. "system-node-critical"
// and "system-cluster-critical" are two special keywords which indicate the
// highest priorities with the former being the highest priority. Any other
// name must be defined by creating a PriorityClass object with that name.
// If not specified, the pod priority will be default or zero if there is no
// default.
// More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
// +optional
PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,10,opt,name=priorityClassName"`
// The priority value. Various system components use this field to find the
// priority of the EventSource pod. When Priority Admission Controller is enabled,
// it prevents users from setting this field. The admission controller populates
// this field from PriorityClassName.
// The higher the value, the higher the priority.
// More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
// +optional
Priority *int32 `json:"priority,omitempty" protobuf:"bytes,11,opt,name=priority"`
}
以上 “corev1” 类型均为 “k8s.io/api/core/v1” 下数据结构。
Service
// Service holds the service information eventsource exposes
type Service struct {
// The list of ports that are exposed by this ClusterIP service.
// +patchMergeKey=port
// +patchStrategy=merge
// +listType=map
// +listMapKey=port
// +listMapKey=protocol
Ports []corev1.ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"`
// clusterIP is the IP address of the service and is usually assigned
// randomly by the master. If an address is specified manually and is not in
// use by others, it will be allocated to the service; otherwise, creation
// of the service will fail. This field can not be changed through updates.
// Valid values are "None", empty string (""), or a valid IP address. "None"
// can be specified for headless services when proxying is not required.
// More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
// +optional
ClusterIP string `json:"clusterIP,omitempty" protobuf:"bytes,2,opt,name=clusterIP"`
}
CalendarEventSource
// CalendarEventSource describes a time based dependency. One of the fields (schedule, interval, or recurrence) must be passed.
// Schedule takes precedence over interval; interval takes precedence over recurrence
type CalendarEventSource struct {
// Schedule is a cron-like expression. For reference, see: https://en.wikipedia.org/wiki/Cron
// +optional
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
// Interval is a string that describes an interval duration, e.g. 1s, 30m, 2h...
// +optional
Interval string `json:"interval" protobuf:"bytes,2,opt,name=interval"`
// ExclusionDates defines the list of DATE-TIME exceptions for recurring events.
ExclusionDates []string `json:"exclusionDates,omitempty" protobuf:"bytes,3,rep,name=exclusionDates"`
// Timezone in which to run the schedule
// +optional
Timezone string `json:"timezone,omitempty" protobuf:"bytes,4,opt,name=timezone"`
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"`
// Persistence hold the configuration for event persistence
Persistence *EventPersistence `json:"persistence,omitempty" protobuf:"bytes,6,opt,name=persistence"`
// Filter
// +optional
Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"`
}
FileEventSource
// FileEventSource describes an event-source for file related events.
type FileEventSource struct {
// Type of file operations to watch
// Refer https://github.com/fsnotify/fsnotify/blob/master/fsnotify.go for more information
EventType string `json:"eventType" protobuf:"bytes,1,opt,name=eventType"`
// WatchPathConfig contains configuration about the file path to watch
WatchPathConfig WatchPathConfig `json:"watchPathConfig" protobuf:"bytes,2,opt,name=watchPathConfig"`
// Use polling instead of inotify
Polling bool `json:"polling,omitempty" protobuf:"varint,3,opt,name=polling"`
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,4,rep,name=metadata"`
// Filter
// +optional
Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,5,opt,name=filter"`
}
ResourceEventSource
// ResourceEventType is the type of event for the K8s resource mutation
type ResourceEventType string
// possible values of ResourceEventType
const (
ADD ResourceEventType = "ADD"
UPDATE ResourceEventType = "UPDATE"
DELETE ResourceEventType = "DELETE"
)
// ResourceEventSource refers to a event-source for K8s resource related events.
type ResourceEventSource struct {
// Namespace where resource is deployed
Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"`
// Filter is applied on the metadata of the resource
// If you apply filter, then the internal event informer will only monitor objects that pass the filter.
// +optional
Filter *ResourceFilter `json:"filter,omitempty" protobuf:"bytes,2,opt,name=filter"`
// Group of the resource
metav1.GroupVersionResource `json:",inline" protobuf:"bytes,3,opt,name=groupVersionResource"`
// EventTypes is the list of event type to watch.
// Possible values are - ADD, UPDATE and DELETE.
EventTypes []ResourceEventType `json:"eventTypes" protobuf:"bytes,4,rep,name=eventTypes,casttype=ResourceEventType"`
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"`
}
WebhookEventSource
// CalendarEventSource describes an HTTP based EventSource
type WebhookEventSource struct {
WebhookContext `json:",inline" protobuf:"bytes,1,opt,name=webhookContext"`
// Filter
// +optional
Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,2,opt,name=filter"`
}
// WebhookContext holds a general purpose REST API context
type WebhookContext struct {
// REST API endpoint
Endpoint string `json:"endpoint" protobuf:"bytes,1,opt,name=endpoint"`
// Method is HTTP request method that indicates the desired action to be performed for a given resource.
// See RFC7231 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
Method string `json:"method" protobuf:"bytes,2,opt,name=method"`
// Port on which HTTP server is listening for incoming events.
Port string `json:"port" protobuf:"bytes,3,opt,name=port"`
// URL is the url of the server.
URL string `json:"url" protobuf:"bytes,4,opt,name=url"`
// ServerCertPath refers the file that contains the cert.
ServerCertSecret *corev1.SecretKeySelector `json:"serverCertSecret,omitempty" protobuf:"bytes,5,opt,name=serverCertSecret"`
// ServerKeyPath refers the file that contains private key
ServerKeySecret *corev1.SecretKeySelector `json:"serverKeySecret,omitempty" protobuf:"bytes,6,opt,name=serverKeySecret"`
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"`
// AuthSecret holds a secret selector that contains a bearer token for authentication
// +optional
AuthSecret *corev1.SecretKeySelector `json:"authSecret,omitempty" protobuf:"bytes,8,opt,name=authSecret"`
// MaxPayloadSize is the maximum webhook payload size that the server will accept.
// Requests exceeding that limit will be rejected with "request too large" response.
// Default value: 1048576 (1MB).
// +optional
MaxPayloadSize *int64 `json:"maxPayloadSize,omitempty" protobuf:"bytes,9,opt,name=maxPayloadSize"`
}
KafkaEventSource
// KafkaEventSource refers to event-source for Kafka related events
type KafkaEventSource struct {
// URL to kafka cluster, multiple URLs separated by comma
// 连接 kafka 集群,多个使用 "," 分割,如:10.5.119.40:9092,10.5.119.96:9092,10.5.119.235:9092
URL string `json:"url" protobuf:"bytes,1,opt,name=url"`
// Partition name
// +optional
Partition string `json:"partition" protobuf:"bytes,2,opt,name=partition"`
// Topic name
Topic string `json:"topic" protobuf:"bytes,3,opt,name=topic"`
// Backoff holds parameters applied to connection.
ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,4,opt,name=connectionBackoff"`
// TLS configuration for the kafka client.
// +optional
TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,5,opt,name=tls"`
// JSONBody specifies that all event body payload coming from this
// source will be JSON
// +optional
JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,6,opt,name=jsonBody"`
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"`
// Consumer group for kafka client
// +optional
ConsumerGroup *KafkaConsumerGroup `json:"consumerGroup,omitempty" protobuf:"bytes,8,opt,name=consumerGroup"`
// Sets a limit on how many events get read from kafka per second.
// +optional
LimitEventsPerSecond int64 `json:"limitEventsPerSecond,omitempty" protobuf:"varint,9,opt,name=limitEventsPerSecond"`
// Specify what kafka version is being connected to enables certain features in sarama, defaults to 1.0.0
// +optional
Version string `json:"version" protobuf:"bytes,10,opt,name=version"`
// SASL configuration for the kafka client
// +optional
SASL *apicommon.SASLConfig `json:"sasl,omitempty" protobuf:"bytes,11,opt,name=sasl"`
// Filter
// +optional
Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,12,opt,name=filter"`
// Yaml format Sarama config for Kafka connection.
// It follows the struct of sarama.Config. See https://github.com/IBM/sarama/blob/main/config.go
// e.g.
//
// consumer:
// fetch:
// min: 1
// net:
// MaxOpenRequests: 5
//
// +optional
Config string `json:"config,omitempty" protobuf:"bytes,13,opt,name=config"`
}
apicommon.SASLConfig
github.com/argoproj/argo-events/pkg/apis/common
// SASLConfig refers to SASL configuration for a client
type SASLConfig struct {
// SASLMechanism is the name of the enabled SASL mechanism.
// Possible values: OAUTHBEARER, PLAIN (defaults to PLAIN).
// +optional
Mechanism string `json:"mechanism,omitempty" protobuf:"bytes,1,opt,name=mechanism"`
// User is the authentication identity (authcid) to present for
// SASL/PLAIN or SASL/SCRAM authentication
UserSecret *corev1.SecretKeySelector `json:"userSecret,omitempty" protobuf:"bytes,2,opt,name=userSecret"`
// Password for SASL/PLAIN authentication
PasswordSecret *corev1.SecretKeySelector `json:"passwordSecret,omitempty" protobuf:"bytes,3,opt,name=passwordSecret"`
}
GitlabEventSource
TODO;
RedisEventSource
// RedisEventSource describes an event source for the Redis PubSub.
// More info at https://godoc.org/github.com/go-redis/redis#example-PubSub
type RedisEventSource struct {
// HostAddress refers to the address of the Redis host/server
HostAddress string `json:"hostAddress" protobuf:"bytes,1,opt,name=hostAddress"`
// Password required for authentication if any.
// +optional
Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,2,opt,name=password"`
// Namespace to use to retrieve the password from. It should only be specified if password is declared
// +optional
Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
// DB to use. If not specified, default DB 0 will be used.
// +optional
DB int32 `json:"db,omitempty" protobuf:"varint,4,opt,name=db"`
// Channels to subscribe to listen events.
Channels []string `json:"channels" protobuf:"bytes,5,rep,name=channels"`
// TLS configuration for the redis client.
// +optional
TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,6,opt,name=tls"`
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"`
// Filter
// +optional
Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"`
// JSONBody specifies that all event body payload coming from this
// source will be JSON
// +optional
JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,9,opt,name=jsonBody"`
// Username required for ACL style authentication if any.
// +optional
Username string `json:"username,omitempty" protobuf:"bytes,10,opt,name=username"`
}
GenericEventSource
// GenericEventSource refers to a generic event source. It can be used to implement a custom event source.
type GenericEventSource struct {
// URL of the gRPC server that implements the event source.
URL string `json:"url" protobuf:"bytes,1,name=url"`
// Config is the event source configuration
Config string `json:"config" protobuf:"bytes,2,name=config"`
// Insecure determines the type of connection.
Insecure bool `json:"insecure,omitempty" protobuf:"varint,3,opt,name=insecure"`
// JSONBody specifies that all event body payload coming from this
// source will be JSON
// +optional
JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,4,opt,name=jsonBody"`
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"`
// AuthSecret holds a secret selector that contains a bearer token for authentication
// +optional
AuthSecret *corev1.SecretKeySelector `json:"authSecret,omitempty" protobuf:"bytes,6,opt,name=authSecret"`
// Filter
// +optional
Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,7,opt,name=filter"`
}
RedisStreamEventSource
TODO;
事件总线
EventBus
https://github.com/argoproj/argo-events/blob/master/pkg/apis/eventbus/v1alpha1/eventbus_types.go
// EventBus is the definition of a eventbus resource
type EventBus struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
Spec EventBusSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
// +optional
Status EventBusStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
EventBusSpec
// EventBusSpec refers to specification of eventbus resource
type EventBusSpec struct {
// NATS eventbus
// +optional
NATS *NATSBus `json:"nats,omitempty" protobuf:"bytes,1,opt,name=nats"`
// +optional
JetStream *JetStreamBus `json:"jetstream,omitempty" protobuf:"bytes,2,opt,name=jetstream"`
// +optional
// Kafka eventbus
Kafka *KafkaBus `json:"kafka,omitempty" protobuf:"bytes,3,opt,name=kafka"`
// Exotic JetStream
// +optional
JetStreamExotic *JetStreamConfig `json:"jetstreamExotic,omitempty" protobuf:"bytes,4,opt,name=jetstreamExotic"`
}
NATSBus
https://github.com/argoproj/argo-events/blob/master/pkg/apis/eventbus/v1alpha1/nats_eventbus.go
// NATSBus holds the NATS eventbus information
type NATSBus struct {
// Native means to bring up a native NATS service
Native *NativeStrategy `json:"native,omitempty" protobuf:"bytes,1,opt,name=native"`
// Exotic holds an exotic NATS config
Exotic *NATSConfig `json:"exotic,omitempty" protobuf:"bytes,2,opt,name=exotic"`
}
NativeStrategy
// NativeStrategy indicates to install a native NATS service
type NativeStrategy struct {
// Size is the NATS StatefulSet size
Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
Auth *AuthStrategy `json:"auth,omitempty" protobuf:"bytes,2,opt,name=auth,casttype=AuthStrategy"`
// +optional
Persistence *PersistenceStrategy `json:"persistence,omitempty" protobuf:"bytes,3,opt,name=persistence"`
// ContainerTemplate contains customized spec for NATS container
// +optional
ContainerTemplate *ContainerTemplate `json:"containerTemplate,omitempty" protobuf:"bytes,4,opt,name=containerTemplate"`
// MetricsContainerTemplate contains customized spec for metrics container
// +optional
MetricsContainerTemplate *ContainerTemplate `json:"metricsContainerTemplate,omitempty" protobuf:"bytes,5,opt,name=metricsContainerTemplate"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,6,rep,name=nodeSelector"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,7,rep,name=tolerations"`
// Metadata sets the pods's metadata, i.e. annotations and labels
Metadata *common.Metadata `json:"metadata,omitempty" protobuf:"bytes,8,opt,name=metadata"`
// SecurityContext holds pod-level security attributes and common container settings.
// Optional: Defaults to empty. See type description for default values of each field.
// +optional
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty" protobuf:"bytes,9,opt,name=securityContext"`
// Max Age of existing messages, i.e. "72h", “4h35m”
// +optional
MaxAge *string `json:"maxAge,omitempty" protobuf:"bytes,10,opt,name=maxAge"`
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
// in the case of docker, only DockerConfig type secrets are honored.
// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
// +optional
// +patchMergeKey=name
// +patchStrategy=merge
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,11,rep,name=imagePullSecrets"`
// ServiceAccountName to apply to NATS StatefulSet
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,12,opt,name=serviceAccountName"`
// If specified, indicates the EventSource pod's priority. "system-node-critical"
// and "system-cluster-critical" are two special keywords which indicate the
// highest priorities with the former being the highest priority. Any other
// name must be defined by creating a PriorityClass object with that name.
// If not specified, the pod priority will be default or zero if there is no
// default.
// More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
// +optional
PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,13,opt,name=priorityClassName"`
// The priority value. Various system components use this field to find the
// priority of the EventSource pod. When Priority Admission Controller is enabled,
// it prevents users from setting this field. The admission controller populates
// this field from PriorityClassName.
// The higher the value, the higher the priority.
// More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
// +optional
Priority *int32 `json:"priority,omitempty" protobuf:"bytes,14,opt,name=priority"`
// The pod's scheduling constraints
// More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,15,opt,name=affinity"`
// Maximum number of messages per channel, 0 means unlimited. Defaults to 1000000
MaxMsgs *uint64 `json:"maxMsgs,omitempty" protobuf:"bytes,16,opt,name=maxMsgs"`
// Total size of messages per channel, 0 means unlimited. Defaults to 1GB
MaxBytes *string `json:"maxBytes,omitempty" protobuf:"bytes,17,opt,name=maxBytes"`
// Maximum number of subscriptions per channel, 0 means unlimited. Defaults to 1000
MaxSubs *uint64 `json:"maxSubs,omitempty" protobuf:"bytes,18,opt,name=maxSubs"`
// Maximum number of bytes in a message payload, 0 means unlimited. Defaults to 1MB
MaxPayload *string `json:"maxPayload,omitempty" protobuf:"bytes,19,opt,name=maxPayload"`
// Specifies the time in follower state without a leader before attempting an election, i.e. "72h", “4h35m”. Defaults to 2s
RaftHeartbeatTimeout *string `json:"raftHeartbeatTimeout,omitempty" protobuf:"bytes,20,opt,name=raftHeartbeatTimeout"`
// Specifies the time in candidate state without a leader before attempting an election, i.e. "72h", “4h35m”. Defaults to 2s
RaftElectionTimeout *string `json:"raftElectionTimeout,omitempty" protobuf:"bytes,21,opt,name=raftElectionTimeout"`
// Specifies how long a leader waits without being able to contact a quorum of nodes before stepping down as leader, i.e. "72h", “4h35m”. Defaults to 1s
RaftLeaseTimeout *string `json:"raftLeaseTimeout,omitempty" protobuf:"bytes,22,opt,name=raftLeaseTimeout"`
// Specifies the time without an Apply() operation before sending an heartbeat to ensure timely commit, i.e. "72h", “4h35m”. Defaults to 100ms
RaftCommitTimeout *string `json:"raftCommitTimeout,omitempty" protobuf:"bytes,23,opt,name=raftCommitTimeout"`
}
NATSConfig
// NATSConfig holds the config of NATS
type NATSConfig struct {
// NATS streaming url
URL string `json:"url,omitempty" protobuf:"bytes,1,opt,name=url"`
// Cluster ID for nats streaming
ClusterID *string `json:"clusterID,omitempty" protobuf:"bytes,2,opt,name=clusterID"`
// Auth strategy, default to AuthStrategyNone
// +optional
Auth *AuthStrategy `json:"auth,omitempty" protobuf:"bytes,3,opt,name=auth,casttype=AuthStrategy"`
// Secret for auth
// +optional
AccessSecret *corev1.SecretKeySelector `json:"accessSecret,omitempty" protobuf:"bytes,4,opt,name=accessSecret"`
}
JetStreamBus
https://github.com/argoproj/argo-events/blob/master/pkg/apis/eventbus/v1alpha1/jetstream_eventbus.go
// JetStreamBus holds the JetStream EventBus information
type JetStreamBus struct {
// JetStream version, such as "2.7.3"
Version string `json:"version,omitempty" protobuf:"bytes,1,opt,name=version"`
// JetStream StatefulSet size
// +kubebuilder:default=3
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
// ContainerTemplate contains customized spec for Nats JetStream container
// +optional
ContainerTemplate *ContainerTemplate `json:"containerTemplate,omitempty" protobuf:"bytes,3,opt,name=containerTemplate"`
// ReloaderContainerTemplate contains customized spec for config reloader container
// +optional
ReloaderContainerTemplate *ContainerTemplate `json:"reloaderContainerTemplate,omitempty" protobuf:"bytes,4,opt,name=reloaderContainerTemplate"`
// MetricsContainerTemplate contains customized spec for metrics container
// +optional
MetricsContainerTemplate *ContainerTemplate `json:"metricsContainerTemplate,omitempty" protobuf:"bytes,5,opt,name=metricsContainerTemplate"`
// +optional
Persistence *PersistenceStrategy `json:"persistence,omitempty" protobuf:"bytes,6,opt,name=persistence"`
// Metadata sets the pods's metadata, i.e. annotations and labels
Metadata *common.Metadata `json:"metadata,omitempty" protobuf:"bytes,7,opt,name=metadata"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,8,rep,name=nodeSelector"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,9,rep,name=tolerations"`
// SecurityContext holds pod-level security attributes and common container settings.
// Optional: Defaults to empty. See type description for default values of each field.
// +optional
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty" protobuf:"bytes,10,opt,name=securityContext"`
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
// in the case of docker, only DockerConfig type secrets are honored.
// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
// +optional
// +patchMergeKey=name
// +patchStrategy=merge
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,11,rep,name=imagePullSecrets"`
// If specified, indicates the Redis pod's priority. "system-node-critical"
// and "system-cluster-critical" are two special keywords which indicate the
// highest priorities with the former being the highest priority. Any other
// name must be defined by creating a PriorityClass object with that name.
// If not specified, the pod priority will be default or zero if there is no
// default.
// More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
// +optional
PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,12,opt,name=priorityClassName"`
// The priority value. Various system components use this field to find the
// priority of the Redis pod. When Priority Admission Controller is enabled,
// it prevents users from setting this field. The admission controller populates
// this field from PriorityClassName.
// The higher the value, the higher the priority.
// More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
// +optional
Priority *int32 `json:"priority,omitempty" protobuf:"bytes,13,opt,name=priority"`
// The pod's scheduling constraints
// More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,14,opt,name=affinity"`
// ServiceAccountName to apply to the StatefulSet
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,15,opt,name=serviceAccountName"`
// JetStream configuration, if not specified, global settings in controller-config will be used.
// See https://docs.nats.io/running-a-nats-service/configuration#jetstream.
// Only configure "max_memory_store" or "max_file_store", do not set "store_dir" as it has been hardcoded.
// +optional
Settings *string `json:"settings,omitempty" protobuf:"bytes,16,opt,name=settings"`
// Optional arguments to start nats-server. For example, "-D" to enable debugging output, "-DV" to enable debugging and tracing.
// Check https://docs.nats.io/ for all the available arguments.
// +optional
StartArgs []string `json:"startArgs,omitempty" protobuf:"bytes,17,rep,name=startArgs"`
// Optional configuration for the streams to be created in this JetStream service, if specified, it will be merged with the default configuration in controller-config.
// It accepts a YAML format configuration, available fields include, "maxBytes", "maxMsgs", "maxAge" (e.g. 72h), "replicas" (1, 3, 5), "duplicates" (e.g. 5m).
// +optional
StreamConfig *string `json:"streamConfig,omitempty" protobuf:"bytes,18,opt,name=streamConfig"`
// Maximum number of bytes in a message payload, 0 means unlimited. Defaults to 1MB
// +optional
MaxPayload *string `json:"maxPayload,omitempty" protobuf:"bytes,19,opt,name=maxPayload"`
}
KafkaBus
https://github.com/argoproj/argo-events/blob/master/pkg/apis/eventbus/v1alpha1/kafka_eventbus.go
// KafkaBus holds the KafkaBus EventBus information
type KafkaBus struct {
// URL to kafka cluster, multiple URLs separated by comma
URL string `json:"url,omitempty" protobuf:"bytes,1,opt,name=url"`
// Topic name, defaults to {namespace_name}-{eventbus_name}
// +optional
Topic string `json:"topic,omitempty" protobuf:"bytes,2,opt,name=topic"`
// Kafka version, sarama defaults to the oldest supported stable version
// +optional
Version string `json:"version,omitempty" protobuf:"bytes,3,opt,name=version"`
// TLS configuration for the kafka client.
// +optional
TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,4,opt,name=tls"`
// SASL configuration for the kafka client
// +optional
SASL *apicommon.SASLConfig `json:"sasl,omitempty" protobuf:"bytes,5,opt,name=sasl"`
// Consumer group for kafka client
// +optional
ConsumerGroup *KafkaConsumerGroup `json:"consumerGroup,omitempty" protobuf:"bytes,6,opt,name=consumerGroup"`
}
JetStreamConfig
type JetStreamConfig struct {
// JetStream (Nats) URL
URL string `json:"url,omitempty" protobuf:"bytes,1,opt,name=url"`
// Secret for auth
// +optional
AccessSecret *corev1.SecretKeySelector `json:"accessSecret,omitempty" protobuf:"bytes,2,opt,name=accessSecret"`
// +optional
StreamConfig string `json:"streamConfig,omitempty" protobuf:"bytes,3,opt,name=streamConfig"`
}
KafkaConsumerGroup
type KafkaConsumerGroup struct {
// Consumer group name, defaults to {namespace_name}-{sensor_name}
// +optional
GroupName string `json:"groupName,omitempty" protobuf:"bytes,1,opt,name=groupName"`
// Rebalance strategy can be one of: sticky, roundrobin, range. Range is the default.
// +optional
RebalanceStrategy string `json:"rebalanceStrategy,omitempty" protobuf:"bytes,2,opt,name=rebalanceStrategy"`
// When starting up a new group do we want to start from the oldest event (true) or the newest event (false), defaults to false
// +optional
StartOldest bool `json:"startOldest,omitempty" default:"false" protobuf:"bytes,3,opt,name=startOldest"`
}
传感器
Sensor
// Sensor is the definition of a sensor resource
type Sensor struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
Spec SensorSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
// +optional
Status SensorStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
SensorSpec
// SensorSpec represents desired sensor state
type SensorSpec struct {
// Dependencies is a list of the events that this sensor is dependent on.
Dependencies []EventDependency `json:"dependencies" protobuf:"bytes,1,rep,name=dependencies"`
// Triggers is a list of the things that this sensor evokes. These are the outputs from this sensor.
Triggers []Trigger `json:"triggers" protobuf:"bytes,2,rep,name=triggers"`
// Template is the pod specification for the sensor
// +optional
Template *Template `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
// ErrorOnFailedRound if set to true, marks sensor state as `error` if the previous trigger round fails.
// Once sensor state is set to `error`, no further triggers will be processed.
ErrorOnFailedRound bool `json:"errorOnFailedRound,omitempty" protobuf:"varint,4,opt,name=errorOnFailedRound"`
// EventBusName references to a EventBus name. By default the value is "default"
EventBusName string `json:"eventBusName,omitempty" protobuf:"bytes,5,opt,name=eventBusName"`
// Replicas is the sensor deployment replicas
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,6,opt,name=replicas"`
// RevisionHistoryLimit specifies how many old deployment revisions to retain
// +optional
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,7,opt,name=revisionHistoryLimit"`
// LoggingFields add additional key-value pairs when logging happens
// +optional
LoggingFields map[string]string `json:"loggingFields" protobuf:"bytes,8,rep,name=loggingFields"`
}
EventDependency
type LogicalOperator string
const (
AndLogicalOperator LogicalOperator = "and" // Equal to &&
OrLogicalOperator LogicalOperator = "or" // Equal to ||
EmptyLogicalOperator LogicalOperator = "" // Empty will default to AND (&&)
)
// EventDependency describes a dependency
type EventDependency struct {
// Name is a unique name of this dependency
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// EventSourceName is the name of EventSource that Sensor depends on
EventSourceName string `json:"eventSourceName" protobuf:"bytes,2,name=eventSourceName"`
// EventName is the name of the event
EventName string `json:"eventName" protobuf:"bytes,3,name=eventName"`
// Filters and rules governing toleration of success and constraints on the context and data of an event
Filters *EventDependencyFilter `json:"filters,omitempty" protobuf:"bytes,4,opt,name=filters"`
// Transform transforms the event data
Transform *EventDependencyTransformer `json:"transform,omitempty" protobuf:"bytes,5,opt,name=transform"`
// FiltersLogicalOperator defines how different filters are evaluated together.
// Available values: and (&&), or (||)
// Is optional and if left blank treated as and (&&).
FiltersLogicalOperator LogicalOperator `json:"filtersLogicalOperator,omitempty" protobuf:"bytes,6,opt,name=filtersLogicalOperator,casttype=LogicalOperator"`
}
EventDependencyFilter
// EventDependencyFilter defines filters and constraints for a event.
type EventDependencyFilter struct {
// Time filter on the event with escalation
Time *TimeFilter `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
// Context filter constraints
Context *EventContext `json:"context,omitempty" protobuf:"bytes,2,opt,name=context"`
// Data filter constraints with escalation
Data []DataFilter `json:"data,omitempty" protobuf:"bytes,3,rep,name=data"`
// Exprs contains the list of expressions evaluated against the event payload.
Exprs []ExprFilter `json:"exprs,omitempty" protobuf:"bytes,4,rep,name=exprs"`
// DataLogicalOperator defines how multiple Data filters (if defined) are evaluated together.
// Available values: and (&&), or (||)
// Is optional and if left blank treated as and (&&).
DataLogicalOperator LogicalOperator `json:"dataLogicalOperator,omitempty" protobuf:"bytes,5,opt,name=dataLogicalOperator,casttype=DataLogicalOperator"`
// ExprLogicalOperator defines how multiple Exprs filters (if defined) are evaluated together.
// Available values: and (&&), or (||)
// Is optional and if left blank treated as and (&&).
ExprLogicalOperator LogicalOperator `json:"exprLogicalOperator,omitempty" protobuf:"bytes,6,opt,name=exprLogicalOperator,casttype=ExprLogicalOperator"`
// Script refers to a Lua script evaluated to determine the validity of an event.
Script string `json:"script,omitempty" protobuf:"bytes,7,opt,name=script"`
}
EventDependencyTransformer
// EventDependencyTransformer transforms the event
type EventDependencyTransformer struct {
// JQ holds the jq command applied for transformation
// +optional
JQ string `json:"jq,omitempty" protobuf:"bytes,1,opt,name=jq"`
// Script refers to a Lua script used to transform the event
// +optional
Script string `json:"script,omitempty" protobuf:"bytes,2,opt,name=script"`
}
触发器
Trigger
// Trigger is an action taken, output produced, an event created, a message sent
type Trigger struct {
// Template describes the trigger specification.
Template *TriggerTemplate `json:"template,omitempty" protobuf:"bytes,1,opt,name=template"`
// Parameters is the list of parameters applied to the trigger template definition
Parameters []TriggerParameter `json:"parameters,omitempty" protobuf:"bytes,2,rep,name=parameters"`
// Policy to configure backoff and execution criteria for the trigger
// +optional
Policy *TriggerPolicy `json:"policy,omitempty" protobuf:"bytes,3,opt,name=policy"`
// Retry strategy, defaults to no retry
// +optional
RetryStrategy *apicommon.Backoff `json:"retryStrategy,omitempty" protobuf:"bytes,4,opt,name=retryStrategy"`
// Rate limit, default unit is Second
// +optional
RateLimit *RateLimit `json:"rateLimit,omitempty" protobuf:"bytes,5,opt,name=rateLimit"`
// AtLeastOnce determines the trigger execution semantics.
// Defaults to false. Trigger execution will use at-most-once semantics.
// If set to true, Trigger execution will switch to at-least-once semantics.
// +kubebuilder:default=false
// +optional
AtLeastOnce bool `json:"atLeastOnce,omitempty" protobuf:"varint,6,opt,name=atLeastOnce"`
}
TriggerTemplate
// TriggerTemplate is the template that describes trigger specification.
type TriggerTemplate struct {
// Name is a unique name of the action to take.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Conditions is the conditions to execute the trigger.
// For example: "(dep01 || dep02) && dep04"
// +optional
Conditions string `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"`
// StandardK8STrigger refers to the trigger designed to create or update a generic Kubernetes resource.
// +optional
K8s *StandardK8STrigger `json:"k8s,omitempty" protobuf:"bytes,3,opt,name=k8s"`
// ArgoWorkflow refers to the trigger that can perform various operations on an Argo workflow.
// +optional
ArgoWorkflow *ArgoWorkflowTrigger `json:"argoWorkflow,omitempty" protobuf:"bytes,4,opt,name=argoWorkflow"`
// HTTP refers to the trigger designed to dispatch a HTTP request with on-the-fly constructable payload.
// +optional
HTTP *HTTPTrigger `json:"http,omitempty" protobuf:"bytes,5,opt,name=http"`
// AWSLambda refers to the trigger designed to invoke AWS Lambda function with with on-the-fly constructable payload.
// +optional
AWSLambda *AWSLambdaTrigger `json:"awsLambda,omitempty" protobuf:"bytes,6,opt,name=awsLambda"`
// CustomTrigger refers to the trigger designed to connect to a gRPC trigger server and execute a custom trigger.
// +optional
CustomTrigger *CustomTrigger `json:"custom,omitempty" protobuf:"bytes,7,opt,name=custom"`
// Kafka refers to the trigger designed to place messages on Kafka topic.
// +optional.
Kafka *KafkaTrigger `json:"kafka,omitempty" protobuf:"bytes,8,opt,name=kafka"`
// NATS refers to the trigger designed to place message on NATS subject.
// +optional.
NATS *NATSTrigger `json:"nats,omitempty" protobuf:"bytes,9,opt,name=nats"`
// Slack refers to the trigger designed to send slack notification message.
// +optional
Slack *SlackTrigger `json:"slack,omitempty" protobuf:"bytes,10,opt,name=slack"`
// OpenWhisk refers to the trigger designed to invoke OpenWhisk action.
// +optional
OpenWhisk *OpenWhiskTrigger `json:"openWhisk,omitempty" protobuf:"bytes,11,opt,name=openWhisk"`
// Log refers to the trigger designed to invoke log the event.
// +optional
Log *LogTrigger `json:"log,omitempty" protobuf:"bytes,12,opt,name=log"`
// AzureEventHubs refers to the trigger send an event to an Azure Event Hub.
// +optional
AzureEventHubs *AzureEventHubsTrigger `json:"azureEventHubs,omitempty" protobuf:"bytes,13,opt,name=azureEventHubs"`
// Pulsar refers to the trigger designed to place messages on Pulsar topic.
// +optional
Pulsar *PulsarTrigger `json:"pulsar,omitempty" protobuf:"bytes,14,opt,name=pulsar"`
// Criteria to reset the conditons
// +optional
ConditionsReset []ConditionsResetCriteria `json:"conditionsReset,omitempty" protobuf:"bytes,15,rep,name=conditionsReset"`
// AzureServiceBus refers to the trigger designed to place messages on Azure Service Bus
// +optional
AzureServiceBus *AzureServiceBusTrigger `json:"azureServiceBus,omitempty" protobuf:"bytes,16,opt,name=azureServiceBus"`
// Email refers to the trigger designed to send an email notification
// +optional
Email *EmailTrigger `json:"email,omitempty" protobuf:"bytes,17,opt,name=email"`
}
TriggerParameter
// TriggerParameterOperation represents how to set a trigger destination
// resource key
type TriggerParameterOperation string
const (
// TriggerParameterOpNone is the zero value of TriggerParameterOperation
TriggerParameterOpNone TriggerParameterOperation = ""
// TriggerParameterOpAppend means append the new value to the existing
TriggerParameterOpAppend TriggerParameterOperation = "append"
// TriggerParameterOpOverwrite means overwrite the existing value with the new
TriggerParameterOpOverwrite TriggerParameterOperation = "overwrite"
// TriggerParameterOpPrepend means prepend the new value to the existing
TriggerParameterOpPrepend TriggerParameterOperation = "prepend"
)
// TriggerParameter indicates a passed parameter to a service template
type TriggerParameter struct {
// Src contains a source reference to the value of the parameter from a dependency
Src *TriggerParameterSource `json:"src,omitempty" protobuf:"bytes,1,opt,name=src"`
// Dest is the JSONPath of a resource key.
// A path is a series of keys separated by a dot. The colon character can be escaped with '.'
// The -1 key can be used to append a value to an existing array.
// See https://github.com/tidwall/sjson#path-syntax for more information about how this is used.
Dest string `json:"dest" protobuf:"bytes,2,opt,name=dest"`
// Operation is what to do with the existing value at Dest, whether to
// 'prepend', 'overwrite', or 'append' it.
Operation TriggerParameterOperation `json:"operation,omitempty" protobuf:"bytes,3,opt,name=operation,casttype=TriggerParameterOperation"`
}
TriggerParameterSource
// TriggerParameterSource defines the source for a parameter from a event event
type TriggerParameterSource struct {
// DependencyName refers to the name of the dependency. The event which is stored for this dependency is used as payload
// for the parameterization. Make sure to refer to one of the dependencies you have defined under Dependencies list.
DependencyName string `json:"dependencyName" protobuf:"bytes,1,opt,name=dependencyName"`
// ContextKey is the JSONPath of the event's (JSON decoded) context key
// ContextKey is a series of keys separated by a dot. A key may contain wildcard characters '*' and '?'.
// To access an array value use the index as the key. The dot and wildcard characters can be escaped with '\\'.
// See https://github.com/tidwall/gjson#path-syntax for more information on how to use this.
ContextKey string `json:"contextKey,omitempty" protobuf:"bytes,2,opt,name=contextKey"`
// ContextTemplate is a go-template for extracting a string from the event's context.
// If a ContextTemplate is provided with a ContextKey, the template will be evaluated first and fallback to the ContextKey.
// The templating follows the standard go-template syntax as well as sprig's extra functions.
// See https://pkg.go.dev/text/template and https://masterminds.github.io/sprig/
ContextTemplate string `json:"contextTemplate,omitempty" protobuf:"bytes,3,opt,name=contextTemplate"`
// DataKey is the JSONPath of the event's (JSON decoded) data key
// DataKey is a series of keys separated by a dot. A key may contain wildcard characters '*' and '?'.
// To access an array value use the index as the key. The dot and wildcard characters can be escaped with '\\'.
// See https://github.com/tidwall/gjson#path-syntax for more information on how to use this.
DataKey string `json:"dataKey,omitempty" protobuf:"bytes,4,opt,name=dataKey"`
// DataTemplate is a go-template for extracting a string from the event's data.
// If a DataTemplate is provided with a DataKey, the template will be evaluated first and fallback to the DataKey.
// The templating follows the standard go-template syntax as well as sprig's extra functions.
// See https://pkg.go.dev/text/template and https://masterminds.github.io/sprig/
DataTemplate string `json:"dataTemplate,omitempty" protobuf:"bytes,5,opt,name=dataTemplate"`
// Value is the default literal value to use for this parameter source
// This is only used if the DataKey is invalid.
// If the DataKey is invalid and this is not defined, this param source will produce an error.
Value *string `json:"value,omitempty" protobuf:"bytes,6,opt,name=value"`
// UseRawData indicates if the value in an event at data key should be used without converting to string.
// When true, a number, boolean, json or string parameter may be extracted. When the field is unspecified, or explicitly
// false, the behavior is to turn the extracted field into a string. (e.g. when set to true, the parameter
// 123 will resolve to the numerical type, but when false, or not provided, the string "123" will be resolved)
// +optional
UseRawData bool `json:"useRawData,omitempty" protobuf:"bytes,7,opt,name=useRawData"`
}
TriggerPolicy
// TriggerPolicy dictates the policy for the trigger retries
type TriggerPolicy struct {
// K8SResourcePolicy refers to the policy used to check the state of K8s based triggers using using labels
K8s *K8SResourcePolicy `json:"k8s,omitempty" protobuf:"bytes,1,opt,name=k8s"`
// Status refers to the policy used to check the state of the trigger using response status
Status *StatusPolicy `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
}
// K8SResourcePolicy refers to the policy used to check the state of K8s based triggers using labels
type K8SResourcePolicy struct {
// Labels required to identify whether a resource is in success state
Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,1,rep,name=labels"`
// Backoff before checking resource state
Backoff *apicommon.Backoff `json:"backoff" protobuf:"bytes,2,opt,name=backoff"`
// ErrorOnBackoffTimeout determines whether sensor should transition to error state if the trigger policy is unable to determine
// the state of the resource
ErrorOnBackoffTimeout bool `json:"errorOnBackoffTimeout" protobuf:"varint,3,opt,name=errorOnBackoffTimeout"`
}
// StatusPolicy refers to the policy used to check the state of the trigger using response status
type StatusPolicy struct {
// Allow refers to the list of allowed response statuses. If the response status of the trigger is within the list,
// the trigger will marked as successful else it will result in trigger failure.
Allow []int32 `json:"allow" protobuf:"varint,1,rep,name=allow"`
}
ArtifactLocation
// ArtifactLocation describes the source location for an external artifact
type ArtifactLocation struct {
// S3 compliant artifact
S3 *apicommon.S3Artifact `json:"s3,omitempty" protobuf:"bytes,1,opt,name=s3"`
// Inline artifact is embedded in sensor spec as a string
Inline *string `json:"inline,omitempty" protobuf:"bytes,2,opt,name=inline"`
// File artifact is artifact stored in a file
File *FileArtifact `json:"file,omitempty" protobuf:"bytes,3,opt,name=file"`
// URL to fetch the artifact from
URL *URLArtifact `json:"url,omitempty" protobuf:"bytes,4,opt,name=url"`
// Configmap that stores the artifact
Configmap *corev1.ConfigMapKeySelector `json:"configmap,omitempty" protobuf:"bytes,5,opt,name=configmap"`
// Git repository hosting the artifact
Git *GitArtifact `json:"git,omitempty" protobuf:"bytes,6,opt,name=git"`
// Resource is generic template for K8s resource
Resource *apicommon.Resource `json:"resource,omitempty" protobuf:"bytes,7,opt,name=resource"`
}
StandardK8STrigger
// StandardK8STrigger is the standard Kubernetes resource trigger
type StandardK8STrigger struct {
// Source of the K8s resource file(s)
Source *ArtifactLocation `json:"source,omitempty" protobuf:"bytes,1,opt,name=source"`
// Operation refers to the type of operation performed on the k8s resource.
// Default value is Create.
// +optional
Operation KubernetesResourceOperation `json:"operation,omitempty" protobuf:"bytes,2,opt,name=operation,casttype=KubernetesResourceOperation"`
// Parameters is the list of parameters that is applied to resolved K8s trigger object.
Parameters []TriggerParameter `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
// PatchStrategy controls the K8s object patching strategy when the trigger operation is specified as patch.
// possible values:
// "application/json-patch+json"
// "application/merge-patch+json"
// "application/strategic-merge-patch+json"
// "application/apply-patch+yaml".
// Defaults to "application/merge-patch+json"
// +optional
PatchStrategy k8stypes.PatchType `json:"patchStrategy,omitempty" protobuf:"bytes,4,opt,name=patchStrategy,casttype=k8s.io/apimachinery/pkg/types.PatchType"`
// LiveObject specifies whether the resource should be directly fetched from K8s instead
// of being marshaled from the resource artifact. If set to true, the resource artifact
// must contain the information required to uniquely identify the resource in the cluster,
// that is, you must specify "apiVersion", "kind" as well as "name" and "namespace" meta
// data.
// Only valid for operation type `update`
// +optional
LiveObject bool `json:"liveObject,omitempty" protobuf:"varint,5,opt,name=liveObject"`
}
ArgoWorkflowTrigger
// ArgoWorkflowTrigger is the trigger for the Argo Workflow
type ArgoWorkflowTrigger struct {
// Source of the K8s resource file(s)
Source *ArtifactLocation `json:"source,omitempty" protobuf:"bytes,1,opt,name=source"`
// Operation refers to the type of operation performed on the argo workflow resource.
// Default value is Submit.
// +optional
Operation ArgoWorkflowOperation `json:"operation,omitempty" protobuf:"bytes,2,opt,name=operation,casttype=ArgoWorkflowOperation"`
// Parameters is the list of parameters to pass to resolved Argo Workflow object
Parameters []TriggerParameter `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
// Args is the list of arguments to pass to the argo CLI
Args []string `json:"args,omitempty" protobuf:"bytes,4,rep,name=args"`
}
// ArgoWorkflowOperation refers to the type of the operation performed on the Argo Workflow
type ArgoWorkflowOperation string
// possible values for ArgoWorkflowOperation
const (
Submit ArgoWorkflowOperation = "submit" // submit a workflow
SubmitFrom ArgoWorkflowOperation = "submit-from" // submit from existing resource
Suspend ArgoWorkflowOperation = "suspend" // suspends a workflow
Resubmit ArgoWorkflowOperation = "resubmit" // resubmit a workflow
Retry ArgoWorkflowOperation = "retry" // retry a workflow
Resume ArgoWorkflowOperation = "resume" // resume a workflow
Terminate ArgoWorkflowOperation = "terminate" // terminate a workflow
Stop ArgoWorkflowOperation = "stop" // stop a workflow
)
HTTPTrigger
// HTTPTrigger is the trigger for the HTTP request
type HTTPTrigger struct {
// URL refers to the URL to send HTTP request to.
URL string `json:"url" protobuf:"bytes,1,opt,name=url"`
// Payload is the list of key-value extracted from an event payload to construct the HTTP request payload.
Payload []TriggerParameter `json:"payload" protobuf:"bytes,2,rep,name=payload"`
// TLS configuration for the HTTP client.
// +optional
TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,3,opt,name=tls"`
// Method refers to the type of the HTTP request.
// Refer https://golang.org/src/net/http/method.go for more info.
// Default value is POST.
// +optional
Method string `json:"method,omitempty" protobuf:"bytes,4,opt,name=method"`
// Parameters is the list of key-value extracted from event's payload that are applied to
// the HTTP trigger resource.
Parameters []TriggerParameter `json:"parameters,omitempty" protobuf:"bytes,5,rep,name=parameters"`
// Timeout refers to the HTTP request timeout in seconds.
// Default value is 60 seconds.
// +optional
Timeout int64 `json:"timeout,omitempty" protobuf:"varint,6,opt,name=timeout"`
// BasicAuth configuration for the http request.
// +optional
BasicAuth *apicommon.BasicAuth `json:"basicAuth,omitempty" protobuf:"bytes,7,opt,name=basicAuth"`
// Headers for the HTTP request.
// +optional
Headers map[string]string `json:"headers,omitempty" protobuf:"bytes,8,rep,name=headers"`
// Secure Headers stored in Kubernetes Secrets for the HTTP requests.
// +optional
SecureHeaders []*apicommon.SecureHeader `json:"secureHeaders,omitempty" protobuf:"bytes,9,rep,name=secureHeaders"`
}
KafkaTrigger
// KafkaTrigger refers to the specification of the Kafka trigger.
type KafkaTrigger struct {
// URL of the Kafka broker, multiple URLs separated by comma.
URL string `json:"url" protobuf:"bytes,1,opt,name=url"`
// Name of the topic.
// More info at https://kafka.apache.org/documentation/#intro_topics
Topic string `json:"topic" protobuf:"bytes,2,opt,name=topic"`
// +optional
// DEPRECATED
Partition int32 `json:"partition" protobuf:"varint,3,opt,name=partition"`
// Parameters is the list of parameters that is applied to resolved Kafka trigger object.
Parameters []TriggerParameter `json:"parameters,omitempty" protobuf:"bytes,4,rep,name=parameters"`
// RequiredAcks used in producer to tell the broker how many replica acknowledgements
// Defaults to 1 (Only wait for the leader to ack).
// +optional.
RequiredAcks int32 `json:"requiredAcks,omitempty" protobuf:"varint,5,opt,name=requiredAcks"`
// Compress determines whether to compress message or not.
// Defaults to false.
// If set to true, compresses message using snappy compression.
// +optional
Compress bool `json:"compress,omitempty" protobuf:"varint,6,opt,name=compress"`
// FlushFrequency refers to the frequency in milliseconds to flush batches.
// Defaults to 500 milliseconds.
// +optional
FlushFrequency int32 `json:"flushFrequency,omitempty" protobuf:"varint,7,opt,name=flushFrequency"`
// TLS configuration for the Kafka producer.
// +optional
TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,8,opt,name=tls"`
// Payload is the list of key-value extracted from an event payload to construct the request payload.
Payload []TriggerParameter `json:"payload" protobuf:"bytes,9,rep,name=payload"`
// The partitioning key for the messages put on the Kafka topic.
// +optional.
PartitioningKey *string `json:"partitioningKey,omitempty" protobuf:"bytes,10,opt,name=partitioningKey"`
// Specify what kafka version is being connected to enables certain features in sarama, defaults to 1.0.0
// +optional
Version string `json:"version,omitempty" protobuf:"bytes,11,opt,name=version"`
// SASL configuration for the kafka client
// +optional
SASL *apicommon.SASLConfig `json:"sasl,omitempty" protobuf:"bytes,12,opt,name=sasl"`
// Schema Registry configuration to producer message with avro format
// +optional
SchemaRegistry *apicommon.SchemaRegistryConfig `json:"schemaRegistry,omitempty" protobuf:"bytes,13,opt,name=schemaRegistry"`
}
LogTrigger
type LogTrigger struct {
// Only print messages every interval. Useful to prevent logging too much data for busy events.
// +optional
IntervalSeconds uint64 `json:"intervalSeconds,omitempty" protobuf:"varint,1,opt,name=intervalSeconds"`
}
EmailTrigger
// EmailTrigger refers to the specification of the email notification trigger.
type EmailTrigger struct {
// Parameters is the list of key-value extracted from event's payload that are applied to
// the trigger resource.
// +optional
Parameters []TriggerParameter `json:"parameters,omitempty" protobuf:"bytes,1,rep,name=parameters"`
// Username refers to the username used to connect to the smtp server.
// +optional
Username string `json:"username,omitempty" protobuf:"bytes,2,opt,name=username"`
// SMTPPassword refers to the Kubernetes secret that holds the smtp password used to connect to smtp server.
// +optional
SMTPPassword *corev1.SecretKeySelector `json:"smtpPassword,omitempty" protobuf:"bytes,3,opt,name=smtpPassword"`
// Host refers to the smtp host url to which email is send.
Host string `json:"host,omitempty" protobuf:"bytes,4,opt,name=host"`
// Port refers to the smtp server port to which email is send.
// Defaults to 0.
// +optional
Port int32 `json:"port,omitempty" protobuf:"varint,5,opt,name=port"`
// To refers to the email addresses to which the emails are send.
// +optional
To []string `json:"to,omitempty" protobuf:"bytes,6,rep,name=to"`
// From refers to the address from which the email is send from.
// +optional
From string `json:"from,omitempty" protobuf:"bytes,7,opt,name=from"`
// Subject refers to the subject line for the email send.
// +optional
Subject string `json:"subject,omitempty" protobuf:"bytes,8,opt,name=subject"`
// Body refers to the body/content of the email send.
// +optional
Body string `json:"body,omitempty" protobuf:"bytes,9,opt,name=body"`
}
最后修改 2024.06.07: docs: update argo (81bc931)