stack_parser

package
v0.0.0-...-e4664ba Latest Latest
Warning

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

Go to latest
Published: May 3, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command []string

Command Command definition

func (*Command) String

func (c *Command) String() string

func (*Command) UnmarshalYAML

func (c *Command) UnmarshalYAML(unmarshal func(interface{}) error) error

type Config

type Config struct {
	Content      string `yaml:"content"`
	Uid          uint   `yaml:"uid"`
	Gid          uint   `yaml:"gid"`
	MountingPath string `yaml:"mounting_path"`
}

Config for the service

type CustomHealthCheck

type CustomHealthCheck struct {
	Enabled              bool   `yaml:"enabled"`
	TestCommand          string `yaml:"test_command"`
	IntervalSeconds      uint64 `yaml:"interval_seconds"`       // Time between running the check in seconds
	TimeoutSeconds       uint64 `yaml:"timeout_seconds"`        // Maximum time to allow one check to run in seconds
	StartPeriodSeconds   uint64 `yaml:"start_period_seconds"`   // Start period for the container to initialize before counting retries towards unstable
	StartIntervalSeconds uint64 `yaml:"start_interval_seconds"` // Time between running the check during the start period
	Retries              uint64 `yaml:"retries"`                // Consecutive failures needed to report unhealthy
}

type Deploy

type Deploy struct {
	Mode      DeploymentMode `yaml:"mode"`
	Replicas  uint           `yaml:"replicas"`
	Resources Resources      `yaml:"resources"`
}

type DeploymentMode

type DeploymentMode string

DeploymentMode mode of deployment of application (replicated or global)

const (
	DeploymentModeReplicated DeploymentMode = "replicated"
	DeploymentModeGlobal     DeploymentMode = "global"
	DeploymentModeNone       DeploymentMode = ""
)

type DockerProxyConfig

type DockerProxyConfig struct {
	Enabled    bool                  `yaml:"enabled"`
	Permission DockerProxyPermission `yaml:"permissions"`
}

DockerProxyConfig is the configuration for the docker proxy

type DockerProxyPermission

type DockerProxyPermission struct {
	Ping         DockerProxyPermissionType `yaml:"ping"`
	Version      DockerProxyPermissionType `yaml:"version"`
	Info         DockerProxyPermissionType `yaml:"info"`
	Events       DockerProxyPermissionType `yaml:"events"`
	Auth         DockerProxyPermissionType `yaml:"auth"`
	Secrets      DockerProxyPermissionType `yaml:"secrets"`
	Build        DockerProxyPermissionType `yaml:"build"`
	Commit       DockerProxyPermissionType `yaml:"commit"`
	Configs      DockerProxyPermissionType `yaml:"configs"`
	Containers   DockerProxyPermissionType `yaml:"containers"`
	Distribution DockerProxyPermissionType `yaml:"distribution"`
	Exec         DockerProxyPermissionType `yaml:"exec"`
	Grpc         DockerProxyPermissionType `yaml:"grpc"`
	Images       DockerProxyPermissionType `yaml:"images"`
	Networks     DockerProxyPermissionType `yaml:"networks"`
	Nodes        DockerProxyPermissionType `yaml:"nodes"`
	Plugins      DockerProxyPermissionType `yaml:"plugins"`
	Services     DockerProxyPermissionType `yaml:"services"`
	Session      DockerProxyPermissionType `yaml:"session"`
	Swarm        DockerProxyPermissionType `yaml:"swarm"`
	System       DockerProxyPermissionType `yaml:"system"`
	Tasks        DockerProxyPermissionType `yaml:"tasks"`
	Volumes      DockerProxyPermissionType `yaml:"volumes"`
}

type DockerProxyPermissionType

type DockerProxyPermissionType string

DockerProxyPermissionType is the type of permission to be granted to the proxy

const (
	// DockerProxyNoPermission no request will be allowed
	DockerProxyNoPermission DockerProxyPermissionType = "none"
	// DockerProxyReadPermission only [GET, HEAD] requests will be allowed
	DockerProxyReadPermission DockerProxyPermissionType = "read"
	// DockerProxyReadWritePermission all requests will be allowed [GET, HEAD, POST, PUT, DELETE, OPTIONS]
	DockerProxyReadWritePermission DockerProxyPermissionType = "read_write"
)

type Docs

type Docs struct {
	LogoURL           string                  `yaml:"logo_url"`
	Name              string                  `yaml:"name"`
	Description       string                  `yaml:"description"`
	ReadmeDescription string                  `yaml:"readme_description"`
	IframeVideoEmbed  string                  `yaml:"iframe_video_embed"`
	Variables         map[string]DocsVariable `yaml:"variables"`
}

Docs for the stack

type DocsVariable

type DocsVariable struct {
	Title       string                   `yaml:"title"`
	Description string                   `yaml:"description"`
	Default     string                   `yaml:"default"`
	Type        DocsVariableType         `yaml:"type"`
	Options     []DocsVariableOptionType `yaml:"options"`
}

type DocsVariableOptionType

type DocsVariableOptionType struct {
	Title string `yaml:"title"`
	Value string `yaml:"value"`
}

type DocsVariableType

type DocsVariableType string
const (
	DocsVariableTypeText        DocsVariableType = "text"
	DocsVariableTypeInteger     DocsVariableType = "integer"
	DocsVariableTypeFloat       DocsVariableType = "float"
	DocsVariableTypeOptions     DocsVariableType = "options"
	DocsVariableTypeVolume      DocsVariableType = "volume"
	DocsVariableTypeApplication DocsVariableType = "application"
	DocsVariableTypeServer      DocsVariableType = "server"
	DocsVariableTypeMarkdown    DocsVariableType = "markdown"
)

type KeyValuePair

type KeyValuePair map[string]string

KeyValuePair Generic key-value pair Support both map and slice of strings (key=value) formats

func (*KeyValuePair) UnmarshalYAML

func (p *KeyValuePair) UnmarshalYAML(unmarshal func(interface{}) error) error

type Resources

type Resources struct {
	Limits       ResourcesLimits       `yaml:"limits"`
	Reservations ResourcesReservations `yaml:"reservations"`
}

Resources for the service

type ResourcesLimits

type ResourcesLimits struct {
	MemoryMB int `yaml:"memory"`
}

type ResourcesReservations

type ResourcesReservations struct {
	MemoryMB int `yaml:"memory"`
}

type Service

type Service struct {
	Image                    string            `yaml:"image"`
	Deploy                   Deploy            `yaml:"deploy"`
	Volumes                  VolumeList        `yaml:"volumes"`
	Environment              KeyValuePair      `yaml:"environment"`
	CapAdd                   []string          `yaml:"cap_add"`
	Sysctls                  KeyValuePair      `yaml:"sysctls"`
	Hostname                 string            `yaml:"hostname"`
	Command                  Command           `yaml:"command"`
	Configs                  []Config          `yaml:"configs"`
	CustomHealthCheck        CustomHealthCheck `yaml:"custom_health_check"`
	PreferredServerHostnames []string          `yaml:"preferred_server_hostnames"`
	DockerProxyConfig        DockerProxyConfig `yaml:"docker_proxy_config"`
}

func (*Service) ValidateDockerProxyConfig

func (s *Service) ValidateDockerProxyConfig() error

type Stack

type Stack struct {
	MinimumSwiftwaveVersion string             `yaml:"minimum_swiftwave_version"`
	Services                map[string]Service `yaml:"services"`
	Docs                    *Docs              `yaml:"docs"`
}

Stack Stack definition

func ParseStackYaml

func ParseStackYaml(yamlStr string, currentSwiftwaveVersion string) (Stack, error)

func (*Stack) FillAndVerifyVariables

func (s *Stack) FillAndVerifyVariables(variableMapping *map[string]string, serviceManager service_manager.ServiceManager) (*Stack, error)

func (*Stack) PreferredServerHostnames

func (s *Stack) PreferredServerHostnames() []string

func (*Stack) ServiceNames

func (s *Stack) ServiceNames() []string

func (*Stack) String

func (s *Stack) String(ignoreDocs bool) (string, error)

func (*Stack) VolumeNames

func (s *Stack) VolumeNames() []string

type Volume

type Volume struct {
	Name          string `yaml:"name"`
	MountingPoint string `yaml:"mounting_point"`
}

func (Volume) MarshalYAML

func (v Volume) MarshalYAML() (interface{}, error)

type VolumeList

type VolumeList []Volume

VolumeList List of volumes

func (*VolumeList) UnmarshalYAML

func (l *VolumeList) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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