Documentation ¶
Index ¶
- Constants
- Variables
- type Condition
- func (c *Condition) GetCmd() *cmd.Command
- func (c *Condition) GetDescription(ctx *api.WorkflowContext, values render.Values) (string, error)
- func (c *Condition) GetDocs(ctx *api.WorkflowContext, values render.Values, flags render.Flags) (string, error)
- func (c *Condition) Run(ctx *api.WorkflowContext, values render.Values) error
- type Curl
- func (c *Curl) GetDescription(ctx *api.WorkflowContext, values render.Values) (string, error)
- func (c *Curl) GetDocs(ctx *api.WorkflowContext, values render.Values, flags render.Flags) (string, error)
- func (c *Curl) GetHttpRequest(url string) (*http.Request, error)
- func (c *Curl) GetUrl(ctx *api.WorkflowContext, values render.Values) (string, error)
- func (c *Curl) Run(ctx *api.WorkflowContext, values render.Values) error
- type PortForward
- type ServiceRef
- type WaitForPods
Constants ¶
const ( DefaultConditionTimeout = "120s" DefaultConditionInterval = "5s" )
const ( DefaultCurlDelay = "1s" DefaultCurlAttempts = 10 DefaultMethod = "GET" DefaultPortForwardPort = 8080 )
Variables ¶
var ( UnexpectedStatusCodeError = func(statusCode int) error { return errors.Errorf("Curl got unexpected status code %d", statusCode) } UnexpectedResponseBodyError = func(responseBody string) error { return errors.Errorf("Curl got unexpected response body:\n%s", responseBody) } )
var (
ConditionNotMetError = errors.Errorf("Condition wasn't met")
)
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct { Type string `json:"type"` Name string `json:"name" valet:"template"` Namespace string `json:"namespace"` Jsonpath string `json:"jsonpath"` Value string `json:"value"` Timeout string `json:"timeout" valet:"template,default=120s"` Interval string `json:"interval" valet:"template,default=5s"` }
func (*Condition) GetDescription ¶
type Curl ¶
type Curl struct { Path string `json:"path,omitempty"` Host string `json:"host,omitempty"` Headers map[string]string `json:"headers,omitempty"` StatusCode int `json:"statusCode,omitempty" valet:"default=200"` Method string `json:"method,omitempty" valet:"default=GET"` RequestBody string `json:"body,omitempty"` ResponseBody string `json:"responseBody,omitempty"` ResponseBodySubstring string `json:"responseBodySubstring,omitempty"` Service *ServiceRef `json:"service,omitempty"` PortForward *PortForward `json:"portForward,omitempty"` Attempts int `json:"attempts,omitempty" valet:"default=10"` Delay string `json:"delay,omitempty" valet:"default=1s"` }
Use Curl to simulate testing an endpoint with an HTTP request using curl.
If service is provided, then the URL to send the request to will be determined by getting the address to a service exposed in the current Kube context.
If portForward is provided, then the curl will be wrapped in a port-forward, exposing some deployment and port to localhost. The request will be send to a localhost address.
Only one of service or portForward should be provided.
The request can be customized with the path, host, headers, and requestBody fields.
The response can be validated with the statusCode, responseBody, and responseBodySubstring fields.
Curl will by default try 10 times if the validation criteria isn't met for any reason, with a delay of 1 second between attempt. Customize these with the attempts and delay fields.
func (*Curl) GetDescription ¶
type PortForward ¶
type PortForward struct { Namespace string `json:"namespace,omitempty" valet:"key=Namespace"` DeploymentName string `json:"deploymentName,omitempty"` Port int `json:"port,omitempty" valet:"default=8080"` }
func (*PortForward) Initiate ¶
func (p *PortForward) Initiate(ctx *api.WorkflowContext, values render.Values) (*cmd.CommandStreamHandler, error)
type ServiceRef ¶
type ServiceRef struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty" valet:"key=Namespace"` Port string `json:"port,omitempty" valet:"default=http"` }
func (*ServiceRef) GetAddress ¶
func (s *ServiceRef) GetAddress(ctx *api.WorkflowContext, values render.Values) (string, error)
func (*ServiceRef) GetIp ¶
func (s *ServiceRef) GetIp(ctx *api.WorkflowContext, values render.Values) (string, error)
type WaitForPods ¶
type WaitForPods struct { // Namespace to check for pods Namespace string `json:"namespace,omitempty"` }
check.WaitForPods is a workflow step that is used to pause a workflow until the pods in a namespace are ready or completed successfully.
func (*WaitForPods) GetDescription ¶
func (w *WaitForPods) GetDescription(_ *api.WorkflowContext, _ render.Values) (string, error)
func (*WaitForPods) GetDocs ¶
func (w *WaitForPods) GetDocs(_ *api.WorkflowContext, _ render.Values, _ render.Flags) (string, error)
func (*WaitForPods) Run ¶
func (w *WaitForPods) Run(ctx *api.WorkflowContext, _ render.Values) error