Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultConfigMapName(controllerName string) string
- func DefaultEventSourceName(gatewayName string, configurationName string) string
- func DefaultNatsQueueName(subject string) string
- func ErrEventSourceTypeMismatch(eventSourceType string) string
- func FormatEndpoint(endpoint string) string
- func FormattedURL(url, endpoint string) string
- func GetClientConfig(kubeconfig string) (*rest.Config, error)
- func GetConnectionBackoff(backoff *Backoff) *wait.Backoff
- func GetObjectHash(obj metav1.Object) (string, error)
- func GetSecrets(client kubernetes.Interface, namespace string, selector *v1.SecretKeySelector) (string, error)
- func Hasher(value string) string
- func IsRetryableKubeAPIError(err error) bool
- func NewArgoEventsLogger() *logrus.Logger
- func ParseExclusionDates(vals []string) ([]time.Time, error)
- func SendErrorResponse(writer http.ResponseWriter, response string)
- func SendInternalErrorResponse(writer http.ResponseWriter, response string)
- func SendSuccessResponse(writer http.ResponseWriter, response string)
- func ServerResourceForGroupVersionKind(disco discovery.DiscoveryInterface, gvk schema.GroupVersionKind) (*metav1.APIResource, error)
- func ServiceDNSName(serviceName, namespace string) string
- type Backoff
Constants ¶
const ( // ErrorResponse for http request ErrorResponse = "Error" // 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" // DefaultControllerNamespace is the default namespace where the sensor and gateways controllers are installed DefaultControllerNamespace = "argo-events" )
Defaults
const ( // EnvVarKubeConfig is the path to the Kubernetes configuration EnvVarKubeConfig = "KUBE_CONFIG" // EnvVarDebugLog is the env var to turn on the debug mode for logging EnvVarDebugLog = "DEBUG_LOG" )
Environment variables
const ( // EnvVarControllerConfigMap contains name of the configmap to retrieve controller configuration from EnvVarControllerConfigMap = "CONTROLLER_CONFIG_MAP" // EnvVarControllerInstanceID is used to get controller instance id EnvVarControllerInstanceID = "CONTROLLER_INSTANCE_ID" // EnvVarControllerName is used to get name of the controller EnvVarControllerName = "CONTROLLER_NAME" // EnvVarResourceName refers env var for name of the resource EnvVarResourceName = "NAME" // EnvVarNamespace refers to a K8s namespace EnvVarNamespace = "NAMESPACE" )
Controller environment variables
const ( // LabelGatewayName is the label for the K8s resource name LabelResourceName = "resource-name" // LabelControllerName is th label for the controller name LabelControllerName = "controller-name" )
Controller labels
const ( // SensorServiceEndpoint is the endpoint to dispatch the event to SensorServiceEndpoint = "/" // SensorName refers env var for name of sensor SensorName = "SENSOR_NAME" // SensorNamespace is used to get namespace where sensors are deployed SensorNamespace = "SENSOR_NAMESPACE" // LabelSensorName is label for sensor name LabelSensorName = "sensor-name" // Port for the sensor server to listen events on SensorServerPort = 9300 )
Sensor constants
const ( // LabelEventSourceName is the label for a event source in gateway LabelEventSourceName = "event-source-name" // LabelEventSourceID is the label for gateway configuration ID LabelEventSourceID = "event-source-id" EnvVarGatewayServerPort = "GATEWAY_SERVER_PORT" // Server Connection Timeout, 10 seconds ServerConnTimeout = 10 // ProcessorPort is the default port for the gateway event processor server to run on. GatewayProcessorPort = "9300" )
Gateway constants
const ( // EnvVarEventSource refers to event source name EnvVarEventSource = "EVENT_SOURCE" // AnnotationResourceSpecHash is the annotation of a K8s resource spec hash AnnotationResourceSpecHash = "resource-spec-hash" )
const ( // LabelOperation is a label for an operation in framework LabelOperation = "operation" // LabelEventSource is label for event name LabelEventSource = "event-source" // LabelOwnerName is the label for resource owner name LabelOwnerName = "owner-name" // LabelObjectName is the label for object name LabelObjectName = "object-name" )
Miscellaneous Labels
const ( MediaTypeJSON string = "application/json" MediaTypeXML string = "application/xml" MediaTypeYAML string = "application/yaml" )
various supported media types
const ( LabelNamespace = "namespace" LabelPhase = "phase" LabelInstanceID = "instance-id" LabelPodName = "pod-name" LabelDeploymentName = "deployment-name" LabelServiceName = "svc-name" LabelEndpoint = "endpoint" LabelPort = "port" LabelURL = "url" LabelNodeName = "node-name" LabelNodeType = "node-type" LabelHTTPMethod = "http-method" LabelClientID = "client-id" LabelVersion = "version" LabelTime = "time" LabelTriggerName = "trigger-name" )
Logger constants
const ( // GatewayControllerConfigMapKey is the key in the configmap to retrieve controller configuration from. // Content encoding is expected to be YAML. ControllerConfigMapKey = "config" )
Variables ¶
var DefaultRetry = wait.Backoff{ Steps: 5, Duration: 10 * time.Millisecond, Factor: 1.0, Jitter: 0.1, }
DefaultRetry is a default retry backoff settings when retrying API calls
var (
ErrNilEventSource = errors.New("event source can't be nil")
)
Functions ¶
func DefaultConfigMapName ¶
DefaultConfigMapName returns a formulated name for a configmap name based on the sensor-controller deployment name
func DefaultEventSourceName ¶ added in v0.8.3
DefaultEventSourceName returns a formulated name for a gateway configuration
func DefaultNatsQueueName ¶
DefaultNatsQueueName returns a queue name for nats subject
func ErrEventSourceTypeMismatch ¶ added in v0.13.0
func FormatEndpoint ¶ added in v0.13.0
FormatEndpoint returns a formatted api endpoint
func FormattedURL ¶ added in v0.13.0
FormattedURL returns a formatted url
func GetClientConfig ¶
GetClientConfig return rest config, if path not specified, assume in cluster config
func GetConnectionBackoff ¶ added in v0.13.0
GetConnectionBackoff returns a connection backoff option
func GetObjectHash ¶ added in v0.8.2
GetObjectHash returns hash of a given object
func GetSecrets ¶ added in v0.13.0
func GetSecrets(client kubernetes.Interface, namespace string, selector *v1.SecretKeySelector) (string, error)
GetSecrets retrieves the secret value from the secret in namespace with name and key
func IsRetryableKubeAPIError ¶
IsRetryableKubeAPIError returns if the error is a retryable kubernetes error
func NewArgoEventsLogger ¶ added in v0.9.1
NewArgoEventsLogger returns a new ArgoEventsLogger
func ParseExclusionDates ¶
ParseExclusionDates parses the exclusion dates from the vals string according to RFC 5545
func SendErrorResponse ¶
func SendErrorResponse(writer http.ResponseWriter, response string)
SendErrorResponse sends http error response
func SendInternalErrorResponse ¶ added in v0.8.3
func SendInternalErrorResponse(writer http.ResponseWriter, response string)
SendInternalErrorResponse sends http internal error response
func SendSuccessResponse ¶
func SendSuccessResponse(writer http.ResponseWriter, response string)
SendSuccessResponse sends http success response
func ServerResourceForGroupVersionKind ¶
func ServerResourceForGroupVersionKind(disco discovery.DiscoveryInterface, gvk schema.GroupVersionKind) (*metav1.APIResource, error)
ServerResourceForGroupVersionKind finds the API resources that fit the GroupVersionKind schema
func ServiceDNSName ¶ added in v0.13.0
ServiceDNSName returns a formulated dns name for a service
Types ¶
type Backoff ¶ added in v0.9.1
type Backoff struct { Duration time.Duration `json:"duration"` // the base duration Factor float64 `json:"factor"` // Duration is multiplied by factor each iteration Jitter float64 `json:"jitter"` // The amount of jitter applied each iteration Steps int `json:"steps"` // Exit with error after this many steps }
Backoff defines an operational backoff