k8s

package
v0.0.0-...-d8c43a0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceTypeHelmPostgresOperator = "kubernetes-helm-postgres-operator"
	ResourceTypeHelmRedisOperator    = "kubernetes-helm-redis-operator"
	ResourceTypeHelmRabbitmqOperator = "kubernetes-helm-rabbitmq-operator"
	ResourceTypeHelmMongodbOperator  = "kubernetes-helm-mongodb-operator"
)
View Source
const (
	AuthTypeKubeconfig = "kubernetes"
)
View Source
const ProviderType = "kubernetes"
View Source
const ResourceTypeCaddy = "kubernetes-caddy"
View Source
const (
	TemplateTypeKubernetesCloudrun = "kubernetes-cloudrun"
)

Variables

This section is empty.

Functions

func CaddyReadConfig

func CaddyReadConfig(config *api.Config) (api.Config, error)

func ReadHelmMongodbOperatorConfig

func ReadHelmMongodbOperatorConfig(config *api.Config) (api.Config, error)

func ReadHelmPostgresOperatorConfig

func ReadHelmPostgresOperatorConfig(config *api.Config) (api.Config, error)

func ReadHelmRabbitmqOperatorConfig

func ReadHelmRabbitmqOperatorConfig(config *api.Config) (api.Config, error)

func ReadHelmRedisOperatorConfig

func ReadHelmRedisOperatorConfig(config *api.Config) (api.Config, error)

func ReadKubernetesConfig

func ReadKubernetesConfig(config *api.Config) (api.Config, error)

func ReadTemplateConfig

func ReadTemplateConfig(config *api.Config) (api.Config, error)

func ToKubernetesRunConfig

func ToKubernetesRunConfig(tpl any, composeCfg compose.Config, stackCfg *api.StackConfigCompose) (any, error)

Types

type CaddyConfig

type CaddyConfig struct {
	Enable           *bool   `json:"enable,omitempty" yaml:"enable,omitempty"`
	Caddyfile        *string `json:"caddyfile,omitempty" yaml:"caddyfile,omitempty"` // TODO: support overwriting
	Namespace        *string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	Image            *string `json:"image,omitempty" yaml:"image,omitempty"`
	Replicas         *int    `json:"replicas,omitempty" yaml:"replicas,omitempty"`
	UsePrefixes      bool    `json:"usePrefixes,omitempty" yaml:"usePrefixes,omitempty"`           // whether to use prefixes instead of domains (default: false)
	ServiceType      *string `json:"serviceType,omitempty" yaml:"serviceType,omitempty"`           // whether to use custom service type instead of LoadBalancer (default: LoadBalancer)
	ProvisionIngress bool    `json:"provisionIngress,omitempty" yaml:"provisionIngress,omitempty"` // whether to provision ingress for caddy (default: false)
	UseSSL           *bool   `json:"useSSL,omitempty" yaml:"useSSL,omitempty"`                     // whether to use ssl by default (default: true)
}

type CaddyResource

type CaddyResource struct {
	*KubernetesConfig `json:",inline" yaml:",inline"`
	*CaddyConfig      `json:",inline" yaml:",inline"`
}

type CloudExtras

type CloudExtras struct {
	NodeSelector     map[string]string `json:"nodeSelector" yaml:"nodeSelector"`
	DisruptionBudget *DisruptionBudget `json:"disruptionBudget" yaml:"disruptionBudget"`
	RollingUpdate    *RollingUpdate    `json:"rollingUpdate" yaml:"rollingUpdate"`
}

type CloudRunContainer

type CloudRunContainer struct {
	Name            string             `json:"name" yaml:"name"`
	Command         []string           `json:"command" yaml:"command"`
	Args            []string           `json:"args" yaml:"args"`
	Image           api.ContainerImage `json:"image" yaml:"image"`
	Env             map[string]string  `json:"env" yaml:"env"`
	Secrets         map[string]string  `json:"secrets" yaml:"secrets"`
	Ports           []int              `json:"ports" yaml:"ports"`
	MainPort        *int               `json:"mainPort" yaml:"mainPort"`
	ReadinessProbe  *CloudRunProbe     `json:"readinessProbe" yaml:"readinessProbe"`
	StartupProbe    *CloudRunProbe     `json:"startupProbe" yaml:"startupProbe"`
	ComposeDir      string             `json:"composeDir" yaml:"composeDir"`
	Resources       *Resources         `json:"resources" yaml:"resources"`
	Volumes         []PersistentVolume `json:"volumes" yaml:"volumes"`
	ImagePullPolicy *string            `json:"imagePullPolicy" yaml:"imagePullPolicy"`

	Warnings []string `json:"warnings" yaml:"warnings"` // non-critical errors happened during conversion (should be reported later)
}

func ConvertComposeToContainers

func ConvertComposeToContainers(composeCfg compose.Config, stackCfg *api.StackConfigCompose) ([]CloudRunContainer, error)

func FindIngressContainer

func FindIngressContainer(composeCfg compose.Config, contaniers []CloudRunContainer) (*CloudRunContainer, error)

type CloudRunProbe

type CloudRunProbe struct {
	HttpGet             ProbeHttpGet   `json:"httpGet" yaml:"httpGet"`
	Interval            *time.Duration `json:"interval" yaml:"interval"`
	InitialDelaySeconds *int           `json:"initialDelaySeconds" yaml:"initialDelaySeconds"`
	IntervaSeconds      *int           `json:"intervaSeconds" yaml:"intervaSeconds"`
	FailureThreshold    *int           `json:"failureThreshold" yaml:"failureThreshold"`
	SuccessThreshold    *int           `json:"successThreshold" yaml:"successThreshold"`
	TimeoutSeconds      *int           `json:"timeoutSeconds" yaml:"timeoutSeconds"`
}

type CloudRunScale

type CloudRunScale struct {
	Min int `json:"min" yaml:"min"`
	Max int `json:"max" yaml:"max"`
}

type CloudrunTemplate

type CloudrunTemplate struct {
	KubernetesConfig           `json:",inline" yaml:",inline"`
	docker.RegistryCredentials `json:",inline" yaml:",inline"`
	CaddyResource              *string `json:"caddyResource,omitempty" yaml:"caddyResource,omitempty"` // name of the caddy resource in base stack
	UseSSL                     *bool   `json:"useSSL,omitempty" yaml:"useSSL,omitempty"`               // whether to assume connection must be over https only (default: true)
}

type DeploymentConfig

type DeploymentConfig struct {
	StackConfig      *api.StackConfigCompose `json:"stackConfig" yaml:"stackConfig"`
	Containers       []CloudRunContainer     `json:"containers" yaml:"containers"`
	IngressContainer *CloudRunContainer      `json:"ingressContainer" yaml:"ingressContainer"`
	Scale            *Scale                  `json:"replicas" yaml:"replicas"`
	Headers          *Headers                `json:"headers" yaml:"headers"`
	TextVolumes      []SimpleTextVolume      `json:"textVolumes" yaml:"textVolumes"`
	DisruptionBudget *DisruptionBudget       `json:"disruptionBudget" yaml:"disruptionBudget"`
	RollingUpdate    *RollingUpdate          `json:"rollingUpdate" yaml:"rollingUpdate"`
	NodeSelector     map[string]string       `json:"nodeSelector" yaml:"nodeSelector"`
}

type DisruptionBudget

type DisruptionBudget struct {
	MaxUnavailable *int `json:"maxUnavailable" yaml:"maxUnavailable"`
	MinAvailable   *int `json:"minAvailable" yaml:"minAvailable"`
}

type Headers

type Headers = map[string]string

func ToHeaders

func ToHeaders(headers *api.Headers) Headers

type HelmChartConfig

type HelmChartConfig struct {
	ValuesMap             HelmValues `json:"values,omitempty" yaml:"values,omitempty" `
	OperatorNamespaceName *string    `json:"operatorNamespace,omitempty" yaml:"operatorNamespace,omitempty"`
	NamespaceName         *string    `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}

func (*HelmChartConfig) Namespace

func (c *HelmChartConfig) Namespace() *string

func (*HelmChartConfig) OperatorNamespace

func (c *HelmChartConfig) OperatorNamespace() *string

func (*HelmChartConfig) Values

func (c *HelmChartConfig) Values() HelmValues

type HelmMongodbOperator

type HelmMongodbOperator struct {
	*KubernetesConfig `json:",inline" yaml:",inline"`
	HelmChartConfig   `json:",inline" yaml:",inline"`
	Version           *string `json:"version,omitempty" yaml:"version,omitempty"`
	Replicas          *int    `json:"replicas,omitempty" yaml:"replicas,omitempty"`
}

type HelmOperatorChart

type HelmOperatorChart interface {
	OperatorNamespace() *string
	Values() HelmValues
}

type HelmPostgresOperator

type HelmPostgresOperator struct {
	*KubernetesConfig `json:",inline" yaml:",inline"`
	HelmChartConfig   `json:",inline" yaml:",inline"`
	VolumeSize        *string  `json:"volumeSize,omitempty" yaml:"volumeSize,omitempty"`
	NumberOfInstances *int     `json:"numberOfInstances,omitempty" yaml:"numberOfInstances,omitempty"`
	Version           *string  `json:"version,omitempty" yaml:"version,omitempty"`
	PgHbaEntries      []string `json:"pg_hba" yaml:"pg_hba"`
	InitSQL           *string  `json:"initSQL,omitempty" yaml:"initSQL,omitempty"`
}

type HelmRabbitmqOperator

type HelmRabbitmqOperator struct {
	*KubernetesConfig `json:",inline" yaml:",inline"`
	HelmChartConfig   `json:",inline" yaml:",inline"`
	Replicas          *int `json:"replicas,omitempty" yaml:"replicas,omitempty"`
}

type HelmRedisOperator

type HelmRedisOperator struct {
	*KubernetesConfig `json:",inline" yaml:",inline"`
	HelmChartConfig   `json:",inline" yaml:",inline"`
}

type HelmValues

type HelmValues map[string]any

type KubeRunInput

type KubeRunInput struct {
	CloudrunTemplate `json:"templateConfig" yaml:"templateConfig"`
	Deployment       DeploymentConfig `json:"deployment" yaml:"deployment"`
}

func (*KubeRunInput) DependsOnResources

func (i *KubeRunInput) DependsOnResources() []api.StackConfigDependencyResource

func (*KubeRunInput) Uses

func (i *KubeRunInput) Uses() []string

type KubernetesConfig

type KubernetesConfig struct {
	Kubeconfig string `json:"kubeconfig" yaml:"kubeconfig"`
}

func (*KubernetesConfig) CredentialsValue

func (r *KubernetesConfig) CredentialsValue() string

func (*KubernetesConfig) ProjectIdValue

func (r *KubernetesConfig) ProjectIdValue() string

func (*KubernetesConfig) ProviderType

func (r *KubernetesConfig) ProviderType() string

type PersistentVolume

type PersistentVolume struct {
	Name             string   `json:"name" yaml:"name"`
	MountPath        string   `json:"mountPath" yaml:"mountPath"`
	Storage          string   `json:"storage" yaml:"storage"`
	AccessModes      []string `json:"accessModes" yaml:"accessModes"`
	StorageClassName *string  `json:"storageClassName" yaml:"storageClassName"`
}

func ToPersistentVolumes

func ToPersistentVolumes(svc types.ServiceConfig, cfg compose.Config) []PersistentVolume

type ProbeHttpGet

type ProbeHttpGet struct {
	Path string `json:"path" yaml:"path"`
	Port int    `json:"port" yaml:"port"`
}

type Resources

type Resources struct {
	Limits   map[string]string `json:"limits" yaml:"limits"`
	Requests map[string]string `json:"requests" yaml:"requests"`
}

func ToResources

func ToResources(cfg *api.StackConfigCompose, svc types.ServiceConfig) (*Resources, error)

type RollingUpdate

type RollingUpdate struct {
	MaxSurge       *int `json:"maxSurge" yaml:"maxSurge"`
	MaxUnavailable *int `json:"maxUnavailable" yaml:"maxUnavailable"`
}

type Scale

type Scale struct {
	Replicas int `json:"replicas" yaml:"replicas"`
}

func ToScale

func ToScale(stack *api.StackConfigCompose) *Scale

type SimpleTextVolume

type SimpleTextVolume struct {
	api.TextVolume `json:",inline" yaml:",inline"`
}

func ToSimpleTextVolumes

func ToSimpleTextVolumes(cfg *api.StackConfigCompose) []SimpleTextVolume

Jump to

Keyboard shortcuts

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