Skip to content

Latest commit

 

History

History
189 lines (136 loc) · 13.7 KB

sensor-api.md

File metadata and controls

189 lines (136 loc) · 13.7 KB

Sensor API

The API specifications for Kubernetes Sensor CRDs. See the project's examples directory for applications of this API.

Sensor v1alpha1 event

Group Version Kind
event v1alpha1 Sensor
Field Type Description
apiVersion string Defines the versioned schema of this object. For us, this is event/v1alpha1. More info here
kind string Represents the REST resource this object represents. For us, this is Sensor. More info here
metadata ObjectMeta ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.
spec SensorSpec The specification for the sensor and its desired state
status SensorStatus Information about the most recently observed status of the sensor

SensorSpec v1alpha1 event

Field Type Description
signals Signal array List of signal dependencies
triggers Trigger array List of trigger actions
escalation EscalationPolicy Specify the policy for escalating signal failures
repeat bool Should repeat execution of signal resolution and action triggering

SensorStatus v1alpha1 event

Field Type Description
phase string Current condition of the sensor
startedAt Time RFC 3339 date and time at which the sensor started listening for events
resolvedAt Time RFC 3339 date and time at which the sensor successfully resolved all dependent signals
message string Human readable string indicating details about a sensor in its phase
nodes map string -> NodeStatus Mapping between a node ID and the node's status
escalated bool Flag for whether the sensor was escalated

Signal v1alpha1 event

Field Type Description
name string Unique name for this dependencies
deadline int64 Duration in seconds after the startedAt time in which the signal is terminated (currently not implemented)
stream Stream An arbitrary message stream signal
artifact ArtifactSignal Artifact based signal. currently S3 is the only type supported
calendar CalendarSignal Time-based signal
resource ResourceSignal Kubernetes resource based signal
webhook WebhookSignal HTTP notification dependency
constraints SignalConstraints Rules governing tolerations and accepted event-meta information

Trigger v1alpha1 event

Field Type Description
name string Unique name for this action
message Message The message to send on a queue
resource ResourceObject The K8s Object to create
retryStrategy RetryStrategy Defines a strategy to retry if the trigger fails (currently not yet implemented)

Message

Field Type Description
body string The content of the message
stream Stream The stream resource queue on which to send the message

Stream v1alpha1 event

Field Type Description
type string The type of the stream
url string The url for client connections to the service
attributes map string -> string A map of the additional fields or properties specific to each service implementation

ResourceObject

Field Type Description
namespace string The Kubernetes namespace to create this resource object
group string The API Group as specified in the REST path and in the apiVersion field of a Kubernetes object, e.g. core, batch, etc.
version string The version as part of the named group's REST path: apis/$GROUP_NAME/$VERSION, and apiVersion: $GROUP_NAME/$VERSION
kind string The kind of the Kubernetes resource, as specified in the TypeMeta of the object
labels map string -> string The labels to apply to this resource
s3 S3 The S3 Artifact location of the resource file

Artifact Signal

Field Type Description
s3 *S3Artifact An S3 artifact
stream *Stream The stream to listen for artifact notifications

Calendar Signal

Field Type Description
schedule string A cron
interval string A interval duration defined in Go. This is parsed using golang time library's ParseDuration function
recurrence string array List of RRULE, RDATE and EXDATE lines for a recurring event, as specified in RFC5545. This feature is not yet implemented.

Resource Signal

Field Type Description
namespace string The Kubernetes namespace to watch for these resources
group string The API Group as specified in the REST path and in the apiVersion field of a Kubernetes object, e.g. core, batch, etc.
version string The version as part of the named group's REST path: apis/$GROUP_NAME/$VERSION, and apiVersion: $GROUP_NAME/$VERSION
kind string The kind of the Kubernetes resource, as specified in the TypeMeta of the object

Webhook Signal

Field Type Description
endpoint string REST API endpoint
port int HTTP server port to listen on
method string HTTP request method that indicates the desired action to be performed for a given resource. See RFC7231

Signal Constraints

Field Type Description
time TimeConstraints The time constraints for this dependency

Time Constraints

Field Type Description
start Time RFC 3339 date and time at which the sensor should start accepting events from the specified dependency
stop Time RFC 3339 date and time at which the sensor should stop accepting events from the specified dependency

Escalation Policy

Field Type Description
level string Degree of importance for this sensor
trigger Trigger The trigger (action) to fire to escalate this issue

Node Status

Field Type Description
id string Unique identifier for this sensor node
name string Name of the node (signal\trigger) used to generate the id
displayName string Human readable representation of the node
type string The type of the Node, e.g. signal or trigger
phase string The most current status of the node
startedAt Time RFC 3339 date and time at which the node started processing
resolvedAt Time RFC 3339 date and time at which the node finished processing
message string Human readable message indicating information and or explanation about the status of the node

S3 Artifact

Field Type Description
endpoint string The URL of the S3 object storage server
key string The name of the key of the object
bucket string The name of the S3 bucket
event string The type of the notification event, e.g. "s3:ObjectCreated:", "s3:ObjectCreated:Put, etc...
filter *S3Filter An additional filter applied on S3 object notifications

S3 Filter

Field Type Description
prefix string The string literal prefix to match for S3 objects
suffix string The string literal suffix to match for S3 objects

Resource Filter

Field Type Description
prefix string The string literal prefix to match for resource object meta name
labels map string -> string Labels is an unstructured key value map that is used as selectors in finding this resource
annotations map string -> string Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
createdBy Time RFC 3339 date and time after which this resource should have been created