components

package
v0.50.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const LabelKey string = "v1.dracon.ocurity.com/component"

LabelKey is the key of the label where the value must be a string of the ComponentType enum

Variables

View Source
var (
	// ErrCouldNotStatPath is returned when the path to the components doesn't
	// exist or is inaccesbile
	ErrCouldNotStatPath = errors.New("could not stat path")
	// ErrNotADirectory is returned when the path is not pointing to a
	// directory
	ErrNotADirectory = errors.New("path is not a directory")
)
View Source
var ErrInvalidComponentType = fmt.Errorf("not a valid ComponentType, try [%s]", strings.Join(_ComponentTypeNames, ", "))
View Source
var ErrInvalidOrchestrationType = fmt.Errorf("not a valid OrchestrationType, try [%s]", strings.Join(_OrchestrationTypeNames, ", "))

Functions

func ADifferenceFromB added in v0.18.0

func ADifferenceFromB(componentTypeA ComponentType, componentTypeB ComponentType) int

ADifferenceFromB returns the difference in position between ComponentType A and ComponentType B e.g. Enricher is 2 steps further along the pipeline than Producer

func AGreaterThanB added in v0.18.0

func AGreaterThanB(componentTypeA ComponentType, componentTypeB ComponentType) bool

AGreaterThanB returns whether ComponentType A is further along the pipeline than ComponentType B e.g. Enricher is further along the pipeline than Producer

func ComponentTypeNames added in v0.18.0

func ComponentTypeNames() []string

ComponentTypeNames returns a list of possible string values of ComponentType.

func GatherTasks added in v0.14.0

func GatherTasks(folder string) ([]string, error)

GatherTasks returns the paths of all the Tekton Tasks discovered

func LabelValueOneOf added in v0.13.0

func LabelValueOneOf(labels map[string]string, componentTypes ...ComponentType) (bool, error)

LabelValueOneOf checks if the labels map has the expected key set and if that key has any one of the expected values

func LoadTasks added in v0.14.0

func LoadTasks(ctx context.Context, taskPaths []string) ([]*tektonv1beta1api.Task, error)

func OrchestrationTypeNames added in v0.18.0

func OrchestrationTypeNames() []string

OrchestrationTypeNames returns a list of possible string values of OrchestrationType.

func Package added in v0.2.0

func Package(ctx context.Context, name, componentFolder string, draconVersion string, chartVersion string) (err error)

Package explores the components folder provided and gathers all the Tekton Tasks into one Helm chart.

func ProcessTasks added in v0.13.0

func ProcessTasks(taskList ...*tektonv1beta1api.Task) error

ProcessTasks adds anchors, environment variables, parameters and any extra infrastructure required for a Task to become a useful part of a pipeline.

Types

type Component added in v0.2.0

type Component struct {
	// Name of the component. Should be unique
	Name string

	// Reference is the original reference to the component in the pipeline
	// description
	Reference string

	// Repository is the repository from where this component was fetched
	Repository string

	// Type of the component (base, source, producer, etc...)
	Type ComponentType

	// Resolved shows whether the component manifest has been loaded.
	// Before this is set to true, the Type and Manifest are not known.
	Resolved bool

	// OrchestrationType shows how the component deployment is managed
	OrchestrationType OrchestrationType

	// Manifest is the K8s manifest of the object
	Manifest runtime.Object
}

Component represents a Dracon component. At the moment it can only be a Tekton Task, but in the future it might represent other things too.

func FromReference added in v0.2.0

func FromReference(ctx context.Context, ref string) (Component, error)

FromReference resolves a reference and returns an instance of a component. If the component is naively orchestrated, it will be loaded

type ComponentType

type ComponentType string

ComponentType represents all the types of components that Dracon supports ENUM(unknown, base, source, producer, producer-aggregator, enricher, enricher-aggregator, consumer)

const (
	// Unknown is a ComponentType of type unknown.
	Unknown ComponentType = "unknown"
	// Base is a ComponentType of type base.
	Base ComponentType = "base"
	// Source is a ComponentType of type source.
	Source ComponentType = "source"
	// Producer is a ComponentType of type producer.
	Producer ComponentType = "producer"
	// ProducerAggregator is a ComponentType of type producer-aggregator.
	ProducerAggregator ComponentType = "producer-aggregator"
	// Enricher is a ComponentType of type enricher.
	Enricher ComponentType = "enricher"
	// EnricherAggregator is a ComponentType of type enricher-aggregator.
	EnricherAggregator ComponentType = "enricher-aggregator"
	// Consumer is a ComponentType of type consumer.
	Consumer ComponentType = "consumer"
)

func ComponentTypeValues added in v0.18.0

func ComponentTypeValues() []ComponentType

ComponentTypeValues returns a list of the values for ComponentType

func GetPrevious added in v0.18.0

func GetPrevious(componentType ComponentType) ComponentType

GetPrevious returns previous component type e.g. If we want the previous component type of Producer, we get Source

func MustParseComponentType added in v0.18.0

func MustParseComponentType(name string) ComponentType

MustParseComponentType converts a string to a ComponentType, and panics if is not valid.

func ParseComponentType added in v0.18.0

func ParseComponentType(name string) (ComponentType, error)

ParseComponentType attempts to convert a string to a ComponentType.

func ValidateTask

func ValidateTask(task *tektonV1Beta1.Task) (ComponentType, error)

func (ComponentType) IsValid added in v0.18.0

func (x ComponentType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ComponentType) MarshalText added in v0.13.0

func (x ComponentType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (*ComponentType) Scan added in v0.18.0

func (x *ComponentType) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (ComponentType) String

func (x ComponentType) String() string

String implements the Stringer interface.

func (*ComponentType) UnmarshalText added in v0.13.0

func (x *ComponentType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (ComponentType) Value added in v0.18.0

func (x ComponentType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullComponentType added in v0.18.0

type NullComponentType struct {
	ComponentType ComponentType
	Valid         bool
	Set           bool
}

func NewNullComponentType added in v0.18.0

func NewNullComponentType(val interface{}) (x NullComponentType)

func (NullComponentType) MarshalJSON added in v0.18.0

func (n NullComponentType) MarshalJSON() ([]byte, error)

MarshalJSON correctly serializes a NullComponentType to JSON.

func (*NullComponentType) Scan added in v0.18.0

func (x *NullComponentType) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (*NullComponentType) UnmarshalJSON added in v0.18.0

func (n *NullComponentType) UnmarshalJSON(b []byte) error

UnmarshalJSON correctly deserializes a NullComponentType from JSON.

func (NullComponentType) Value added in v0.18.0

func (x NullComponentType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullOrchestrationType added in v0.18.0

type NullOrchestrationType struct {
	OrchestrationType OrchestrationType
	Valid             bool
	Set               bool
}

func NewNullOrchestrationType added in v0.18.0

func NewNullOrchestrationType(val interface{}) (x NullOrchestrationType)

func (NullOrchestrationType) MarshalJSON added in v0.18.0

func (n NullOrchestrationType) MarshalJSON() ([]byte, error)

MarshalJSON correctly serializes a NullOrchestrationType to JSON.

func (*NullOrchestrationType) Scan added in v0.18.0

func (x *NullOrchestrationType) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (*NullOrchestrationType) UnmarshalJSON added in v0.18.0

func (n *NullOrchestrationType) UnmarshalJSON(b []byte) error

UnmarshalJSON correctly deserializes a NullOrchestrationType from JSON.

func (NullOrchestrationType) Value added in v0.18.0

func (x NullOrchestrationType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type OrchestrationType added in v0.2.0

type OrchestrationType string

ENUM(unknown, naive, external-helm)

const (
	// OrchestrationTypeUnknown is a OrchestrationType of type unknown.
	OrchestrationTypeUnknown OrchestrationType = "unknown"
	// OrchestrationTypeNaive is a OrchestrationType of type naive.
	OrchestrationTypeNaive OrchestrationType = "naive"
	// OrchestrationTypeExternalHelm is a OrchestrationType of type external-helm.
	OrchestrationTypeExternalHelm OrchestrationType = "external-helm"
)

func MustParseOrchestrationType added in v0.18.0

func MustParseOrchestrationType(name string) OrchestrationType

MustParseOrchestrationType converts a string to a OrchestrationType, and panics if is not valid.

func ParseOrchestrationType added in v0.18.0

func ParseOrchestrationType(name string) (OrchestrationType, error)

ParseOrchestrationType attempts to convert a string to a OrchestrationType.

func (OrchestrationType) IsValid added in v0.18.0

func (x OrchestrationType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (OrchestrationType) MarshalText added in v0.13.0

func (x OrchestrationType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (OrchestrationType) Ptr added in v0.18.0

func (*OrchestrationType) Scan added in v0.18.0

func (x *OrchestrationType) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (OrchestrationType) String added in v0.13.0

func (x OrchestrationType) String() string

String implements the Stringer interface.

func (*OrchestrationType) UnmarshalText added in v0.13.0

func (x *OrchestrationType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (OrchestrationType) Value added in v0.18.0

func (x OrchestrationType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

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