workload

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SecretEnvParser = NewSecretEnvParser()
	RawEnvParser    = NewRawEnvParser()
)
View Source
var (
	ErrEmptySelectors        = errors.New("selectors must not be empty")
	ErrInvalidPort           = errors.New("port must be between 1 and 65535")
	ErrInvalidTargetPort     = errors.New("targetPort must be between 1 and 65535 if exist")
	ErrInvalidProtocol       = errors.New("protocol must be TCP or UDP")
	ErrDuplicatePortProtocol = errors.New("port-protocol pair must not be duplicate")
)

Functions

func MagicEnvVar

func MagicEnvVar(k, v string) *corev1.EnvVar

MagicEnvVar generates a specialized EnvVar based on the key and value of environment.

Examples:

MagicEnvVar("secret_key", "secret://my_secret/my_key")
MagicEnvVar("key", "value")

func NewJobGenerator

func NewJobGenerator(generator *Generator) (modules.Generator, error)

func NewJobGeneratorFunc

func NewJobGeneratorFunc(generator *Generator) modules.NewGeneratorFunc

func NewWorkloadGeneratorFunc

func NewWorkloadGeneratorFunc(g *Generator) modules.NewGeneratorFunc

func NewWorkloadServiceGenerator

func NewWorkloadServiceGenerator(request *Generator) (modules.Generator, error)

NewWorkloadServiceGenerator returns a new ServiceGenerator instance.

func NewWorkloadServiceGeneratorFunc

func NewWorkloadServiceGeneratorFunc(workloadGenerator *Generator) modules.NewGeneratorFunc

NewWorkloadServiceGeneratorFunc returns a new NewGeneratorFunc that returns a ServiceGenerator instance.

Types

type Generator

type Generator struct {
	// Project represents the Project name
	Project string
	// Stack represents the Stack name
	Stack string
	// App represents the application name
	App string
	// Namespace represents the K8s Namespace
	Namespace string
	// Workload represents the Workload configuration
	Workload *v1.Workload
	// PlatformConfigs represents the module platform configurations
	PlatformConfigs map[string]v1.GenericConfig
	// SecretStoreSpec contains configuration to describe target secret store.
	SecretStoreSpec *v1.SecretStore
}

func (*Generator) Generate

func (g *Generator) Generate(spec *v1.Spec) error

type MagicEnvParser

type MagicEnvParser interface {
	Match(k, v string) (matched bool)
	Gen(k, v string) *corev1.EnvVar
}

MagicEnvParser is an interface for environment variable parsers.

func NewRawEnvParser

func NewRawEnvParser() MagicEnvParser

NewRawEnvParser creates a new instance of RawEnvParser.

func NewSecretEnvParser

func NewSecretEnvParser() MagicEnvParser

NewSecretEnvParser creates a new instance of SecretEnvParser.

type ServiceGenerator

type ServiceGenerator struct {
	Project   string
	Stack     string
	App       string
	Namespace string
	Service   *apiv1.Service
	Config    apiv1.GenericConfig
}

ServiceGenerator is a struct for generating Service Workload resources.

func (*ServiceGenerator) Generate

func (g *ServiceGenerator) Generate(spec *apiv1.Spec) error

Generate generates a Service Workload resource to the given spec.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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