model

package
v0.0.0-...-cb1a7a4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EntrypointCommand             = "entrypoint"
	EntrypointCommandFlag         = "-entrypoint"
	EntrypointCommandArgSeparator = "--"
)
View Source
const (
	DefaultImage   = "alpine:latest"
	DefaultCommand = "echo"

	InputScriptMountPath = "/var/run/puppet/relay/config"
	InputScriptName      = "input-script"

	// TODO Consider configuration options for runtime tools
	ToolsCommandInitialize = "initialize"
	ToolsImage             = "us-docker.pkg.dev/puppet-relay-contrib-oss/relay-core/relay-runtime-tools:latest"
	ToolsMountName         = "relay-tools"
	ToolsMountPath         = "/var/lib/puppet/relay"
	ToolsSource            = "/ko-app/relay-runtime-tools"
)
View Source
const (
	RelayDomainIDAnnotation            = "relay.sh/domain-id"
	RelayTenantIDAnnotation            = "relay.sh/tenant-id"
	RelayVaultEngineMountAnnotation    = "relay.sh/vault-engine-mount"
	RelayVaultSecretPathAnnotation     = "relay.sh/vault-secret-path"
	RelayVaultConnectionPathAnnotation = "relay.sh/vault-connection-path"

	RelayControllerTokenHashAnnotation = "controller.relay.sh/token-hash"

	RelayControllerTenantNameLabel       = "controller.relay.sh/tenant-name"
	RelayControllerTenantWorkloadLabel   = "controller.relay.sh/tenant-workload"
	RelayControllerWorkflowRunIDLabel    = "controller.relay.sh/run-id"
	RelayControllerWebhookTriggerIDLabel = "controller.relay.sh/webhook-trigger-id"

	RelayInstallerNameLabel = "install.relay.sh/relay-core"
	RelayAppNameLabel       = "app.kubernetes.io/name"
	RelayAppInstanceLabel   = "app.kubernetes.io/instance"
	RelayAppComponentLabel  = "app.kubernetes.io/component"
	RelayAppManagedByLabel  = "app.kubernetes.io/managed-by"
)
View Source
const (
	Shebang            = "#!"
	DefaultInterpreter = Shebang + "/bin/sh"
)
View Source
const ActionPodStepContainerName = "step-step"

ActionPodStepContainerName is used to set the container name for step and trigger on all action pods.

TODO: move all references of "step-step" to this const

Variables

View Source
var (
	ActionTypeStep    = ActionType{Singular: "step", Plural: "steps"}
	ActionTypeTrigger = ActionType{Singular: "trigger", Plural: "triggers"}
)
View Source
var (
	ErrNotFound = errors.New("model: not found")
	ErrRejected = errors.New("model: rejected")
	ErrConflict = errors.New("model: conflict")
)
View Source
var (
	DeploymentEnvironmentDevelopment = DeploymentEnvironment{
										// contains filtered or unexported fields
	}
	DeploymentEnvironmentTest = DeploymentEnvironment{
								// contains filtered or unexported fields
	}

	DeploymentEnvironments = map[string]DeploymentEnvironment{
		DeploymentEnvironmentDevelopment.Name(): DeploymentEnvironmentDevelopment,
		DeploymentEnvironmentTest.Name():        DeploymentEnvironmentTest,
	}
)

Functions

func IfStep

func IfStep(action Action, fn func(s *Step))

func IfTrigger

func IfTrigger(action Action, fn func(t *Trigger))

func ScriptForInput

func ScriptForInput(input []string) string

Types

type Action

type Action interface {
	Type() ActionType
	Hash() Hash
}

type ActionMetadata

type ActionMetadata struct {
	Image string
}

type ActionMetadataManager

type ActionMetadataManager interface {
	Get(ctx context.Context) (*ActionMetadata, error)
}

type ActionStatus

type ActionStatus struct {
	Name          string
	ProcessState  *ActionStatusProcessState
	WhenCondition *ActionStatusWhenCondition
}

func (*ActionStatus) Failed

func (as *ActionStatus) Failed() (bool, error)

func (*ActionStatus) IsStatusProperty

func (as *ActionStatus) IsStatusProperty(property StatusProperty) (bool, error)

func (*ActionStatus) Skipped

func (as *ActionStatus) Skipped() (bool, error)

func (*ActionStatus) Succeeded

func (as *ActionStatus) Succeeded() (bool, error)

type ActionStatusGetterManager

type ActionStatusGetterManager interface {
	List(ctx context.Context) ([]*ActionStatus, error)
	Get(ctx context.Context, action Action) (*ActionStatus, error)
}

type ActionStatusManager

type ActionStatusManager interface {
	ActionStatusGetterManager
	ActionStatusSetterManager
}

type ActionStatusProcessState

type ActionStatusProcessState struct {
	ExitCode  int
	Timestamp time.Time
}

type ActionStatusSetterManager

type ActionStatusSetterManager interface {
	Set(ctx context.Context, ss *ActionStatus) error
}

type ActionStatusWhenCondition

type ActionStatusWhenCondition struct {
	Timestamp           time.Time
	WhenConditionStatus WhenConditionStatus
}

type ActionType

type ActionType struct {
	Singular string
	Plural   string
}

type Condition

type Condition struct {
	Tree any
}

type ConditionEvaluationResult

type ConditionEvaluationResult struct {
	Expression any
}

type ConditionGetterManager

type ConditionGetterManager interface {
	// Get retrieves the condition scoped to the authenticated action, if any.
	Get(ctx context.Context) (*Condition, error)
}

type ConditionManager

type ConditionManager interface {
	ConditionGetterManager
	ConditionSetterManager
}

type ConditionSetterManager

type ConditionSetterManager interface {
	// Set sets the condition scoped to the authenticated action.
	Set(ctx context.Context, value interface{}) (*Condition, error)
}

type Connection

type Connection struct {
	Type       string
	Name       string
	Attributes map[string]interface{}
}

type ConnectionManager

type ConnectionManager interface {
	List(ctx context.Context) ([]*Connection, error)
	Get(ctx context.Context, typ, name string) (*Connection, error)
}

type DecoratorType

type DecoratorType string
const (
	// DecoratorTypeLink is a reference to a URI. This informs a UI to display
	// the decorator as a link.
	DecoratorTypeLink DecoratorType = "link"
)

type DeploymentEnvironment

type DeploymentEnvironment struct {
	// contains filtered or unexported fields
}

func (DeploymentEnvironment) Name

func (e DeploymentEnvironment) Name() string

func (DeploymentEnvironment) SecureLogging

func (e DeploymentEnvironment) SecureLogging() bool

func (DeploymentEnvironment) Timeout

func (e DeploymentEnvironment) Timeout() time.Duration

type Entrypoint

type Entrypoint struct {
	Entrypoint string
	Args       []string
}

type Environment

type Environment struct {
	Value map[string]any
}

type EnvironmentGetterManager

type EnvironmentGetterManager interface {
	// Get retrieves the environment for this action, if any.
	Get(ctx context.Context) (*Environment, error)
}

type EnvironmentManager

type EnvironmentManager interface {
	EnvironmentGetterManager
	EnvironmentSetterManager
}

type EnvironmentSetterManager

type EnvironmentSetterManager interface {
	// Set stores the environment for this action.
	Set(ctx context.Context, value map[string]any) (*Environment, error)
}

type EnvironmentVariable

type EnvironmentVariable string
const (
	EnvironmentVariableDefaultTimeout      EnvironmentVariable = "RELAY_DEFAULT_TIMEOUT"
	EnvironmentVariableEnableSecureLogging EnvironmentVariable = "RELAY_ENABLE_SECURE_LOGGING"
	EnvironmentVariableMetadataAPIURL      EnvironmentVariable = "METADATA_API_URL"
)

func (EnvironmentVariable) String

func (ev EnvironmentVariable) String() string

type Event

type Event struct {
	Data map[string]interface{}
	Key  string
}

type EventManager

type EventManager interface {
	Emit(ctx context.Context, data map[string]interface{}, key string) (*Event, error)
}

type Hash

type Hash [sha1.Size]byte

Hash wraps the result of a SHA-1 checksum operation. It is different than hashutil.Sum so that it can be used as a map key.

func (Hash) HexEncoding

func (h Hash) HexEncoding() string

func (Hash) String

func (h Hash) String() string

type LogManager

type LogManager interface {
	PostLog(ctx context.Context, value interface{}) ([]byte, error)
	PostLogMessage(ctx context.Context, logID string, value interface{}) ([]byte, error)
}

type MetadataManagers

type MetadataManagers interface {
	ActionStatus() ActionStatusManager
	Conditions() ConditionGetterManager
	Connections() ConnectionManager
	Events() EventManager
	Environment() EnvironmentGetterManager
	Parameters() ParameterGetterManager
	Logs() LogManager
	Secrets() SecretManager
	Spec() SpecGetterManager
	State() StateGetterManager
	ActionMetadata() ActionMetadataManager
	StepDecorators() StepDecoratorManager
	StepMessages() StepMessageManager
	StepOutputs() StepOutputManager
	WorkflowRuns() WorkflowRunManager
}

MetadataManagers are the managers used by actions accessing the metadata service.

type Parameter

type Parameter struct {
	Name  string
	Value interface{}
}

type ParameterGetterManager

type ParameterGetterManager interface {
	List(ctx context.Context) ([]*Parameter, error)
	Get(ctx context.Context, name string) (*Parameter, error)
}

type ParameterManager

type ParameterManager interface {
	ParameterGetterManager
	ParameterSetterManager
}

type ParameterSetterManager

type ParameterSetterManager interface {
	Set(ctx context.Context, name string, value interface{}) (*Parameter, error)
}

type Run

type Run struct {
	ID string
}

type RunReconcilerManagers

type RunReconcilerManagers interface {
	Conditions() ConditionSetterManager
	Parameters() ParameterSetterManager
	Environment() EnvironmentSetterManager
	Spec() SpecSetterManager
	State() StateSetterManager
}

RunReconcilerManagers are the managers used by the run reconciler when setting up a new run.

type SchemaValidationResult

type SchemaValidationResult struct {
	Expression any
}

type Secret

type Secret struct {
	Name, Value string
}

type SecretManager

type SecretManager interface {
	List(ctx context.Context) ([]*Secret, error)
	Get(ctx context.Context, name string) (*Secret, error)
}

type Spec

type Spec struct {
	Tree any
}

type SpecGetterManager

type SpecGetterManager interface {
	// Get retrieves the spec for this action, if any.
	Get(ctx context.Context) (*Spec, error)
}

type SpecManager

type SpecManager interface {
	SpecGetterManager
	SpecSetterManager
}

type SpecSetterManager

type SpecSetterManager interface {
	// Set stores the spec for this action.
	Set(ctx context.Context, spec map[string]interface{}) (*Spec, error)
}

type State

type State struct {
	Name  string
	Value interface{}
}

type StateGetterManager

type StateGetterManager interface {
	Get(ctx context.Context, name string) (*State, error)
}

type StateManager

type StateManager interface {
	StateGetterManager
	StateSetterManager
}

type StateSetterManager

type StateSetterManager interface {
	Set(ctx context.Context, name string, value interface{}) (*State, error)
}

type StatusProperty

type StatusProperty string
const (
	StatusPropertyFailed    StatusProperty = "failed"
	StatusPropertySkipped   StatusProperty = "skipped"
	StatusPropertySucceeded StatusProperty = "succeeded"
)

func (StatusProperty) String

func (sp StatusProperty) String() string

type Step

type Step struct {
	Run  Run
	Name string
}

func (*Step) Hash

func (s *Step) Hash() Hash

func (*Step) Type

func (*Step) Type() ActionType

type StepDecorator

type StepDecorator struct {
	Step  *Step
	Name  string
	Value relayv1beta1.Decorator
}

type StepDecoratorManager

type StepDecoratorManager interface {
	List(ctx context.Context) ([]*StepDecorator, error)
	Set(ctx context.Context, typ, name string, value map[string]interface{}) error
}

type StepMessage

type StepMessage struct {
	ID                        string
	Details                   string
	Time                      time.Time
	ConditionEvaluationResult *ConditionEvaluationResult
	SchemaValidationResult    *SchemaValidationResult
}

type StepMessageGetterManager

type StepMessageGetterManager interface {
	List(ctx context.Context) ([]*StepMessage, error)
}

type StepMessageManager

type StepMessageManager interface {
	StepMessageGetterManager
	StepMessageSetterManager
}

type StepMessageSetterManager

type StepMessageSetterManager interface {
	Set(ctx context.Context, sm *StepMessage) error
}

type StepOutput

type StepOutput struct {
	Step     *Step
	Name     string
	Value    interface{}
	Metadata *StepOutputMetadata
}

type StepOutputGetterManager

type StepOutputGetterManager interface {
	List(ctx context.Context) ([]*StepOutput, error)
	ListSelf(ctx context.Context) ([]*StepOutput, error)
	Get(ctx context.Context, stepName, name string) (*StepOutput, error)
}

type StepOutputManager

type StepOutputManager interface {
	StepOutputGetterManager
	StepOutputSetterManager
}

type StepOutputMetadata

type StepOutputMetadata struct {
	Sensitive bool
}

type StepOutputSetterManager

type StepOutputSetterManager interface {
	Set(ctx context.Context, name string, value interface{}) error
	SetMetadata(ctx context.Context, name string, metadata *StepOutputMetadata) error
}

type Trigger

type Trigger struct {
	Name string
}

func (*Trigger) Hash

func (t *Trigger) Hash() Hash

func (*Trigger) Type

func (*Trigger) Type() ActionType

type WebhookTriggerReconcilerManagers

type WebhookTriggerReconcilerManagers interface {
	Environment() EnvironmentSetterManager
	Spec() SpecSetterManager
}

WebhookTriggerReconcilerManagers are the managers used by the workflow trigger reconciler when configuring a Knative service for the trigger.

type WhenConditionStatus

type WhenConditionStatus string
const (
	WhenConditionStatusEvaluating   WhenConditionStatus = "WhenConditionEvaluating"
	WhenConditionStatusFailure      WhenConditionStatus = "WhenConditionFailure"
	WhenConditionStatusNotSatisfied WhenConditionStatus = "WhenConditionNotSatisfied"
	WhenConditionStatusSatisfied    WhenConditionStatus = "WhenConditionSatisfied"
	WhenConditionStatusUnknown      WhenConditionStatus = "WhenConditionUnknown"
)

func (WhenConditionStatus) String

func (wcs WhenConditionStatus) String() string

type WorkflowRun

type WorkflowRun struct {
	// Name is the name of the workflow that ran
	Name string
	// RunNumber is the run number for the workflow
	RunNumber int
	// AppURL is the frontend URL to the run
	AppURL *url.URL
}

type WorkflowRunManager

type WorkflowRunManager interface {
	Run(ctx context.Context, name string, parameters map[string]openapi.WorkflowRunParameter) (*WorkflowRun, error)
}

Jump to

Keyboard shortcuts

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