platform

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	FlagControllers       string = "controllers"
	FlagSharedMainName    string = "unique-process-name"
	DefaultSharedMainName string = "tekton-operator"
)
View Source
const (
	ControllerTektonConfig       ControllerName = "tektonconfig"
	ControllerTektonPipeline     ControllerName = "tektonpipeline"
	ControllerTektonTrigger      ControllerName = "tektontrigger"
	ControllerTektonInstallerSet ControllerName = "tektoninstallerset"
	ControllerTektonHub          ControllerName = "tektonhub"
	ControllerTektonChain        ControllerName = "tektonchain"
	ControllerTektonResult       ControllerName = "tektonresult"
	EnvControllerNames           string         = "CONTROLLER_NAMES"
	EnvSharedMainName            string         = "UNIQUE_PROCESS_NAME"
)

Controllers common to all platforms

Variables

View Source
var (
	ErrSharedMainNameEmpty = fmt.Errorf("sharedMainName cannot be empty string")
	ErrControllerNamesNil  = fmt.Errorf("ControllerNames slice should be non-nil")
)

Functions

func ErrorControllerNames

func ErrorControllerNames(invalidNames string, validNames []string) error

ErrorControllerNames is a error message format helper

func RegisterFlags

func RegisterFlags()

RegisterFlags adds platform specific command line flags this logic is written in a separate function to make it convenient to write unit-tests

func StartMainWithAllControllers

func StartMainWithAllControllers(p Platform)

StartMainWithAllControllers calls startMain with all controllers supported by a platform

func StartMainWithSelectedControllers

func StartMainWithSelectedControllers(p Platform)

StartMainWithAllControllers calls startMain with a subset of controllers specified in the platformConfig of a platform

Types

type ControllerMap

ControllerMap defines map that maps a name given to a controller(reconciler) to its injection.ControllerConstructor

func (ControllerMap) ControllerConstructors

func (cm ControllerMap) ControllerConstructors() []injection.ControllerConstructor

ControllerConstructor returns a []injection.ControllerConstructor of all controllers (reconciers) supported in a given ControlelrMap Some versions of sharedMain functions in knative/pkg expect a variadic list of supported cotrollers as []injection.ControllerConstructor

func (ControllerMap) ControllerNames

func (cm ControllerMap) ControllerNames() []string

ControllerNames returns a []string of names of all controllers (reconciers) supported in a given ControlelrMap

func (ControllerMap) NamedControllerConstructors

func (cm ControllerMap) NamedControllerConstructors() []injection.NamedControllerConstructor

ControllerConstructor returns a []injection.NamedControllerConstructor of all controllers (reconciers) supported in a given ControlelrMap Some versions of sharedMain functions in knative/pkg expect a variadic list of supported cotrollers as []injection.NamedControllerConstructor

type ControllerName

type ControllerName string

ControllerName defines a name given to a controller(reconciler) in a platform

type FakePlatform

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

func SeededFakePlatform

func SeededFakePlatform(cn []ControllerName, ctrls ControllerMap) *FakePlatform

func (*FakePlatform) AllSupportedControllers

func (fp *FakePlatform) AllSupportedControllers() ControllerMap

func (*FakePlatform) PlatformParams

func (fp *FakePlatform) PlatformParams() PlatformConfig

type Platform

type Platform interface {
	PlatformParams() PlatformConfig
	AllSupportedControllers() ControllerMap
}

Platform defines a Kubernetes platform (Vanila Kubernetes, OpenShift...)

type PlatformConfig

type PlatformConfig struct {
	Name            string
	ControllerNames []ControllerName
	SharedMainName  string
}

PlatformConfig defines basic configuration that all platforms should support

func NewConfigFromEnv

func NewConfigFromEnv() PlatformConfig

NewConfigFromEnv returns PlatformConfig created using inputs from environment variables

func NewConfigFromFlags

func NewConfigFromFlags() PlatformConfig

NewConfigFromFlags returns PlatformConfig created using inputs from command line flags

type PlatformNameKey

type PlatformNameKey struct{}

PlatformNameKey is defines a 'key' for adding platform name to an instance of context.Context

Jump to

Keyboard shortcuts

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