ir

package
v0.3.8-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const IRArtifactType transformertypes.ArtifactType = "IR"

IRArtifactType represents artifact type of IR

View Source
const IRConfigType transformertypes.ConfigType = "IR"

IRConfigType represents config type of IR

Variables

This section is empty.

Functions

This section is empty.

Types

type Application added in v0.3.3

type Application struct {
	Name          string
	RepoURL       string
	RepoPath      string
	RepoRef       string
	ClusterServer string
	DestNamespace string
}

Application holds the data for an ArgoCD application.

type ArgoCDResources added in v0.3.3

type ArgoCDResources struct {
	Applications []Application
}

ArgoCDResources holds all the ArgoCD specific resources.

type BuildConfig

type BuildConfig struct {
	Name              string
	ImageStreamName   string
	ImageStreamTag    string
	SourceSecretName  string
	WebhookSecretName string
	ContainerBuild    ContainerBuild
}

BuildConfig contains the resources needed to create a BuildConfig

type ContainerBuild

type ContainerBuild struct {
	ContainerBuildType ContainerBuildTypeValue                      `yaml:"-"`
	ContextPath        string                                       `yaml:"-"`
	Artifacts          map[ContainerBuildArtifactTypeValue][]string `yaml:"-"` //[artifacttype]value
}

ContainerBuild stores information about the container build

func (*ContainerBuild) Merge

func (c *ContainerBuild) Merge(newc ContainerBuild) bool

Merge merges two container build structs

type ContainerBuildArtifactTypeValue

type ContainerBuildArtifactTypeValue string

ContainerBuildArtifactTypeValue stores the container build artifact type

const (
	// DockerfileContainerBuildArtifactTypeValue represents dockerfile container build type artifact
	DockerfileContainerBuildArtifactTypeValue ContainerBuildArtifactTypeValue = "Dockerfile"
)

type ContainerBuildTypeValue

type ContainerBuildTypeValue string

ContainerBuildTypeValue stores the container build type

const (
	// DockerfileContainerBuildType represents dockerfile container build type
	DockerfileContainerBuildType ContainerBuildTypeValue = "Dockerfile"
	// S2IContainerBuildTypeValue represents s2i container build type
	S2IContainerBuildTypeValue ContainerBuildTypeValue = "S2I"
	// CNBContainerBuildTypeValue represents CNB container build type
	CNBContainerBuildTypeValue ContainerBuildTypeValue = "CNB"
)

type ContainerImage

type ContainerImage struct {
	ExposedPorts []int32  `yaml:"ports"`
	UserID       int      `yaml:"userID"`
	AccessedDirs []string `yaml:"accessedDirs"`
	Build        ContainerBuild
}

ContainerImage defines images that need to be built or reused.

func NewContainer

func NewContainer() ContainerImage

NewContainer creates a new container

func (*ContainerImage) AddAccessedDirs

func (c *ContainerImage) AddAccessedDirs(dirname string)

AddAccessedDirs adds accessed directories to container

func (*ContainerImage) AddExposedPort

func (c *ContainerImage) AddExposedPort(port int32)

AddExposedPort adds an exposed port to a container

func (*ContainerImage) Merge

func (c *ContainerImage) Merge(newc ContainerImage) bool

Merge merges containers

type EnhancedIR

type EnhancedIR struct {
	IR
	Roles           []Role
	RoleBindings    []RoleBinding
	ServiceAccounts []ServiceAccount
	BuildConfigs    []BuildConfig
	TektonResources TektonResources
	ArgoCDResources ArgoCDResources
}

EnhancedIR is IR with extra data specific to API resource sets

func NewEnhancedIRFromIR

func NewEnhancedIRFromIR(ir IR) EnhancedIR

NewEnhancedIRFromIR returns a new EnhancedIR given an IR It makes a deep copy of the IR before embedding it in the EnhancedIR.

type EventListener

type EventListener struct {
	Name                string
	ServiceAccountName  string
	TriggerBindingName  string
	TriggerTemplateName string
}

EventListener holds the details about the git event listener resource

type IR

type IR struct {
	Name            string
	ContainerImages map[string]ContainerImage // [imageName]
	Services        map[string]Service
	Storages        []Storage
}

IR is the intermediate representation filled by source transformers

func NewIR

func NewIR() IR

NewIR creates a new IR

func (*IR) AddContainer

func (ir *IR) AddContainer(imageName string, container ContainerImage)

AddContainer adds a conatainer to IR

func (*IR) AddService

func (ir *IR) AddService(service Service)

AddService adds a service to the IR if it does not already exist. Else it merges with existing service.

func (*IR) AddStorage

func (ir *IR) AddStorage(st Storage)

AddStorage adds a storage to IR

func (*IR) GetAllServicePorts

func (ir *IR) GetAllServicePorts() []int32

GetAllServicePorts returns all ports with a serviceport mapping

func (*IR) Merge

func (ir *IR) Merge(newirC interface{}) bool

Merge merges IRs

type Pipeline

type Pipeline struct {
	Name          string
	WorkspaceName string
}

Pipeline holds the details about the clone build push pipeline resource

type PodSpec added in v0.3.3

type PodSpec core.PodSpec

PodSpec is type alias for core.PodSpec

func (PodSpec) MarshalYAML added in v0.3.3

func (i PodSpec) MarshalYAML() (interface{}, error)

MarshalYAML for the PodSpec type

type PolicyRule

type PolicyRule struct {
	APIGroups []string
	Resources []string
	Verbs     []string
}

PolicyRule holds the details about the policy rules for the service account resources

type Role

type Role struct {
	Name        string
	PolicyRules []PolicyRule
}

Role holds the details about the role resource

type RoleBinding

type RoleBinding struct {
	Name               string
	RoleName           string
	ServiceAccountName string
}

RoleBinding holds the details about the role binding resource

type Service

type Service struct {
	PodSpec

	Name                        string
	BackendServiceName          string // Optional field when ingress name is not the same as backend service name
	Annotations                 map[string]string
	Labels                      map[string]string
	ServiceToPodPortForwardings []ServiceToPodPortForwarding
	Replicas                    int
	Networks                    []string
	OnlyIngress                 bool
	Daemon                      bool //Gets converted to DaemonSet
}

Service defines structure of an IR service

func NewServiceWithName

func NewServiceWithName(serviceName string) Service

NewServiceWithName initializes a service with just the name.

func (*Service) AddPortForwarding

func (service *Service) AddPortForwarding(servicePort networking.ServiceBackendPort, podPort networking.ServiceBackendPort, relPath string) error

AddPortForwarding adds a new port forwarding to the service.

func (*Service) AddVolume

func (service *Service) AddVolume(volume core.Volume)

AddVolume adds a volume to a service

func (*Service) HasValidAnnotation

func (service *Service) HasValidAnnotation(annotation string) bool

HasValidAnnotation returns if an annotation is set for the service

func (Service) MarshalYAML added in v0.3.3

func (service Service) MarshalYAML() (interface{}, error)

MarshalYAML for the Service type

type ServiceAccount

type ServiceAccount struct {
	Name        string
	SecretNames []string
}

ServiceAccount holds the details about the service account resource

type ServiceToPodPortForwarding

type ServiceToPodPortForwarding struct {
	ServicePort    networking.ServiceBackendPort
	PodPort        networking.ServiceBackendPort
	ServiceRelPath string
	ServiceType    core.ServiceType
}

ServiceToPodPortForwarding forwards a k8s service port to a k8s pod port

type Storage

type Storage struct {
	Name                           string
	Annotations                    map[string]string // Optional field to store arbitrary metadata
	core.PersistentVolumeClaimSpec                   //This promotion contains the volumeName which is used by configmap, secrets and pvc.
	StorageType                    StorageKindType   //Type of storage cfgmap, secret, pvc
	SecretType                     core.SecretType   // Optional field to store the type of secret data
	Content                        map[string][]byte //Optional field meant to store content for cfgmap or secret
}

Storage defines structure of a storage

func (*Storage) Merge

func (s *Storage) Merge(newst Storage) bool

Merge merges storage

type StorageKindType

type StorageKindType string

StorageKindType defines storage type kind

const (
	// SecretKind defines storage type of Secret
	SecretKind StorageKindType = "Secret"
	// ConfigMapKind defines storage type of ConfigMap
	ConfigMapKind StorageKindType = "ConfigMap"
	// PVCKind defines storage type of PersistentVolumeClaim
	PVCKind StorageKindType = "PersistentVolumeClaim"
	// PullSecretKind defines storage type of pull secret
	PullSecretKind StorageKindType = "PullSecret"
)

type TektonResources

type TektonResources struct {
	EventListeners   []EventListener
	TriggerBindings  []TriggerBinding
	TriggerTemplates []TriggerTemplate
	Pipelines        []Pipeline
}

TektonResources contains the resources for CI/CD

type TriggerBinding

type TriggerBinding struct {
	Name string
}

TriggerBinding holds the details about the git event trigger binding resource

type TriggerTemplate

type TriggerTemplate struct {
	Name               string
	PipelineName       string
	PipelineRunName    string
	ServiceAccountName string
	WorkspaceName      string
	StorageClassName   string
}

TriggerTemplate holds the details about the git event trigger template resource

Jump to

Keyboard shortcuts

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