workspace

package
v0.0.0-...-a41b62c Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	APIRuleGateway = "kyma-gateway.kyma-system.svc.cluster.local"
	APIRulePath    = "/.*"
	APIRuleHandler = "allow"
	APIRulePort    = int64(80)
)
View Source
const CfgFilename = "config.yaml"

Variables

View Source
var (
	AllowedSchemaVersions = []SchemaVersion{
		SchemaVersionV0,
		SchemaVersionV1,
	}
)
View Source
var DefaultWriterProvider = func(outFilePath string) (io.Writer, func() error, error) {
	file, err := os.Create(outFilePath)
	if err != nil {
		return nil, nil, err
	}
	return file, file.Close, nil
}

Functions

func Initialize

func Initialize(cfg Cfg, dirPath string) error

func InlineFileNames

func InlineFileNames(r types.Runtime) (SourceFileName, DepsFileName, bool)

func ReflectSchema

func ReflectSchema() ([]byte, error)

func Synchronise

func Synchronise(ctx context.Context, config Cfg, outputPath string, build client.Build) error

Types

type APIRule

type APIRule struct {
	Name    string  `yaml:"name,omitempty"`
	Gateway string  `yaml:"gateway,omitempty"`
	Service Service `yaml:"service"`
	Rules   []Rule  `yaml:"rules"`
}

type AccessStrategie

type AccessStrategie struct {
	Config  AccessStrategieConfig `yaml:"config,omitempty"`
	Handler string                `yaml:"handler" jsonschema:"enum=oauth2_introspection,enum=jwt,enum=noop,enum=allow,default=allow"`
}

type AccessStrategieConfig

type AccessStrategieConfig struct {
	JwksUrls       []string `yaml:"jwksUrls,omitempty"`
	TrustedIssuers []string `yaml:"trustedIssuers,omitempty"`
	RequiredScope  []string `yaml:"requiredScope,omitempty"`
}

type Cancel

type Cancel = func() error

type Cfg

type Cfg struct {
	Name                 string            `yaml:"name"`
	Namespace            string            `yaml:"namespace"`
	Labels               map[string]string `yaml:"labels,omitempty"`
	Runtime              types.Runtime     `yaml:"runtime" jsonschema:"enum=nodejs18,enum=nodejs20,enum=python39,enum=python312"`
	RuntimeImageOverride string            `yaml:"runtimeImageOverride,omitempty"`
	Source               Source            `yaml:"source"`
	Resources            Resources         `yaml:"resource,omitempty"`
	Subscriptions        []Subscription    `yaml:"subscriptions,omitempty"`
	RuntimeLabels        map[string]string `yaml:"runtimeLabels,omitempty"`
	RuntimeAnnotations   map[string]string `yaml:"runtimeAnnotations,omitempty"`
	Env                  []EnvVar          `yaml:"env,omitempty"`
	APIRules             []APIRule         `yaml:"apiRules,omitempty"`
	SchemaVersion        SchemaVersion     `yaml:"schemaVersion"`
}

func (Cfg) FileName

func (cfg Cfg) FileName() string

func (Cfg) Write

func (cfg Cfg) Write(writer io.Writer, _ interface{}) error

type ConfigMapKeySelector

type ConfigMapKeySelector struct {
	Name string `yaml:"name"`
	Key  string `yaml:"key"`
}

type DepsFileName

type DepsFileName = string

type EnvVar

type EnvVar struct {
	Name      string        `yaml:"name"`
	Value     string        `yaml:"value,omitempty"`
	ValueFrom *EnvVarSource `yaml:"valueFrom,omitempty"`
}

type EnvVarSource

type EnvVarSource struct {
	ConfigMapKeyRef *ConfigMapKeySelector `yaml:"configMapKeyRef,omitempty"`
	SecretKeyRef    *SecretKeySelector    `yaml:"secretKeyRef,omitempty"`
}

type EventFilter

type EventFilter struct {
	EventSource EventSource `yaml:"eventSource"`
	EventType   EventType   `yaml:"eventType"`
}

type EventSource

type EventSource struct {
	Property string `yaml:"property" jsonschema:"default=source"`
	Type     string `yaml:"type" jsonschema:"default=exact"`
	Value    string `yaml:"value" jsonschema:"default=\"\""`
}

type EventType

type EventType struct {
	Property string `yaml:"property" jsonschema:"default=type"`
	Type     string `yaml:"type" jsonschema:"default=exact"`
	Value    string `yaml:"value"`
}

type File

type File interface {
	Write(io.Writer, interface{}) error
	FileName() string
}

func NewTemplatedFile

func NewTemplatedFile(tpl string, name FileName) File

type FileName

type FileName string
const (
	FileNameHandlerJs   FileName = "handler.js"
	FileNamePackageJSON FileName = "package.json"
)
const (
	FileNameHandlerPy       FileName = "handler.py"
	FileNameRequirementsTxt FileName = "requirements.txt"
)

type Filter

type Filter struct {
	Dialect string        `yaml:"dialect,omitempty"`
	Filters []EventFilter `yaml:"filters"`
}

type ResourceList

type ResourceList = map[ResourceName]interface{}

type ResourceName

type ResourceName = string
const (
	ResourceNameCPU    ResourceName = "cpu"
	ResourceNameMemory ResourceName = "memory"
)

type Resources

type Resources struct {
	Limits   ResourceList `yaml:"limits,omitempty"`
	Requests ResourceList `yaml:"requests,omitempty"`
}

type Rule

type Rule struct {
	Path             string            `yaml:"path,omitempty"`
	Methods          []string          `yaml:"methods"`
	AccessStrategies []AccessStrategie `yaml:"accessStrategies"`
}

type SchemaVersion

type SchemaVersion string
const (
	SchemaVersionV0      SchemaVersion = "v0"
	SchemaVersionV1      SchemaVersion = "v1"
	SchemaVersionDefault SchemaVersion = SchemaVersionV0
	SchemaVersionLatest  SchemaVersion = SchemaVersionV1
)

type SecretKeySelector

type SecretKeySelector struct {
	Name string `yaml:"name"`
	Key  string `yaml:"key"`
}

type Service

type Service struct {
	Host string `yaml:"host"`
	Port int64  `yaml:"port,omitempty"`
}

type Source

type Source struct {
	Type         SourceType `yaml:"sourceType" jsonschema:"enum=inline,enum=git"`
	SourceInline `yaml:",inline"`
	SourceGit    `yaml:",inline"`
}

type SourceFileName

type SourceFileName = string

type SourceGit

type SourceGit struct {
	URL                   string `yaml:"url,omitempty"`
	Reference             string `yaml:"reference,omitempty"`
	BaseDir               string `yaml:"baseDir,omitempty"`
	CredentialsSecretName string `yaml:"credentialsSecretName,omitempty"`
	CredentialsType       string `yaml:"credentialsType,omitempty"`
}

func (SourceGit) Type

func (s SourceGit) Type() SourceType

type SourceInline

type SourceInline struct {
	SourcePath        string `yaml:"sourcePath,omitempty"`
	SourceHandlerName string `yaml:"sourceHandlerName,omitempty"`
	DepsHandlerName   string `yaml:"depsHandlerName,omitempty"`
}

func (SourceInline) Type

func (s SourceInline) Type() SourceType

type SourceType

type SourceType string
const (
	SourceTypeInline SourceType = "inline"
	SourceTypeGit    SourceType = "git"
)

type Subscription

type Subscription struct {
	Name string          `yaml:"name,omitempty"`
	V0   *SubscriptionV0 `yaml:",inline,omitempty"`
	V1   *SubscriptionV1 `yaml:",inline,omitempty"`
}

type SubscriptionV0

type SubscriptionV0 struct {
	Protocol string `yaml:"protocol" jsonschema:"default=\"\""`
	Filter   Filter `yaml:"filter"`
}

type SubscriptionV1

type SubscriptionV1 struct {
	TypeMatching string   `yaml:"typeMatching,omitempty"`
	Source       string   `yaml:"source"`
	Types        []string `yaml:"types"`
}

type TemplatedFile

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

func (TemplatedFile) FileName

func (t TemplatedFile) FileName() string

func (TemplatedFile) Write

func (t TemplatedFile) Write(writer io.Writer, cfg interface{}) error

type WriterProvider

type WriterProvider func(path string) (io.Writer, Cancel, error)

func (WriterProvider) Write

func (p WriterProvider) Write(destinationDirPath string, fileTemplate File, cfg interface{}) error

Jump to

Keyboard shortcuts

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