app

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: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImmutableConfigMapResourceVersionAnnotation = "controller.relay.sh/immutable-config-map-resource-version"

	KnativeServiceVisibilityLabel = "serving.knative.dev/visibility"
)
View Source
const (
	KnativeServiceVisibilityClusterLocal = "cluster-local"
)
View Source
const (
	// XXX MAKE SURE THIS GETS APPLIED
	ManagedByLabelValue = "relay.sh"
)
View Source
const ToolsWorkspaceName = "tools"

Variables

View Source
var (
	DefaultNetworkPolicyDeniedIPBlocks = []string{
		"0.0.0.0/8",
		"10.0.0.0/8",
		"100.64.0.0/10",
		"127.0.0.0/8",
		"169.254.0.0/16",
		"172.16.0.0/12",
		"192.0.0.0/24",
		"192.0.2.0/24",
		"192.31.196.0/24",
		"192.52.193.0/24",
		"192.168.0.0/16",
		"192.175.48.0/24",
		"198.18.0.0/15",
		"198.51.100.0/24",
		"203.0.113.0/24",
		"240.0.0.0/4",
	}
)
View Source
var DependencyManager = ownerext.NewManager("controller.relay.sh/dependency-of")

Functions

func AggregateStatusConditions

func AggregateStatusConditions(conds ...relayv1beta1.Condition) corev1.ConditionStatus

func ApplyKnativeService

func ApplyKnativeService(ctx context.Context, cl client.Client, wtd *WebhookTriggerDeps) (*obj.KnativeService, error)

func ApplyPipelineRun

func ApplyPipelineRun(ctx context.Context, cl client.Client, pp *PipelineParts) (*obj.PipelineRun, error)

func ConfigureImmutableConfigMapForRun

func ConfigureImmutableConfigMapForRun(ctx context.Context, cm *corev1obj.ConfigMap, rd *RunDeps) error

func ConfigureImmutableConfigMapForWebhookTrigger

func ConfigureImmutableConfigMapForWebhookTrigger(ctx context.Context, cm *corev1obj.ConfigMap, wt *obj.WebhookTrigger) error

func ConfigureKnativeService

func ConfigureKnativeService(ctx context.Context, s *obj.KnativeService, wtd *WebhookTriggerDeps) error

func ConfigureLimitRange

func ConfigureLimitRange(lr *corev1obj.LimitRange, opts ...LimitRangeOption)

func ConfigureMetadataAPIRole

func ConfigureMetadataAPIRole(role *rbacv1obj.Role, immutableConfigMap, mutableConfigMap *corev1obj.ConfigMap)

func ConfigureMetadataAPIRoleBinding

func ConfigureMetadataAPIRoleBinding(rb *rbacv1obj.RoleBinding, sa *corev1obj.ServiceAccount, role *rbacv1obj.Role)

func ConfigureMetadataAPIServiceAccount

func ConfigureMetadataAPIServiceAccount(sa *corev1obj.ServiceAccount)

func ConfigureMutableConfigMapForRun

func ConfigureMutableConfigMapForRun(ctx context.Context, cm *corev1obj.ConfigMap, r *obj.Run) error

func ConfigureNetworkPolicyForRun

func ConfigureNetworkPolicyForRun(np *networkingv1obj.NetworkPolicy, r *obj.Run, opts ...NetworkPolicyOption)

func ConfigureNetworkPolicyForTenant

func ConfigureNetworkPolicyForTenant(np *networkingv1obj.NetworkPolicy)

func ConfigureNetworkPolicyForWebhookTrigger

func ConfigureNetworkPolicyForWebhookTrigger(np *networkingv1obj.NetworkPolicy, wt *obj.WebhookTrigger, opts ...NetworkPolicyOption)

func ConfigurePipelineParts

func ConfigurePipelineParts(ctx context.Context, p *PipelineParts) error

func ConfigurePipelineRun

func ConfigurePipelineRun(ctx context.Context, pr *obj.PipelineRun, pp *PipelineParts) error

func ConfigureRun

func ConfigureRun(ctx context.Context, rd *RunDeps, pr *obj.PipelineRun)

func ConfigureRunDeps

func ConfigureRunDeps(ctx context.Context, rd *RunDeps) error

func ConfigureRunStatus

func ConfigureRunStatus(ctx context.Context, rd *RunDeps)

func ConfigureRunStepStatus

func ConfigureRunStepStatus(ctx context.Context, rd *RunDeps, pr *obj.PipelineRun)

func ConfigureRunStepStatusConditions

func ConfigureRunStepStatusConditions(ctx context.Context,
	currentStepStatus *relayv1beta1.StepStatus,
	actionStatus *model.ActionStatus) []relayv1beta1.StepCondition

func ConfigureRunWithSpecificStatus

func ConfigureRunWithSpecificStatus(r *obj.Run, rc relayv1beta1.RunConditionType, status corev1.ConditionStatus)

func ConfigureStepStatus

func ConfigureStepStatus(ctx context.Context, rd *RunDeps, stepName string, action *model.Step,
	status *tektonv1beta1.PipelineRunTaskRunStatus, currentStepStatus *relayv1beta1.StepStatus) *relayv1beta1.StepStatus

func ConfigureTask

func ConfigureTask(ctx context.Context, t *obj.Task, rd *RunDeps, ws *relayv1beta1.Step) error

func ConfigureTaskSet

func ConfigureTaskSet(ctx context.Context, ts *TaskSet) error

func ConfigureTenant

func ConfigureTenant(t *obj.Tenant, td *TenantDepsResult)

func ConfigureTenantDeps

func ConfigureTenantDeps(ctx context.Context, td *TenantDeps) error

func ConfigureUntrustedServiceAccount

func ConfigureUntrustedServiceAccount(sa *corev1obj.ServiceAccount)

func ConfigureWebhookTrigger

func ConfigureWebhookTrigger(wt *obj.WebhookTrigger, ksr *KnativeServiceResult)

func ConfigureWebhookTriggerDeps

func ConfigureWebhookTriggerDeps(ctx context.Context, wtd *WebhookTriggerDeps) error

func ModelStep

func ModelStep(r *obj.Run, step *relayv1beta1.Step) *model.Step

func ModelStepFromName

func ModelStepFromName(r *obj.Run, stepName string) *model.Step

func ModelStepObjectKey

func ModelStepObjectKey(key client.ObjectKey, ms *model.Step) client.ObjectKey

func ModelWebhookTrigger

func ModelWebhookTrigger(wt *obj.WebhookTrigger) *model.Trigger

func SuffixObjectKeyWithHashOfObjectKey

func SuffixObjectKeyWithHashOfObjectKey(key, hashable client.ObjectKey) client.ObjectKey

func UpdateStatusConditionIfTransitioned

func UpdateStatusConditionIfTransitioned(target *relayv1beta1.Condition, fn func() relayv1beta1.Condition)

Types

type APITriggerEventSink

type APITriggerEventSink struct {
	Sink        *relayv1beta1.APITriggerEventSink
	TokenSecret *corev1obj.OpaqueSecret
}

func NewAPITriggerEventSink

func NewAPITriggerEventSink(namespace string, sink *relayv1beta1.APITriggerEventSink) *APITriggerEventSink

func (*APITriggerEventSink) Load

func (tes *APITriggerEventSink) Load(ctx context.Context, cl client.Client) (bool, error)

func (*APITriggerEventSink) Token

func (tes *APITriggerEventSink) Token() (string, bool)

func (*APITriggerEventSink) URL

func (tes *APITriggerEventSink) URL() string

type APIWorkflowExecutionSink

type APIWorkflowExecutionSink struct {
	Sink        *relayv1beta1.APIWorkflowExecutionSink
	TokenSecret *corev1obj.OpaqueSecret
}

func NewAPIWorkflowExecutionSink

func NewAPIWorkflowExecutionSink(namespace string, sink *relayv1beta1.APIWorkflowExecutionSink) *APIWorkflowExecutionSink

func (*APIWorkflowExecutionSink) Load

func (*APIWorkflowExecutionSink) Token

func (a *APIWorkflowExecutionSink) Token() (string, bool)

func (*APIWorkflowExecutionSink) URL

type KnativeRevisionSet

type KnativeRevisionSet struct {
	ListOptions *client.ListOptions

	Revisions []*obj.KnativeRevision
}

func NewKnativeRevisionSet

func NewKnativeRevisionSet(opts ...client.ListOption) *KnativeRevisionSet

func NewKnativeRevisionSetForKnativeService

func NewKnativeRevisionSetForKnativeService(ks *obj.KnativeService) *KnativeRevisionSet

func (*KnativeRevisionSet) Load

func (krs *KnativeRevisionSet) Load(ctx context.Context, cl client.Client) (bool, error)

type KnativeServiceResult

type KnativeServiceResult struct {
	KnativeService *obj.KnativeService
	Error          error
}

func AsKnativeServiceResult

func AsKnativeServiceResult(ks *obj.KnativeService, err error) *KnativeServiceResult

type LimitRangeOption

type LimitRangeOption func(opts *limitRangeOptions)

func LimitRangeWithContainerDefaultLimit

func LimitRangeWithContainerDefaultLimit(rl corev1.ResourceList) LimitRangeOption

func LimitRangeWithContainerDefaultRequestLimit

func LimitRangeWithContainerDefaultRequestLimit(rl corev1.ResourceList) LimitRangeOption

func LimitRangeWithContainerMaxLimit

func LimitRangeWithContainerMaxLimit(rl corev1.ResourceList) LimitRangeOption

type NetworkPolicyOption

type NetworkPolicyOption func(opts *networkPolicyOptions)

func NetworkPolicyWithDeniedIPBlocks

func NetworkPolicyWithDeniedIPBlocks(blocks []string) NetworkPolicyOption

func NetworkPolicyWithMetadataAPIPodSelector

func NetworkPolicyWithMetadataAPIPodSelector(selector metav1.LabelSelector) NetworkPolicyOption

func NetworkPolicyWithMetadataAPIPort

func NetworkPolicyWithMetadataAPIPort(port int) NetworkPolicyOption

func NetworkPolicyWithSystemNamespaceSelector

func NetworkPolicyWithSystemNamespaceSelector(selector metav1.LabelSelector) NetworkPolicyOption

type PipelineParts

type PipelineParts struct {
	Deps *RunDeps

	Tasks    *TaskSet
	Pipeline *obj.Pipeline
}

func ApplyPipelineParts

func ApplyPipelineParts(ctx context.Context, cl client.Client, deps *RunDeps) (*PipelineParts, error)

func NewPipelineParts

func NewPipelineParts(deps *RunDeps) *PipelineParts

func (*PipelineParts) LabelAnnotateFrom

func (pp *PipelineParts) LabelAnnotateFrom(ctx context.Context, from metav1.Object)

func (*PipelineParts) Load

func (pp *PipelineParts) Load(ctx context.Context, cl client.Client) (bool, error)

func (*PipelineParts) Owned

func (pp *PipelineParts) Owned(ctx context.Context, owner lifecycle.TypedObject) error

func (*PipelineParts) Persist

func (pp *PipelineParts) Persist(ctx context.Context, cl client.Client) error

type RunDeps

type RunDeps struct {
	Run          *obj.Run
	Workflow     *obj.Workflow
	WorkflowDeps *WorkflowDeps

	Environment       string
	RuntimeToolsImage string
	Standalone        bool

	Issuer authenticate.Issuer

	OwnerConfigMap *corev1obj.ConfigMap

	NetworkPolicy *networkingv1obj.NetworkPolicy

	ImmutableConfigMap *corev1obj.ConfigMap
	MutableConfigMap   *corev1obj.ConfigMap

	MetadataAPIURL                        *url.URL
	MetadataAPIServiceAccount             *corev1obj.ServiceAccount
	MetadataAPIServiceAccountTokenSecrets *corev1obj.ServiceAccountTokenSecrets
	MetadataAPIRole                       *rbacv1obj.Role
	MetadataAPIRoleBinding                *rbacv1obj.RoleBinding

	PipelineServiceAccount  *corev1obj.ServiceAccount
	UntrustedServiceAccount *corev1obj.ServiceAccount
}

RunDeps represents the dependencies of a Run.

func NewRunDeps

func NewRunDeps(r *obj.Run, issuer authenticate.Issuer, metadataAPIURL *url.URL, opts ...RunDepsOption) *RunDeps

func (*RunDeps) AnnotateStepToken

func (rd *RunDeps) AnnotateStepToken(ctx context.Context, target *metav1.ObjectMeta, ws *relayv1beta1.Step) error

func (*RunDeps) Delete

func (rd *RunDeps) Delete(ctx context.Context, cl client.Client, opts ...lifecycle.DeleteOption) (bool, error)

func (*RunDeps) Load

func (rd *RunDeps) Load(ctx context.Context, cl client.Client) (*RunDepsLoadResult, error)

func (*RunDeps) Persist

func (rd *RunDeps) Persist(ctx context.Context, cl client.Client) error

type RunDepsLoadResult

type RunDepsLoadResult struct {
	Upstream bool
	All      bool
}

type RunDepsOption

type RunDepsOption func(rd *RunDeps)

func RunDepsWithEnvironment

func RunDepsWithEnvironment(environment string) RunDepsOption

func RunDepsWithRuntimeToolsImage

func RunDepsWithRuntimeToolsImage(image string) RunDepsOption

func RunDepsWithStandaloneMode

func RunDepsWithStandaloneMode(standalone bool) RunDepsOption

type TaskSet

type TaskSet struct {
	Deps *RunDeps
	List []*obj.Task
}

func NewTaskSet

func NewTaskSet(rd *RunDeps) *TaskSet

func (*TaskSet) LabelAnnotateFrom

func (ts *TaskSet) LabelAnnotateFrom(ctx context.Context, from metav1.Object)

func (*TaskSet) Load

func (ts *TaskSet) Load(ctx context.Context, cl client.Client) (bool, error)

func (*TaskSet) Owned

func (ts *TaskSet) Owned(ctx context.Context, owner lifecycle.TypedObject) error

func (*TaskSet) Persist

func (ts *TaskSet) Persist(ctx context.Context, cl client.Client) error

type TenantDeps

type TenantDeps struct {
	Tenant     *obj.Tenant
	Standalone bool

	// StaleNamespace is the old namespace of a tenant that needs to be cleaned
	// up.
	StaleNamespace *corev1obj.Namespace

	Namespace     *corev1obj.Namespace
	NetworkPolicy *networkingv1obj.NetworkPolicy
	LimitRange    *corev1obj.LimitRange

	APITriggerEventSink      *APITriggerEventSink
	APIWorkflowExecutionSink *APIWorkflowExecutionSink
}

func ApplyTenantDeps

func ApplyTenantDeps(ctx context.Context, cl client.Client, t *obj.Tenant, opts ...TenantDepsOption) (*TenantDeps, error)

func NewTenantDeps

func NewTenantDeps(t *obj.Tenant, opts ...TenantDepsOption) *TenantDeps

func (*TenantDeps) Delete

func (td *TenantDeps) Delete(ctx context.Context, cl client.Client, opts ...lifecycle.DeleteOption) (bool, error)

func (*TenantDeps) DeleteStale

func (td *TenantDeps) DeleteStale(ctx context.Context, cl client.Client, opts ...lifecycle.DeleteOption) (bool, error)

func (*TenantDeps) Load

func (td *TenantDeps) Load(ctx context.Context, cl client.Client) (bool, error)

func (*TenantDeps) Persist

func (td *TenantDeps) Persist(ctx context.Context, cl client.Client) error

type TenantDepsOption

type TenantDepsOption func(td *TenantDeps)

func TenantDepsWithStandaloneMode

func TenantDepsWithStandaloneMode(standalone bool) TenantDepsOption

type TenantDepsResult

type TenantDepsResult struct {
	TenantDeps *TenantDeps
	Error      error
}

func AsTenantDepsResult

func AsTenantDepsResult(td *TenantDeps, err error) *TenantDepsResult

type WebhookTriggerDeps

type WebhookTriggerDeps struct {
	WebhookTrigger *obj.WebhookTrigger
	Issuer         authenticate.Issuer
	Tenant         *obj.Tenant
	TenantDeps     *TenantDeps

	Environment       string
	RuntimeToolsImage string
	Standalone        bool

	// StaleOwnerConfigMap is a reference to a now-outdated stub object that
	// needs to be cleaned up. It is set if the tenant is deleted or if the
	// tenant namespace changes.
	StaleOwnerConfigMap *corev1obj.ConfigMap

	// OwnerConfigMap is a stub object that allows us to aggregate ownership of
	// the other objects created by these dependencies in the tenant namespace.
	OwnerConfigMap *corev1obj.ConfigMap

	NetworkPolicy *networkingv1obj.NetworkPolicy

	ImmutableConfigMap *corev1obj.ConfigMap
	MutableConfigMap   *corev1obj.ConfigMap

	MetadataAPIURL                        *url.URL
	MetadataAPIServiceAccount             *corev1obj.ServiceAccount
	MetadataAPIServiceAccountTokenSecrets *corev1obj.ServiceAccountTokenSecrets
	MetadataAPIRole                       *rbacv1obj.Role
	MetadataAPIRoleBinding                *rbacv1obj.RoleBinding

	KnativeServiceAccount *corev1obj.ServiceAccount
}

func NewWebhookTriggerDeps

func NewWebhookTriggerDeps(wt *obj.WebhookTrigger, issuer authenticate.Issuer, metadataAPIURL *url.URL, opts ...WebhookTriggerDepsOption) *WebhookTriggerDeps

func (*WebhookTriggerDeps) AnnotateTriggerToken

func (wtd *WebhookTriggerDeps) AnnotateTriggerToken(ctx context.Context, target *metav1.ObjectMeta) error

func (*WebhookTriggerDeps) Delete

func (wtd *WebhookTriggerDeps) Delete(ctx context.Context, cl client.Client, opts ...lifecycle.DeleteOption) (bool, error)

func (*WebhookTriggerDeps) DeleteStale

func (wtd *WebhookTriggerDeps) DeleteStale(ctx context.Context, cl client.Client, opts ...lifecycle.DeleteOption) (bool, error)

func (*WebhookTriggerDeps) Load

func (*WebhookTriggerDeps) Persist

func (wtd *WebhookTriggerDeps) Persist(ctx context.Context, cl client.Client) error

type WebhookTriggerDepsLoadResult

type WebhookTriggerDepsLoadResult struct {
	Upstream bool
	All      bool
}

type WebhookTriggerDepsOption

type WebhookTriggerDepsOption func(wtd *WebhookTriggerDeps)

func WebhookTriggerDepsWithEnvironment

func WebhookTriggerDepsWithEnvironment(environment string) WebhookTriggerDepsOption

func WebhookTriggerDepsWithRuntimeToolsImage

func WebhookTriggerDepsWithRuntimeToolsImage(image string) WebhookTriggerDepsOption

func WebhookTriggerDepsWithStandaloneMode

func WebhookTriggerDepsWithStandaloneMode(standalone bool) WebhookTriggerDepsOption

type WorkflowDeps

type WorkflowDeps struct {
	Workflow   *obj.Workflow
	Tenant     *obj.Tenant
	TenantDeps *TenantDeps
}

WorkflowDeps represents the dependencies of a Workflow.

func NewWorkflowDeps

func NewWorkflowDeps(w *obj.Workflow) *WorkflowDeps

func (*WorkflowDeps) Load

type WorkflowDepsLoadResult

type WorkflowDepsLoadResult struct {
	Upstream bool
	All      bool
}

Jump to

Keyboard shortcuts

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