services

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 23 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvsAsConfigMapData added in v0.1.33

func EnvsAsConfigMapData(envs []string) map[string]string

func EnvsAsSecretData added in v0.1.33

func EnvsAsSecretData(envs ...string) map[string]string

func NOOP added in v0.1.20

func NOOP() *runtimev0.DesiredState

func NetworkMappingForGRPCRoute added in v0.1.35

func NetworkMappingForGRPCRoute(ctx context.Context, grpc *configurations.GRPCRoute, mappings []*basev0.NetworkMapping) (*basev0.NetworkMapping, error)

NetworkMappingForGRPCRoute finds the proper network mapping for a given gRPC route

func NetworkMappingForRestRouteGroup added in v0.1.18

func NetworkMappingForRestRouteGroup(ctx context.Context, group *configurations.RestRouteGroup, mappings []*basev0.NetworkMapping) (*basev0.NetworkMapping, error)

NetworkMappingForRestRouteGroup finds the proper network mapping for a given REST route group

func NewBuilderAgent added in v0.1.20

func NewBuilderAgent(conf *configurations.Agent, builder Builder) agents.AgentImplementation

func NewRuntimeAgent added in v0.0.26

func NewRuntimeAgent(conf *configurations.Agent, runtime Runtime) agents.AgentImplementation

func NewServiceAgent added in v0.0.51

func NewServiceAgent(conf *configurations.Agent, service Agent) agents.AgentImplementation

NewServiceAgent binds the Agent implementation to the Agent

Types

type Agent added in v0.0.51

type Agent interface {
	GetAgentInformation(ctx context.Context, req *agentv0.AgentInformationRequest) (*agentv0.AgentInformation, error)
}

type Base added in v0.0.26

type Base struct {
	// Agent
	Agent     *configurations.Agent
	WoolAgent *wool.Provider
	Wool      *wool.Wool

	// Underlying service
	WoolService *wool.Provider

	// State
	Identity *configurations.ServiceIdentity
	Location string

	// codefly configuration
	ConfigurationLocation string

	Configuration *configurations.Service

	// Information convenience
	Information *Information

	// Environment
	Environment *basev0.Environment

	// Endpoints
	Endpoints           []*basev0.Endpoint
	DependencyEndpoints []*basev0.Endpoint

	// NetworkMappings
	NetworkMappings []*basev0.NetworkMapping

	// ServiceInfo
	ServiceProviderInfos []*basev0.ProviderInformation

	// EnvironmentVariables
	EnvironmentVariables *configurations.EnvironmentVariableManager

	// Wrappers
	Runtime *RuntimeWrapper
	Builder *BuilderWrapper

	// Runtime
	State InformationStatus

	// Communication
	Communication *communicate.Server

	// Code Watcher
	Watcher *code.Watcher
	Events  chan code.Change
	// contains filtered or unexported fields
}

func NewServiceBase added in v0.0.26

func NewServiceBase(ctx context.Context, agent *configurations.Agent) *Base

func (*Base) Communicate added in v0.0.26

func (s *Base) Communicate(ctx context.Context, eng *agentv0.Engage) (*agentv0.InformationRequest, error)

func (*Base) Debug added in v0.0.69

func (s *Base) Debug(msg string, fields ...*wool.LogField)

func (*Base) DockerImage added in v0.0.31

func (s *Base) DockerImage(req *builderv0.BuildContext) *configurations.DockerImage

func (*Base) EndpointsFromConfiguration added in v0.0.26

func (s *Base) EndpointsFromConfiguration(ctx context.Context) ([]*basev0.Endpoint, error)

EndpointsFromConfiguration from Configuration and data from the service

func (*Base) Errorf added in v0.0.28

func (s *Base) Errorf(format string, args ...any) error

func (*Base) Focus added in v0.0.69

func (s *Base) Focus(msg string, fields ...*wool.LogField)

func (*Base) HeadlessLoad added in v0.1.50

func (s *Base) HeadlessLoad(ctx context.Context, identity *basev0.ServiceIdentity) error

func (*Base) Info added in v0.0.75

func (s *Base) Info(msg string, fields ...*wool.LogField)

func (*Base) Load added in v0.0.72

func (s *Base) Load(ctx context.Context, identity *basev0.ServiceIdentity, settings any) error

func (*Base) LoadEnvironmentVariables added in v0.1.22

func (s *Base) LoadEnvironmentVariables(environment *basev0.Environment) *configurations.EnvironmentVariableManager

func (*Base) Local added in v0.0.26

func (s *Base) Local(f string, args ...any) string

func (*Base) LocalDirCreate added in v0.1.39

func (s *Base) LocalDirCreate(ctx context.Context, f string, args ...any) (string, error)

func (*Base) LogForward added in v0.1.16

func (s *Base) LogForward(msg string, args ...any)

func (*Base) Ready added in v0.0.72

func (s *Base) Ready()

func (*Base) SetupWatcher added in v0.0.26

func (s *Base) SetupWatcher(ctx context.Context, conf *WatchConfiguration, handler func(event code.Change) error) error

func (*Base) Stop added in v0.0.26

func (s *Base) Stop() error

func (*Base) Templates added in v0.0.26

func (s *Base) Templates(ctx context.Context, obj any, wrappers ...*TemplateWrapper) error

func (*Base) Unique added in v0.1.6

func (s *Base) Unique() string

func (*Base) Version added in v0.0.26

func (s *Base) Version() *basev0.Version

func (*Base) WantSync added in v0.0.26

func (s *Base) WantSync()

type Builder added in v0.1.20

type BuilderAgent added in v0.1.20

type BuilderAgent struct {
	Client      builderv0.BuilderClient
	Agent       *configurations.Agent
	ProcessInfo *manager.ProcessInfo
}

func (BuilderAgent) Build added in v0.1.20

func (BuilderAgent) Communicate added in v0.1.20

func (BuilderAgent) Create added in v0.1.20

func (BuilderAgent) Deploy added in v0.1.20

func (BuilderAgent) Init added in v0.1.20

func (BuilderAgent) Load added in v0.1.20

func (BuilderAgent) Sync added in v0.1.20

func (BuilderAgent) Update added in v0.1.20

type BuilderAgentGRPC added in v0.1.20

type BuilderAgentGRPC struct {
	// GRPCAgent must still implement the ServiceAgent interface
	plugin.Plugin
	Builder Builder
}

func (*BuilderAgentGRPC) GRPCClient added in v0.1.20

func (p *BuilderAgentGRPC) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*BuilderAgentGRPC) GRPCServer added in v0.1.20

func (p *BuilderAgentGRPC) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type BuilderServer added in v0.1.20

type BuilderServer struct {
	builderv0.UnimplementedBuilderServer
	Builder Builder
}

BuilderServer wraps the gRPC protocol Request/Response

func (*BuilderServer) Build added in v0.1.20

func (*BuilderServer) Communicate added in v0.1.20

func (*BuilderServer) Create added in v0.1.20

func (*BuilderServer) Deploy added in v0.1.20

func (*BuilderServer) Init added in v0.1.20

func (*BuilderServer) Load added in v0.1.20

func (*BuilderServer) Sync added in v0.1.20

func (*BuilderServer) Update added in v0.1.20

type BuilderWrapper added in v0.1.20

type BuilderWrapper struct {
	*Base
}

func (*BuilderWrapper) BuildError added in v0.1.20

func (s *BuilderWrapper) BuildError(err error) (*builderv0.BuildResponse, error)

func (*BuilderWrapper) BuildResponse added in v0.1.20

func (s *BuilderWrapper) BuildResponse() (*builderv0.BuildResponse, error)

func (*BuilderWrapper) CreateDeploymentBase added in v0.1.20

func (s *BuilderWrapper) CreateDeploymentBase(env *basev0.Environment, builderContext *builderv0.BuildContext) *DeploymentBase

func (*BuilderWrapper) CreateError added in v0.1.20

func (s *BuilderWrapper) CreateError(err error) (*builderv0.CreateResponse, error)

func (*BuilderWrapper) CreateResponse added in v0.1.20

func (s *BuilderWrapper) CreateResponse(ctx context.Context, settings any) (*builderv0.CreateResponse, error)

func (*BuilderWrapper) Deploy added in v0.1.20

func (s *BuilderWrapper) Deploy(ctx context.Context, req *builderv0.DeploymentRequest, fs embed.FS, params any) error

func (*BuilderWrapper) DeployError added in v0.1.20

func (s *BuilderWrapper) DeployError(err error) (*builderv0.DeploymentResponse, error)

func (*BuilderWrapper) DeployResponse added in v0.1.20

func (s *BuilderWrapper) DeployResponse() (*builderv0.DeploymentResponse, error)

func (*BuilderWrapper) GenerateKustomize added in v0.1.20

func (s *BuilderWrapper) GenerateKustomize(ctx context.Context, fs embed.FS, destination string, base *DeploymentBase, params any) error

func (*BuilderWrapper) InitError added in v0.1.20

func (s *BuilderWrapper) InitError(err error) (*builderv0.InitResponse, error)

func (*BuilderWrapper) InitResponse added in v0.1.20

func (s *BuilderWrapper) InitResponse() (*builderv0.InitResponse, error)

func (*BuilderWrapper) LoadError added in v0.1.20

func (s *BuilderWrapper) LoadError(err error) (*builderv0.LoadResponse, error)

func (*BuilderWrapper) LoadResponse added in v0.1.20

func (s *BuilderWrapper) LoadResponse(gettingStarted string) (*builderv0.LoadResponse, error)

func (*BuilderWrapper) SyncError added in v0.1.20

func (s *BuilderWrapper) SyncError(err error) (*builderv0.SyncResponse, error)

func (*BuilderWrapper) SyncResponse added in v0.1.20

func (s *BuilderWrapper) SyncResponse() (*builderv0.SyncResponse, error)

func (*BuilderWrapper) UpdateError added in v0.1.50

func (s *BuilderWrapper) UpdateError(err error) (*builderv0.UpdateResponse, error)

func (*BuilderWrapper) UpdateResponse added in v0.1.50

func (s *BuilderWrapper) UpdateResponse() (*builderv0.UpdateResponse, error)

type DeploymentBase added in v0.1.20

type DeploymentBase struct {
	*Information
	Environment *configurations.Environment
	Image       *configurations.DockerImage
	Replicas    int

	// Specialization
	Parameters any
}

type DeploymentParameter added in v0.1.33

type DeploymentParameter struct {
	ConfigMap EnvironmentMap
	SecretMap EnvironmentMap
}

type DeploymentWrapper added in v0.1.20

type DeploymentWrapper struct {
	*DeploymentBase
	Parameters any
}

type EnvironmentMap added in v0.1.33

type EnvironmentMap map[string]string

type Information added in v0.0.26

type Information struct {
	Service              *configurations.ServiceWithCase
	Agent                *configurations.Agent
	SourceVersionControl string
}

type InformationStatus added in v0.0.26

type InformationStatus struct {
	Load  *runtimev0.LoadStatus
	Init  *runtimev0.InitStatus
	Start *runtimev0.StartStatus

	DesiredState *runtimev0.DesiredState
}

type Runtime added in v0.0.51

type Runtime interface {
	// Load loads the service: it is a NoOp operation and can be called safely
	Load(ctx context.Context, req *runtimev0.LoadRequest) (*runtimev0.LoadResponse, error)

	// Init initializes the service: can include steps like compilation, etc...
	Init(ctx context.Context, req *runtimev0.InitRequest) (*runtimev0.InitResponse, error)

	// Start the underlying service
	Start(ctx context.Context, req *runtimev0.StartRequest) (*runtimev0.StartResponse, error)

	Stop(ctx context.Context, req *runtimev0.StopRequest) (*runtimev0.StopResponse, error)

	Information(ctx context.Context, req *runtimev0.InformationRequest) (*runtimev0.InformationResponse, error)

	// Communicate is a special method that is used to communicate with the Agent
	communicate.Communicate
}

type RuntimeAgent added in v0.0.51

type RuntimeAgent struct {
	Client      runtimev0.RuntimeClient
	Agent       *configurations.Agent
	ProcessInfo *manager.ProcessInfo

	// Some service can deal with re-init without restarting
	HotReload bool
}

func (*RuntimeAgent) Communicate added in v0.0.51

func (m *RuntimeAgent) Communicate(ctx context.Context, req *agentv0.Engage) (*agentv0.InformationRequest, error)

Communicate helper

func (*RuntimeAgent) Information added in v0.0.51

Information return some useful information about the service

func (*RuntimeAgent) Init added in v0.0.51

Init initializes the service

func (*RuntimeAgent) Load added in v0.0.72

Load loads the service: it is a NoOp operation and can be called safely

func (*RuntimeAgent) Start added in v0.0.51

Start starts the service

func (*RuntimeAgent) Stop added in v0.0.51

Stop stops the service

type RuntimeAgentGRPC added in v0.0.51

type RuntimeAgentGRPC struct {
	// GRPCAgent must still implement the ServiceAgent interface
	plugin.Plugin
	Runtime Runtime
}

func (*RuntimeAgentGRPC) GRPCClient added in v0.0.51

func (p *RuntimeAgentGRPC) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*RuntimeAgentGRPC) GRPCServer added in v0.0.51

func (p *RuntimeAgentGRPC) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type RuntimeServer added in v0.0.26

type RuntimeServer struct {
	runtimev0.UnimplementedRuntimeServer
	Runtime Runtime
}

RuntimeServer wraps the gRPC protocol Request/Response

func (*RuntimeServer) Communicate added in v0.0.26

func (*RuntimeServer) Information added in v0.0.26

func (*RuntimeServer) Init added in v0.0.26

func (*RuntimeServer) Load added in v0.0.72

func (*RuntimeServer) Start added in v0.0.26

func (*RuntimeServer) Stop added in v0.0.26

type RuntimeWrapper added in v0.0.72

type RuntimeWrapper struct {
	*Base

	LoadStatus  *runtimev0.LoadStatus
	InitStatus  *runtimev0.InitStatus
	StartStatus *runtimev0.StartStatus
	StopStatus  *runtimev0.StopStatus

	DesiredState *runtimev0.DesiredState

	sync.RWMutex
}

func (*RuntimeWrapper) DesiredInit added in v0.1.20

func (s *RuntimeWrapper) DesiredInit()

func (*RuntimeWrapper) DesiredLoad added in v0.1.20

func (s *RuntimeWrapper) DesiredLoad()

func (*RuntimeWrapper) DesiredStart added in v0.1.20

func (s *RuntimeWrapper) DesiredStart()

func (*RuntimeWrapper) InformationResponse added in v0.0.75

func (*RuntimeWrapper) InitError added in v0.0.72

func (s *RuntimeWrapper) InitError(err error, fields ...*wool.LogField) (*runtimev0.InitResponse, error)

func (*RuntimeWrapper) InitResponse added in v0.0.72

func (s *RuntimeWrapper) InitResponse() (*runtimev0.InitResponse, error)

func (*RuntimeWrapper) LoadError added in v0.0.72

func (s *RuntimeWrapper) LoadError(err error) (*runtimev0.LoadResponse, error)

func (*RuntimeWrapper) LoadErrorWithDetails added in v0.1.35

func (s *RuntimeWrapper) LoadErrorWithDetails(err error, details string) (*runtimev0.LoadResponse, error)

func (*RuntimeWrapper) LoadResponse added in v0.0.72

func (s *RuntimeWrapper) LoadResponse() (*runtimev0.LoadResponse, error)

func (*RuntimeWrapper) StartError added in v0.0.72

func (s *RuntimeWrapper) StartError(err error, fields ...*wool.LogField) (*runtimev0.StartResponse, error)

func (*RuntimeWrapper) StartResponse added in v0.0.72

func (s *RuntimeWrapper) StartResponse() (*runtimev0.StartResponse, error)

func (*RuntimeWrapper) StopError added in v0.1.24

func (s *RuntimeWrapper) StopError(err error, fields ...*wool.LogField) (*runtimev0.StopResponse, error)

func (*RuntimeWrapper) StopResponse added in v0.1.24

func (s *RuntimeWrapper) StopResponse() (*runtimev0.StopResponse, error)

type ServiceAgent added in v0.0.51

type ServiceAgent struct {
	Client      agentv0.AgentClient
	Agent       *configurations.Agent
	ProcessInfo *manager.ProcessInfo
}

func (*ServiceAgent) GetAgentInformation added in v0.0.51

GetAgentInformation provides - capabilities

type ServiceAgentContext added in v0.0.51

type ServiceAgentContext struct {
}

func (ServiceAgentContext) Default added in v0.0.51

func (m ServiceAgentContext) Default() plugin.Plugin

func (ServiceAgentContext) Key added in v0.0.51

type ServiceAgentGRPC added in v0.0.51

type ServiceAgentGRPC struct {
	// GRPCAgent must still implement the ServiceAgent interface
	plugin.Plugin
	Service Agent
}

func (*ServiceAgentGRPC) GRPCClient added in v0.0.51

func (p *ServiceAgentGRPC) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*ServiceAgentGRPC) GRPCServer added in v0.0.51

func (p *ServiceAgentGRPC) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type ServiceAgentServer added in v0.0.51

type ServiceAgentServer struct {
	agentv0.UnimplementedAgentServer
	Service Agent
}

ServiceAgentServer wraps the gRPC protocol Request/Response

func (*ServiceAgentServer) GetAgentInformation added in v0.0.51

type ServiceBuilderAgentContext added in v0.1.20

type ServiceBuilderAgentContext struct {
}

func (ServiceBuilderAgentContext) Default added in v0.1.20

func (m ServiceBuilderAgentContext) Default() plugin.Plugin

func (ServiceBuilderAgentContext) Key added in v0.1.20

type ServiceRuntimeAgentContext added in v0.0.26

type ServiceRuntimeAgentContext struct {
}

func (ServiceRuntimeAgentContext) Default added in v0.0.26

func (m ServiceRuntimeAgentContext) Default() plugin.Plugin

func (ServiceRuntimeAgentContext) Key added in v0.0.26

type TemplateWrapper added in v0.0.26

type TemplateWrapper struct {
	PathSelect shared.PathSelect
	Override   shared.Override
	// contains filtered or unexported fields
}

func WithBuilder added in v0.0.26

func WithBuilder(fs embed.FS) *TemplateWrapper

func WithDeployment added in v0.0.26

func WithDeployment(fs embed.FS, sub string) *TemplateWrapper

func WithFactory added in v0.0.26

func WithFactory(fs embed.FS) *TemplateWrapper

func WithTemplate added in v0.1.20

func WithTemplate(fs embed.FS, from string, to string) *TemplateWrapper

func (*TemplateWrapper) Destination added in v0.1.20

func (wrapper *TemplateWrapper) Destination(s *Base) string

func (*TemplateWrapper) WithDestination added in v0.1.20

func (wrapper *TemplateWrapper) WithDestination(destination string, args ...any) *TemplateWrapper

func (*TemplateWrapper) WithOverride added in v0.1.18

func (wrapper *TemplateWrapper) WithOverride(override shared.Override) *TemplateWrapper

func (*TemplateWrapper) WithPathSelect added in v0.1.20

func (wrapper *TemplateWrapper) WithPathSelect(pathSelect shared.PathSelect) *TemplateWrapper

type WatchConfiguration added in v0.0.26

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

func NewWatchConfiguration added in v0.0.26

func NewWatchConfiguration(dependencies *builders.Dependencies) *WatchConfiguration

Jump to

Keyboard shortcuts

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