Documentation
¶
Index ¶
- Constants
- Variables
- func AuthToString[T any](sa *T) string
- func ConfigFilePath(workDir string, profile string) string
- func ConvertAuth[T any](auth AuthConfig, creds *T) error
- func ConvertDescriptor[T any](from any, to *T) (*T, error)
- func MarshalDescriptor[T any](descriptor *T) ([]byte, error)
- func ReadDescriptor[T any](filePath string, descriptor *T) (*T, error)
- func RegisterCloudComposeConverter(mapping CloudComposeConfigRegister)
- func RegisterCloudHelper(mapping CloudHelpersRegisterMap)
- func RegisterCloudSingleImageConverter(mapping CloudSingleImageConfigRegister)
- func RegisterCloudStaticSiteConverter(mapping CloudStaticSiteConfigRegister)
- func RegisterProviderConfig(configMapping ConfigRegisterMap)
- func RegisterProvisioner(provisionerMapping ProvisionerRegisterMap)
- func RegisterProvisionerFieldConfig(mapping ProvisionerFieldConfigRegister)
- func UnmarshalDescriptor[T any](bytes []byte) (*T, error)
- type Alert
- type AlertSender
- type AlertType
- type AlertsConfig
- type AuthConfig
- type AuthDescriptor
- type CiCdDescriptor
- type ClientDescriptor
- func (s *ClientDescriptor) Copy() ClientDescriptor
- func (c *ClientDescriptor) GetDefaultValue(key string) (interface{}, bool)
- func (c *ClientDescriptor) GetDefaultsSection() map[string]interface{}
- func (c *ClientDescriptor) HasDefaults() bool
- func (c *ClientDescriptor) SetDefaultValue(key string, value interface{})
- func (c *ClientDescriptor) SetDefaultsSection(defaults map[string]interface{})
- type CloudComposeConfigRegister
- type CloudComposeDescriptor
- type CloudHelper
- type CloudHelperInitFunc
- type CloudHelperOption
- type CloudHelperType
- type CloudHelpersRegisterMap
- type CloudSingleImageConfigRegister
- type CloudStaticSiteConfigRegister
- type CommonAlertConfig
- type ComputeEnvVariables
- type Config
- type ConfigFile
- type ConfigReaderFunc
- type ConfigRegisterMap
- type Container
- type ContainerImage
- type ContainerImageBuild
- type CorsConfig
- type Credentials
- type DeployParams
- type DestroyParams
- type DestroyResult
- type DiscordCfg
- type DnsConfigAware
- type DnsRecord
- type Headers
- type ImagePlatform
- type Inherit
- type InitParams
- type MaxCPUConfig
- type MaxErrorConfig
- type MaxMemoryConfig
- type OutputsResult
- type ParentResourceDependency
- type PerEnvResourcesDescriptor
- type PerStackResourcesDescriptor
- type PreviewResult
- type ProvisionParams
- type Provisioner
- type ProvisionerDescriptor
- type ProvisionerFieldConfigReadFunc
- type ProvisionerFieldConfigReaderFunc
- type ProvisionerFieldConfigRegister
- type ProvisionerInitFunc
- type ProvisionerOption
- type ProvisionerRegisterMap
- type ReadOpts
- type RefreshResult
- type RegistrarConfig
- type RegistrarDescriptor
- type RemoteImage
- type ResourceAware
- type ResourceDescriptor
- type ResourceInput
- type ResourceOutput
- type SecretsConfigDescriptor
- type SecretsDescriptor
- type SecretsProviderConfig
- type ServerDescriptor
- func DetectCiCdType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
- func DetectProvisionerType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
- func DetectResourcesType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
- func DetectSecretsType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
- func DetectTemplatesType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
- func ReadServerConfigs(descriptor *ServerDescriptor) (*ServerDescriptor, error)
- func ReadServerDescriptor(path string) (*ServerDescriptor, error)
- type SimpleContainerLBConfig
- type SlackCfg
- type Stack
- type StackClientDescriptor
- type StackConfigCompose
- type StackConfigComposeScale
- type StackConfigComposeScaleCpu
- type StackConfigComposeScaleMemory
- type StackConfigComposeScalePolicy
- type StackConfigComposeSize
- type StackConfigDependencyResource
- type StackConfigSingleImage
- type StackConfigStatic
- type StackDescriptor
- func DetectTemplateType(tpl StackDescriptor) (*StackDescriptor, error)
- func PrepareClientConfigForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, ...) (*StackDescriptor, error)
- func PrepareCloudComposeForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, ...) (*StackDescriptor, error)
- func PrepareCloudSingleImageForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, ...) (*StackDescriptor, error)
- func PrepareStaticForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, ...) (*StackDescriptor, error)
- type StackParams
- type StacksMap
- type StateStorageConfig
- type StaticSiteConfig
- type TelegramCfg
- type TextVolume
- type Timeouts
- type ToCloudComposeConvertFunc
- type ToCloudSingleImageConvertFunc
- type ToCloudStaticSiteConvertFunc
- type UpdateResult
- type VariableDescriptor
- type VariableValues
- type WithCopy
- type WithDependencyProviders
- type WithDependsOnResources
- type WithParentDependencies
- type WithProviderType
Constants ¶
const ( ClientSchemaVersion = "1.0" ClientTypeCloudCompose = "cloud-compose" ClientTypeStatic = "static" ClientTypeSingleImage = "single-image" )
const ( ComposeLabelIngressContainer = "simple-container.com/ingress" ComposeLabelVolumeSize = "simple-container.com/volume-size" ComposeLabelVolumeAccessModes = "simple-container.com/volume-access-modes" ComposeLabelVolumeStorageClass = "simple-container.com/volume-storage-class" ComposeLabelIngressPort = "simple-container.com/ingress/port" ComposeLabelHealthcheckSuccessCodes = "simple-container.com/healthcheck/success-codes" ComposeLabelHealthcheckHealthyThreshold = "simple-container.com/healthcheck/healthy-threshold" ComposeLabelHealthcheckPath = "simple-container.com/healthcheck/path" ComposeLabelHealthcheckPort = "simple-container.com/healthcheck/port" )
const ( ScConfigDirectory = ".sc" EnvConfigFileTemplate = "cfg.%s.yaml" ScConfigEnvVariable = "SIMPLE_CONTAINER_CONFIG" ScContainerResourceTypeEnvVariable = "SIMPLE_CONTAINER_RESOURCE_TYPE" )
const ( ServerDescriptorFileName = "server.yaml" SecretsDescriptorFileName = "secrets.yaml" ClientDescriptorFileName = "client.yaml" )
const SecretsSchemaVersion = "1.0"
const ServerSchemaVersion = "1.0"
Variables ¶
var ( ReadIgnoreNoClientCfg = ReadOpts{IgnoreClientMissing: true} ReadIgnoreNoServerCfg = ReadOpts{IgnoreServerMissing: true, IgnoreSecretsMissing: true} ReadIgnoreNoSecretsAndClientCfg = ReadOpts{IgnoreSecretsMissing: true, IgnoreClientMissing: true} ReadIgnoreNoSecretsAndServerCfg = ReadOpts{IgnoreSecretsMissing: true, IgnoreServerMissing: true} ReadIgnoreNoAnyCfg = ReadOpts{IgnoreSecretsMissing: true, IgnoreServerMissing: true, IgnoreClientMissing: true} )
var ComputeEnv = ComputeEnvVariables{ CloudHelperType: "SIMPLE_CONTAINER_CLOUD_HELPER_TYPE", DiscordWebhookUrl: "SIMPLE_CONTAINER_DISCORD_WEBHOOK_URL", SlackWebhookUrl: "SIMPLE_CONTAINER_SLACK_WEBHOOK_URL", TelegramChatID: "SIMPLE_CONTAINER_TELEGRAM_CHAT_ID", TelegramToken: "SIMPLE_CONTAINER_TELEGRAM_TOKEN", AlertName: "SIMPLE_CONTAINER_ALERT_NAME", AlertDescription: "SIMPLE_CONTAINER_ALERT_DESCRIPTION", StackName: "SIMPLE_CONTAINER_STACK", StackEnv: "SIMPLE_CONTAINER_ENV", StackVersion: "SIMPLE_CONTAINER_VERSION", }
Functions ¶
func AuthToString ¶
func ConfigFilePath ¶
func ConvertAuth ¶
func ConvertAuth[T any](auth AuthConfig, creds *T) error
func ConvertDescriptor ¶
func MarshalDescriptor ¶
func ReadDescriptor ¶
func RegisterCloudComposeConverter ¶
func RegisterCloudComposeConverter(mapping CloudComposeConfigRegister)
func RegisterCloudHelper ¶
func RegisterCloudHelper(mapping CloudHelpersRegisterMap)
func RegisterCloudSingleImageConverter ¶
func RegisterCloudSingleImageConverter(mapping CloudSingleImageConfigRegister)
func RegisterCloudStaticSiteConverter ¶
func RegisterCloudStaticSiteConverter(mapping CloudStaticSiteConfigRegister)
func RegisterProviderConfig ¶
func RegisterProviderConfig(configMapping ConfigRegisterMap)
func RegisterProvisioner ¶
func RegisterProvisioner(provisionerMapping ProvisionerRegisterMap)
func RegisterProvisionerFieldConfig ¶
func RegisterProvisionerFieldConfig(mapping ProvisionerFieldConfigRegister)
func UnmarshalDescriptor ¶
Types ¶
type Alert ¶
type Alert struct {
Name string `json:"name" yaml:"name"`
Title string `json:"title" yaml:"title"`
Reason string `json:"reason" yaml:"reason"`
Description string `json:"description" yaml:"description"`
StackName string `json:"stackName" yaml:"stackName"`
StackEnv string `json:"stackEnv" yaml:"stackEnv"`
DetailsUrl string `json:"detailsUrl" yaml:"detailsUrl"`
AlertType AlertType `json:"alertType" yaml:"alertType"`
}
type AlertSender ¶
type AlertType ¶
type AlertType string
const ( // Monitoring Alert Types AlertTriggered AlertType = "TRIGGERED" AlertResolved AlertType = "RESOLVED" // Build/Deployment Notification Types BuildStarted AlertType = "BUILD_STARTED" BuildSucceeded AlertType = "BUILD_SUCCEEDED" BuildFailed AlertType = "BUILD_FAILED" BuildCancelled AlertType = "BUILD_CANCELLED" )
type AlertsConfig ¶
type AlertsConfig struct {
MaxCPU *MaxCPUConfig `json:"maxCPU,omitempty" yaml:"maxCPU,omitempty"`
MaxMemory *MaxMemoryConfig `json:"maxMemory,omitempty" yaml:"maxMemory,omitempty"`
MaxErrors *MaxErrorConfig `json:"maxErrors,omitempty" yaml:"maxErrors,omitempty"`
Discord *DiscordCfg `json:"discord,omitempty" yaml:"discord,omitempty"`
Slack *SlackCfg `json:"slack,omitempty" yaml:"slack,omitempty"`
Telegram *TelegramCfg `json:"telegram,omitempty" yaml:"telegram,omitempty"`
}
type AuthConfig ¶
type AuthConfig interface {
WithProviderType
CredentialsValue() string
ProjectIdValue() string
}
AuthConfig defines configuration for a single cloud provider
type AuthDescriptor ¶
type AuthDescriptor struct {
Type string `json:"type" yaml:"type"`
Config `json:",inline" yaml:",inline"`
Inherit `json:",inline" yaml:",inline"`
}
func DetectAuthProvider ¶
func DetectAuthProvider(auth *AuthDescriptor) (*AuthDescriptor, error)
func (*AuthDescriptor) AuthConfig ¶
func (a *AuthDescriptor) AuthConfig() (AuthConfig, error)
func (*AuthDescriptor) Copy ¶
func (s *AuthDescriptor) Copy() AuthDescriptor
type CiCdDescriptor ¶
type CiCdDescriptor struct {
Type string `json:"type" yaml:"type"`
Config `json:",inline" yaml:",inline"`
Inherit `json:",inline" yaml:",inline"`
}
func (*CiCdDescriptor) Copy ¶
func (s *CiCdDescriptor) Copy() CiCdDescriptor
type ClientDescriptor ¶
type ClientDescriptor struct {
SchemaVersion string `json:"schemaVersion" yaml:"schemaVersion"`
Defaults map[string]interface{} `json:"defaults,omitempty" yaml:"defaults,omitempty"` // Maximum flexibility - supports any user-defined YAML anchors, templates, and configuration
Stacks map[string]StackClientDescriptor `json:"stacks" yaml:"stacks"`
}
ClientDescriptor describes the client schema
func ReadClientDescriptor ¶
func ReadClientDescriptor(path string) (*ClientDescriptor, error)
func (*ClientDescriptor) Copy ¶
func (s *ClientDescriptor) Copy() ClientDescriptor
func (*ClientDescriptor) GetDefaultValue ¶
func (c *ClientDescriptor) GetDefaultValue(key string) (interface{}, bool)
GetDefaultValue retrieves a specific value from the defaults section Supports nested access using dot notation (e.g., "stack.type", "config.baseDnsZone")
func (*ClientDescriptor) GetDefaultsSection ¶
func (c *ClientDescriptor) GetDefaultsSection() map[string]interface{}
GetDefaultsSection returns the defaults section as a map for flexible access This allows users to define any YAML anchors and templates they need
func (*ClientDescriptor) HasDefaults ¶
func (c *ClientDescriptor) HasDefaults() bool
HasDefaults checks if the client configuration has a defaults section
func (*ClientDescriptor) SetDefaultValue ¶
func (c *ClientDescriptor) SetDefaultValue(key string, value interface{})
SetDefaultValue sets a specific value in the defaults section
func (*ClientDescriptor) SetDefaultsSection ¶
func (c *ClientDescriptor) SetDefaultsSection(defaults map[string]interface{})
SetDefaultsSection sets the entire defaults section (used for programmatic configuration)
type CloudComposeConfigRegister ¶
type CloudComposeConfigRegister map[string]ToCloudComposeConvertFunc
type CloudComposeDescriptor ¶
type CloudComposeDescriptor struct {
StackName string `json:"stackName" yaml:"stackName"`
StackDescriptor `json:",inline" yaml:",inline"`
}
type CloudHelper ¶
func NewCloudHelper ¶
func NewCloudHelper(chType string, opts ...CloudHelperOption) (CloudHelper, error)
type CloudHelperInitFunc ¶
type CloudHelperInitFunc func(opts ...CloudHelperOption) (CloudHelper, error)
type CloudHelperOption ¶
type CloudHelperOption func(c CloudHelper) error
func WithLogger ¶
func WithLogger(l logger.Logger) CloudHelperOption
type CloudHelperType ¶
type CloudHelperType string
type CloudHelpersRegisterMap ¶
type CloudHelpersRegisterMap map[CloudHelperType]CloudHelperInitFunc
func GetRegisteredCloudHelpers ¶
func GetRegisteredCloudHelpers() CloudHelpersRegisterMap
GetRegisteredCloudHelpers returns all registered cloud helper configurations Used by schema generator to automatically discover cloud helper types
type CloudSingleImageConfigRegister ¶
type CloudSingleImageConfigRegister map[string]ToCloudSingleImageConvertFunc
type CloudStaticSiteConfigRegister ¶
type CloudStaticSiteConfigRegister map[string]ToCloudStaticSiteConvertFunc
type CommonAlertConfig ¶
type ComputeEnvVariables ¶
type Config ¶
type Config struct {
Config any `json:"config" yaml:"config"`
}
type ConfigFile ¶
type ConfigFile struct {
ProjectName string `json:"projectName" yaml:"projectName"`
PrivateKeyPath string `yaml:"privateKeyPath,omitempty" json:"privateKeyPath,omitempty"`
PublicKeyPath string `yaml:"publicKeyPath,omitempty" json:"publicKeyPath,omitempty"`
PrivateKey string `yaml:"privateKey,omitempty" json:"privateKey,omitempty"`
PrivateKeyPassword string `yaml:"privateKeyPassword,omitempty" json:"privateKeyPassword,omitempty"`
PublicKey string `yaml:"publicKey,omitempty" json:"publicKey,omitempty"`
StacksDir string `yaml:"stacksDir,omitempty" json:"stacksDir,omitempty"`
ParentRepository string `yaml:"parentRepository,omitempty" json:"parentRepository,omitempty"`
}
func ReadConfigFile ¶
func ReadConfigFile(workDir, profile string) (*ConfigFile, error)
func (*ConfigFile) ToYaml ¶
func (f *ConfigFile) ToYaml() ([]byte, error)
func (*ConfigFile) WriteConfigFile ¶
func (f *ConfigFile) WriteConfigFile(workDir, profile string) error
type ConfigReaderFunc ¶
type ConfigRegisterMap ¶
type ConfigRegisterMap map[string]ConfigReaderFunc
func GetRegisteredProviderConfigs ¶
func GetRegisteredProviderConfigs() ConfigRegisterMap
GetRegisteredProviderConfigs returns all registered provider configurations Used by schema generator to automatically discover all resource types
type Container ¶
type Container struct {
ContainerImage `json:",inline" yaml:",inline"`
Name string `json:"name" yaml:"name"`
}
type ContainerImage ¶
type ContainerImage struct {
Name string `json:"name" yaml:"name"`
Dockerfile string `json:"dockerfile" yaml:"dockerfile"`
Context string `json:"context" yaml:"context"`
Build *ContainerImageBuild `json:"build" yaml:"build"`
Platform ImagePlatform `json:"platform" yaml:"platform"`
}
type ContainerImageBuild ¶
type CorsConfig ¶
type Credentials ¶
type Credentials struct {
Credentials string `json:"credentials" yaml:"credentials"` // required for proper deserialization
}
type DeployParams ¶
type DeployParams struct {
StackParams `json:",inline" yaml:",inline"`
Vars VariableValues `json:"vars" yaml:"vars"`
}
type DestroyParams ¶
type DestroyParams struct {
StackParams `json:",inline" yaml:",inline"`
DestroySecretsStack bool `json:"destroySecretsStack" yaml:"destroySecretsStack"`
}
type DestroyResult ¶
func (*DestroyResult) String ¶
func (r *DestroyResult) String() string
type DiscordCfg ¶
type DiscordCfg struct {
WebhookUrl string `json:"webhookUrl" yaml:"webhookUrl"`
}
type DnsConfigAware ¶
type DnsConfigAware interface {
OverriddenBaseZone() string
}
type ImagePlatform ¶
type ImagePlatform string
const (
ImagePlatformLinuxAmd64 ImagePlatform = "linux/amd64"
)
type Inherit ¶
type Inherit struct {
Inherit string `json:"inherit" yaml:"inherit"`
}
func (Inherit) IsInherited ¶
type InitParams ¶
type InitParams struct {
ProjectName string `json:"projectName" yaml:"projectName"`
RootDir string `json:"rootDir,omitempty" yaml:"rootDir"`
Profile string `json:"profile,omitempty" yaml:"profile"`
SkipInitialCommit bool `json:"skipInitialCommit" yaml:"skipInitialCommit"`
SkipProfileCreation bool `json:"skipProfileCreation" yaml:"skipProfileCreation"`
SkipScDirCreation bool `json:"skipScDirCreation" yaml:"skipScDirCreation"`
IgnoreWorkdirErrors bool `json:"skipCreateConfigDir" yaml:"skipCreateConfigDir"`
GenerateKeyPair bool `json:"generateKeyPair" yaml:"generateKeyPair"`
}
type MaxCPUConfig ¶
type MaxCPUConfig struct {
CommonAlertConfig `json:",inline" yaml:",inline"`
}
type MaxErrorConfig ¶
type MaxErrorConfig struct {
CommonAlertConfig `json:",inline" yaml:",inline"`
ErrorLogMessageRegexp string `json:"errorLogMessageRegexp" yaml:"errorLogMessageRegexp"`
}
type MaxMemoryConfig ¶
type MaxMemoryConfig struct {
CommonAlertConfig `json:",inline" yaml:",inline"`
}
type OutputsResult ¶
type ParentResourceDependency ¶
type ParentResourceDependency struct {
Name string `json:"name" yaml:"name"`
}
ParentResourceDependency when a resource depends on resource within the same stack
type PerEnvResourcesDescriptor ¶
type PerEnvResourcesDescriptor struct {
Template string `json:"template" yaml:"template"`
Resources map[string]ResourceDescriptor `json:"resources" yaml:"resources"`
Inherit `json:",inline" yaml:",inline"`
}
func (*PerEnvResourcesDescriptor) Copy ¶
func (s *PerEnvResourcesDescriptor) Copy() PerEnvResourcesDescriptor
type PerStackResourcesDescriptor ¶
type PerStackResourcesDescriptor struct {
Registrar RegistrarDescriptor `json:"registrar" yaml:"registrar"`
Resources map[string]PerEnvResourcesDescriptor `json:"resources" yaml:"resources"`
}
func DetectPerStackResourcesType ¶
func DetectPerStackResourcesType(p *PerStackResourcesDescriptor) (*PerStackResourcesDescriptor, error)
func DetectRegistrarType ¶
func DetectRegistrarType(p *PerStackResourcesDescriptor) (*PerStackResourcesDescriptor, error)
func (*PerStackResourcesDescriptor) Copy ¶
func (s *PerStackResourcesDescriptor) Copy() PerStackResourcesDescriptor
type PreviewResult ¶
type PreviewResult struct {
StackName string `json:"stackName" yaml:"stackName"`
Summary string `json:"summary" yaml:"summary"`
Operations map[string]int `json:"operations" yaml:"operations"`
}
func (*PreviewResult) String ¶
func (r *PreviewResult) String() string
type ProvisionParams ¶
type ProvisionParams struct {
StacksDir string `json:"rootDir" yaml:"rootDir"`
Profile string `json:"profile" yaml:"profile"`
Stacks []string `json:"stacks" yaml:"stacks"`
SkipRefresh bool `json:"skipRefresh" yaml:"skipRefresh"`
SkipPreview bool `json:"skipPreview" yaml:"skipPreview"`
Timeouts Timeouts `json:",inline" yaml:",inline"`
}
type Provisioner ¶
type Provisioner interface {
ProvisionStack(ctx context.Context, cfg *ConfigFile, stack Stack, params ProvisionParams) error
SetPublicKey(pubKey string)
DeployStack(ctx context.Context, cfg *ConfigFile, stack Stack, params DeployParams) error
DestroyChildStack(ctx context.Context, cfg *ConfigFile, stack Stack, params DestroyParams, preview bool) error
PreviewStack(ctx context.Context, cfg *ConfigFile, parentStack Stack, params ProvisionParams) (*PreviewResult, error)
PreviewChildStack(ctx context.Context, cfg *ConfigFile, parentStack Stack, params DeployParams) (*PreviewResult, error)
OutputsStack(ctx context.Context, cfg *ConfigFile, stack Stack, params StackParams) (*OutputsResult, error)
CancelStack(ctx context.Context, cfg *ConfigFile, stack Stack, params StackParams) error
DestroyParentStack(ctx context.Context, cfg *ConfigFile, parentStack Stack, params DestroyParams, preview bool) error
SetConfigReader(ProvisionerFieldConfigReaderFunc)
}
type ProvisionerDescriptor ¶
type ProvisionerDescriptor struct {
Type string `json:"type" yaml:"type"`
Config `json:",inline" yaml:",inline"`
Inherit `json:",inline" yaml:",inline"`
// contains filtered or unexported fields
}
ProvisionerDescriptor describes the provisioner schema
func (*ProvisionerDescriptor) Copy ¶
func (s *ProvisionerDescriptor) Copy() ProvisionerDescriptor
func (*ProvisionerDescriptor) GetProvisioner ¶
func (s *ProvisionerDescriptor) GetProvisioner() Provisioner
func (*ProvisionerDescriptor) SetProvisioner ¶
func (s *ProvisionerDescriptor) SetProvisioner(p Provisioner)
func (*ProvisionerDescriptor) ValuesOnly ¶
func (s *ProvisionerDescriptor) ValuesOnly() ProvisionerDescriptor
ValuesOnly returns copy of descriptor without provisioner reference
type ProvisionerFieldConfigRegister ¶
type ProvisionerFieldConfigRegister map[string]ProvisionerFieldConfigReadFunc
func GetRegisteredProvisionerFieldConfigs ¶
func GetRegisteredProvisionerFieldConfigs() ProvisionerFieldConfigRegister
GetRegisteredProvisionerFieldConfigs returns all registered provisioner field configurations Used by schema generator to automatically discover provisioner resource types
type ProvisionerInitFunc ¶
type ProvisionerInitFunc func(config Config, opts ...ProvisionerOption) (Provisioner, error)
type ProvisionerOption ¶
type ProvisionerOption func(p Provisioner) error
func WithFieldConfigReader ¶
func WithFieldConfigReader(f ProvisionerFieldConfigReaderFunc) ProvisionerOption
type ProvisionerRegisterMap ¶
type ProvisionerRegisterMap map[string]ProvisionerInitFunc
type RefreshResult ¶
func (*RefreshResult) String ¶
func (r *RefreshResult) String() string
type RegistrarConfig ¶
type RegistrarDescriptor ¶
type RegistrarDescriptor struct {
Type string `json:"type" yaml:"type"`
Config `json:",inline" yaml:",inline"`
Inherit `json:",inline" yaml:",inline"`
}
func (*RegistrarDescriptor) Copy ¶
func (s *RegistrarDescriptor) Copy() RegistrarDescriptor
type RemoteImage ¶
type ResourceAware ¶
type ResourceAware interface {
Uses() []string
}
type ResourceDescriptor ¶
type ResourceDescriptor struct {
Type string `json:"type" yaml:"type"`
Name string `json:"name" yaml:"name"`
Config `json:",inline" yaml:",inline"`
Inherit `json:",inline" yaml:",inline"`
}
func (*ResourceDescriptor) Copy ¶
func (s *ResourceDescriptor) Copy() ResourceDescriptor
type ResourceInput ¶
type ResourceInput struct {
Descriptor *ResourceDescriptor `json:"descriptor" yaml:"descriptor"`
StackParams *StackParams `json:"deployParams" yaml:"deployParams"`
}
func (*ResourceInput) ToResName ¶
func (r *ResourceInput) ToResName(resName string) string
ToResName adds environment suffix if environment is specified in the resource input
type ResourceOutput ¶
type ResourceOutput struct {
Ref any `json:"ref" yaml:"ref"`
}
type SecretsConfigDescriptor ¶
type SecretsConfigDescriptor struct {
Type string `json:"type" yaml:"type"`
Config `json:",inline" yaml:",inline"`
Inherit `json:",inline" yaml:",inline"`
}
func (*SecretsConfigDescriptor) Copy ¶
func (s *SecretsConfigDescriptor) Copy() SecretsConfigDescriptor
type SecretsDescriptor ¶
type SecretsDescriptor struct {
SchemaVersion string `json:"schemaVersion" yaml:"schemaVersion"`
Auth map[string]AuthDescriptor `json:"auth" yaml:"auth"`
Values map[string]string `json:"values" yaml:"values"`
}
SecretsDescriptor describes the secrets schema
func DetectAuthType ¶
func DetectAuthType(descriptor *SecretsDescriptor) (*SecretsDescriptor, error)
func ReadSecretsConfigs ¶
func ReadSecretsConfigs(descriptor *SecretsDescriptor) (*SecretsDescriptor, error)
func ReadSecretsDescriptor ¶
func ReadSecretsDescriptor(path string) (*SecretsDescriptor, error)
func (*SecretsDescriptor) Copy ¶
func (s *SecretsDescriptor) Copy() SecretsDescriptor
type SecretsProviderConfig ¶
type SecretsProviderConfig interface {
AuthConfig
IsProvisionEnabled() bool
KeyUrl() string
}
type ServerDescriptor ¶
type ServerDescriptor struct {
SchemaVersion string `json:"schemaVersion" yaml:"schemaVersion"`
Provisioner ProvisionerDescriptor `json:"provisioner" yaml:"provisioner"`
Secrets SecretsConfigDescriptor `json:"secrets" yaml:"secrets"`
CiCd CiCdDescriptor `json:"cicd" yaml:"cicd"`
Templates map[string]StackDescriptor `json:"templates" yaml:"templates"`
Resources PerStackResourcesDescriptor `json:"resources" yaml:"resources"`
Variables map[string]VariableDescriptor `json:"variables" yaml:"variables"`
}
ServerDescriptor describes the server schema
func DetectCiCdType ¶
func DetectCiCdType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
func DetectProvisionerType ¶
func DetectProvisionerType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
func DetectResourcesType ¶
func DetectResourcesType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
func DetectSecretsType ¶
func DetectSecretsType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
func DetectTemplatesType ¶
func DetectTemplatesType(descriptor *ServerDescriptor) (*ServerDescriptor, error)
func ReadServerConfigs ¶
func ReadServerConfigs(descriptor *ServerDescriptor) (*ServerDescriptor, error)
func ReadServerDescriptor ¶
func ReadServerDescriptor(path string) (*ServerDescriptor, error)
func (*ServerDescriptor) Copy ¶
func (sd *ServerDescriptor) Copy() ServerDescriptor
func (*ServerDescriptor) ValuesOnly ¶
func (sd *ServerDescriptor) ValuesOnly() *ServerDescriptor
ValuesOnly returns copy of descriptor without additional state (e.g. provisioner reference etc.)
type SimpleContainerLBConfig ¶
type Stack ¶
type Stack struct {
Name string `json:"name" yaml:"name"`
Secrets SecretsDescriptor `json:"secrets" yaml:"secrets"`
Server ServerDescriptor `json:"server" yaml:"server"`
Client ClientDescriptor `json:"client" yaml:"client"`
}
func (*Stack) ChildStack ¶
func (*Stack) ValuesOnly ¶
type StackClientDescriptor ¶
type StackClientDescriptor struct {
Type string `json:"type" yaml:"type"`
ParentStack string `json:"parent" yaml:"parent"`
ParentEnv string `json:"parentEnv" yaml:"parentEnv"`
Template string `json:"template" yaml:"template"`
Config Config `json:",inline" yaml:",inline"`
}
func ConvertClientConfig ¶
func ConvertClientConfig(clientDesc StackClientDescriptor) (*StackClientDescriptor, error)
func (*StackClientDescriptor) Copy ¶
func (s *StackClientDescriptor) Copy() StackClientDescriptor
type StackConfigCompose ¶
type StackConfigCompose struct {
DockerComposeFile string `json:"dockerComposeFile" yaml:"dockerComposeFile"`
Domain string `json:"domain" yaml:"domain"`
Prefix string `json:"prefix" yaml:"prefix"` // prefix for service under LB (e.g. /<service>) default: empty
ProxyKeepPrefix bool `json:"proxyKeepPrefix" yaml:"proxyKeepPrefix"` // if prefix is specified, whether we need to keep it when proxying to service
DomainProxied *bool `json:"domainProxied" yaml:"domainProxied"`
BaseDnsZone string `json:"baseDnsZone" yaml:"baseDnsZone"` // only necessary if differs from parent stack
Uses []string `json:"uses" yaml:"uses"`
Runs []string `json:"runs" yaml:"runs"`
Env map[string]string `json:"env" yaml:"env"`
Secrets map[string]string `json:"secrets" yaml:"secrets"`
Version string `json:"version" yaml:"version"` // only when need to forcefully redeploy (e.g. aws secrets)
Size *StackConfigComposeSize `json:"size,omitempty" yaml:"size,omitempty"`
Scale *StackConfigComposeScale `json:"scale,omitempty" yaml:"scale,omitempty"`
Dependencies []StackConfigDependencyResource `json:"dependencies,omitempty" yaml:"dependencies,omitempty"` // when service wants to use resources from another service
Alerts *AlertsConfig `json:"alerts,omitempty" yaml:"alerts,omitempty"`
TextVolumes *[]TextVolume `json:"textVolumes" yaml:"textVolumes"` // extra text volumes to mount to containers (e.g. for k8s deployments)
Headers *Headers `json:"headers" yaml:"headers"` // extra headers to add when serving requests
LBConfig *SimpleContainerLBConfig `json:"lbConfig" yaml:"lbConfig"` // load balancer configuration (so far only applicable for k8s deployments)
CloudExtras *any `json:"cloudExtras" yaml:"cloudExtras"` // when need to specify additional extra config for the specific cloud (e.g. AWS extra roles)
StaticEgressIP *bool `json:"staticEgressIP" yaml:"staticEgressIP"` // when need to provision NAT with fixed egress IP address (e.g. AWS Lambda with static IP)
ImagePullPolicy *string `json:"imagePullPolicy" yaml:"imagePullPolicy"` // applicable only for certain compute types, e.g. Kubernetes
ClusterIPAddress *string `json:"clusterIPAddress" yaml:"clusterIPAddress"` // applicable only for certain compute types, e.g. Kubernetes
}
func (*StackConfigCompose) Copy ¶
func (s *StackConfigCompose) Copy() any
type StackConfigComposeScale ¶
type StackConfigComposeScale struct {
Min int `yaml:"min" json:"min"`
Max int `yaml:"max" json:"max"`
Policy *StackConfigComposeScalePolicy `json:"policy" yaml:"policy"`
}
type StackConfigComposeScaleCpu ¶
type StackConfigComposeScaleCpu struct {
Max int `yaml:"max" json:"max"`
}
type StackConfigComposeScaleMemory ¶
type StackConfigComposeScaleMemory struct {
Max int `yaml:"max" json:"max"`
}
type StackConfigComposeScalePolicy ¶
type StackConfigComposeScalePolicy struct {
Cpu *StackConfigComposeScaleCpu `yaml:"cpu" json:"cpu"`
Memory *StackConfigComposeScaleMemory `yaml:"memory" json:"memory"`
}
type StackConfigComposeSize ¶
type StackConfigDependencyResource ¶
type StackConfigDependencyResource struct {
Name string `json:"name" yaml:"name"`
Owner string `json:"owner" yaml:"owner"`
Resource string `json:"resource" yaml:"resource"`
Env *string `json:"env" yaml:"env"`
}
StackConfigDependencyResource when stack depends on resource context of another stack (client configuration)
type StackConfigSingleImage ¶
type StackConfigSingleImage struct {
Image *ContainerImage `json:"image" yaml:"image"`
Domain string `json:"domain" yaml:"domain"`
BaseDnsZone string `json:"baseDnsZone" yaml:"baseDnsZone"` // only necessary if differs from parent stack
Env map[string]string `json:"env" yaml:"env"`
Secrets map[string]string `json:"secrets" yaml:"secrets"`
Min int `yaml:"min" json:"min"`
Max int `yaml:"max" json:"max"`
Version string `json:"version" yaml:"version"` // only when need to forcefully redeploy (e.g. aws secrets)
Timeout *int `json:"timeout" yaml:"timeout"`
BasePath string `json:"basePath" yaml:"basePath"` // base path where API will listen on (e.g. for aws apigateway -> lambda integration)
MaxMemory *int `json:"maxMemory" yaml:"maxMemory"` // max memory to use for container
MaxEphemeralStorage *int `json:"maxEphemeralStorage" yaml:"maxEphemeralStorage"` // max ephemeral storage in MB
Uses []string `json:"uses" yaml:"uses"`
StaticEgressIP *bool `json:"staticEgressIP" yaml:"staticEgressIP"` // when need to provision NAT with fixed egress IP address (e.g. AWS Lambda with static IP)
CloudExtras *any `json:"cloudExtras" yaml:"cloudExtras"` // when need to specify additional extra config for the specific cloud (e.g. AWS extra roles)
}
type StackConfigStatic ¶
type StackConfigStatic struct {
BundleDir string `json:"bundleDir" yaml:"bundleDir"`
Site StaticSiteConfig `json:",inline" yaml:",inline"`
BucketName string `json:"bucketName" yaml:"bucketName"` // if necessary to override bucket name, only applicable in some clouds (e.g. gcp)
Location string `json:"location" yaml:"location"`
}
type StackDescriptor ¶
type StackDescriptor struct {
Type string `json:"type" yaml:"type"`
ParentStack string `json:"parentStack" yaml:"parentStack"`
Config `json:",inline" yaml:",inline"`
Inherit `json:",inline" yaml:",inline"`
}
func DetectTemplateType ¶
func DetectTemplateType(tpl StackDescriptor) (*StackDescriptor, error)
func PrepareClientConfigForDeploy ¶
func PrepareClientConfigForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientDesc StackClientDescriptor) (*StackDescriptor, error)
func PrepareCloudComposeForDeploy ¶
func PrepareCloudComposeForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientConfig *StackConfigCompose, parentStack string) (*StackDescriptor, error)
func PrepareCloudSingleImageForDeploy ¶
func PrepareCloudSingleImageForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientConfig *StackConfigSingleImage, parentStack string) (*StackDescriptor, error)
func PrepareStaticForDeploy ¶
func PrepareStaticForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientConfig *StackConfigStatic, parentStack string) (*StackDescriptor, error)
func (*StackDescriptor) Copy ¶
func (s *StackDescriptor) Copy() StackDescriptor
type StackParams ¶
type StackParams struct {
StacksDir string `json:"stacksDir" yaml:"stacksDir"`
StackDir string `json:"stackDir" yaml:"stackDir"`
Profile string `json:"profile" yaml:"profile"`
StackName string `json:"stack" yaml:"stack"`
Environment string `json:"environment" yaml:"environment"`
ParentEnv string `json:"parentEnv" yaml:"parentEnv"`
SkipRefresh bool `json:"skipRefresh" yaml:"skipRefresh"`
SkipPreview bool `json:"skipPreview" yaml:"skipPreview"`
Version string `json:"version" yaml:"version"`
Timeouts Timeouts `json:",inline" yaml:",inline"`
Parent bool `json:"parent" yaml:"parent"`
}
func (*StackParams) CopyForParentEnv ¶
func (p *StackParams) CopyForParentEnv(env string) *StackParams
func (*StackParams) ToProvisionParams ¶
func (p *StackParams) ToProvisionParams() ProvisionParams
type StacksMap ¶
func (*StacksMap) ReconcileForDeploy ¶
func (m *StacksMap) ReconcileForDeploy(params StackParams) (*StacksMap, error)
func (*StacksMap) ResolveInheritance ¶
type StateStorageConfig ¶
type StateStorageConfig interface {
AuthConfig
StorageUrl() string
IsProvisionEnabled() bool
}
type StaticSiteConfig ¶
type StaticSiteConfig struct {
Domain string `json:"domain" yaml:"domain"`
BaseDnsZone string `json:"baseDnsZone" yaml:"baseDnsZone"` // only necessary if differs from parent stack
IndexDocument string `json:"indexDocument" yaml:"indexDocument"`
ErrorDocument string `json:"errorDocument" yaml:"errorDocument"`
ProvisionWwwDomain bool `json:"provisionWwwDomain" yaml:"provisionWwwDomain"`
CorsConfig *CorsConfig `json:"corsConfig,omitempty" yaml:"corsConfig,omitempty"`
}
type TelegramCfg ¶
type TextVolume ¶
type ToCloudSingleImageConvertFunc ¶
type ToCloudSingleImageConvertFunc func(tpl any, stackCfg *StackConfigSingleImage) (any, error)
type ToCloudStaticSiteConvertFunc ¶
type ToCloudStaticSiteConvertFunc func(tpl any, rootDir, stackName string, stackCfg *StackConfigStatic) (any, error)
type UpdateResult ¶
type UpdateResult struct {
StackName string `json:"stackName" yaml:"stackName"`
Summary string `json:"summary" yaml:"summary"`
Operations map[string]int `json:"operations" yaml:"operations"`
}
func (*UpdateResult) String ¶
func (r *UpdateResult) String() string
type VariableDescriptor ¶
type VariableDescriptor struct {
Type string `json:"type" yaml:"type"`
Value string `json:"value" yaml:"value"`
}
func (*VariableDescriptor) Copy ¶
func (s *VariableDescriptor) Copy() VariableDescriptor
type VariableValues ¶
type WithDependencyProviders ¶
type WithDependencyProviders interface {
DependencyProviders() map[string]AuthDescriptor
}
WithDependencyProviders defines configurations where extra cloud providers are required
type WithDependsOnResources ¶
type WithDependsOnResources interface {
DependsOnResources() []StackConfigDependencyResource
}
type WithParentDependencies ¶
type WithParentDependencies interface {
DependsOnResources() []ParentResourceDependency
}
type WithProviderType ¶
type WithProviderType interface {
ProviderType() string
}
WithProviderType defines configuration with specific cloud provider type