internal

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateResources

func GenerateResources(cfg *Config, app *stack.Application) ([]*client.Object, error)

Generate builds Kubernetes resources for the application workload. GenerateResources creates Kubernetes resources from the Config

Types

type Config

type Config struct {
	Name      string            `json:"name" yaml:"name"`
	Namespace string            `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	Workload  WorkloadType      `yaml:"workload,omitempty"`
	Replicas  int32             `json:"replicas,omitempty" yaml:"replicas,omitempty"`
	Labels    map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`

	Containers           []ContainerConfig     `json:"containers" yaml:"containers"`
	Volumes              []Volume              `json:"volumes,omitempty" yaml:"volumes,omitempty"`
	VolumeClaimTemplates []VolumeClaimTemplate `json:"volumeClaimTemplates,omitempty" yaml:"volumeClaimTemplates,omitempty"`

	Services []ServiceConfig `json:"services,omitempty" yaml:"services,omitempty"`
	Ingress  *IngressConfig  `json:"ingress,omitempty" yaml:"ingress,omitempty"`
}

Config describes a single deployable application.

type ConfigMapKeySelector

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

type ConfigMapVolumeSource

type ConfigMapVolumeSource struct {
	Name string `json:"name" yaml:"name"`
}

type ContainerConfig

type ContainerConfig struct {
	Name         string          `json:"name" yaml:"name"`
	Image        string          `json:"image" yaml:"image"`
	Ports        []ContainerPort `json:"ports,omitempty" yaml:"ports,omitempty"`
	Env          []EnvVar        `json:"env,omitempty" yaml:"env,omitempty"`
	VolumeMounts []VolumeMount   `json:"volumeMounts,omitempty" yaml:"volumeMounts,omitempty"`

	Resources *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"`

	StartupProbe   *Probe `json:"startupProbe,omitempty" yaml:"startupProbe,omitempty"`
	LivenessProbe  *Probe `json:"livenessProbe,omitempty" yaml:"livenessProbe,omitempty"`
	ReadinessProbe *Probe `json:"readinessProbe,omitempty" yaml:"readinessProbe,omitempty"`
}

func (ContainerConfig) Generate

func (cfg ContainerConfig) Generate() (*corev1.Container, []corev1.ContainerPort, error)

type ContainerPort

type ContainerPort struct {
	Name          string `json:"name,omitempty" yaml:"name,omitempty"`
	ContainerPort int32  `json:"containerPort" yaml:"containerPort"`
	Protocol      string `json:"protocol,omitempty" yaml:"protocol,omitempty"`
}

func (ContainerPort) ToKubernetesPort

func (cp ContainerPort) ToKubernetesPort() corev1.ContainerPort

type EmptyDirVolumeSource

type EmptyDirVolumeSource struct {
	SizeLimit string `json:"sizeLimit,omitempty" yaml:"sizeLimit,omitempty"`
}

type EnvVar

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

func (EnvVar) ToKubernetesEnvVar

func (env EnvVar) ToKubernetesEnvVar() corev1.EnvVar

type EnvVarSource

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

type ExecAction

type ExecAction struct {
	Command []string `json:"command,omitempty" yaml:"command,omitempty"`
}

type HTTPGetAction

type HTTPGetAction struct {
	Path   string `json:"path,omitempty" yaml:"path,omitempty"`
	Port   int32  `json:"port" yaml:"port"`
	Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
}

type HostPathVolumeSource

type HostPathVolumeSource struct {
	Path string `json:"path" yaml:"path"`
}

type IngressConfig

type IngressConfig struct {
	Host            string `json:"host" yaml:"host"`
	Path            string `json:"path" yaml:"path"`
	ServiceName     string `json:"serviceName" yaml:"serviceName"`
	ServicePortName string `json:"servicePortName" yaml:"servicePortName"`
}

type ObjectFieldSelector

type ObjectFieldSelector struct {
	FieldPath string `json:"fieldPath" yaml:"fieldPath"`
}

type Probe

type Probe struct {
	HTTPGet             *HTTPGetAction `json:"httpGet,omitempty" yaml:"httpGet,omitempty"`
	Exec                *ExecAction    `json:"exec,omitempty" yaml:"exec,omitempty"`
	InitialDelaySeconds int32          `json:"initialDelaySeconds,omitempty" yaml:"initialDelaySeconds,omitempty"`
	TimeoutSeconds      int32          `json:"timeoutSeconds,omitempty" yaml:"timeoutSeconds,omitempty"`
	PeriodSeconds       int32          `json:"periodSeconds,omitempty" yaml:"periodSeconds,omitempty"`
	SuccessThreshold    int32          `json:"successThreshold,omitempty" yaml:"successThreshold,omitempty"`
	FailureThreshold    int32          `json:"failureThreshold,omitempty" yaml:"failureThreshold,omitempty"`
}

func (Probe) ToKubernetesProbe

func (p Probe) ToKubernetesProbe() *corev1.Probe

type ResourceRequirements

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

ResourceRequirements wraps corev1.ResourceRequirements with custom YAML unmarshaling

func (*ResourceRequirements) ToKubernetesResources

func (r *ResourceRequirements) ToKubernetesResources() (*corev1.ResourceRequirements, error)

ToKubernetesResources converts to standard Kubernetes ResourceRequirements

type SecretKeySelector

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

type SecretVolumeSource

type SecretVolumeSource struct {
	SecretName string `json:"secretName" yaml:"secretName"`
}

type ServiceConfig

type ServiceConfig struct {
	Name       string             `json:"name" yaml:"name"`
	Type       corev1.ServiceType `json:"type,omitempty" yaml:"type,omitempty"`
	Port       int32              `json:"port" yaml:"port"`             // service port
	TargetPort int32              `json:"targetPort" yaml:"targetPort"` // container port
	Protocol   corev1.Protocol    `json:"protocol,omitempty" yaml:"protocol,omitempty"`

	// Optional explicit selector override (else falls back to Deployment labels)
	Selector map[string]string `json:"selector,omitempty" yaml:"selector,omitempty"`
}

type Volume

type Volume struct {
	Name         string        `json:"name" yaml:"name"`
	VolumeSource *VolumeSource `json:",inline" yaml:",inline"`
}

func (Volume) ToKubernetesVolume

func (v Volume) ToKubernetesVolume() corev1.Volume

type VolumeClaimTemplate

type VolumeClaimTemplate struct {
	Metadata struct {
		Name string `json:"name" yaml:"name"`
	} `json:"metadata" yaml:"metadata"`
	Spec struct {
		AccessModes      []string              `json:"accessModes,omitempty" yaml:"accessModes,omitempty"`
		StorageClassName *string               `json:"storageClassName,omitempty" yaml:"storageClassName,omitempty"`
		Resources        *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"`
	} `json:"spec" yaml:"spec"`
}

VolumeClaimTemplate wraps PersistentVolumeClaim with custom resource parsing

func (*VolumeClaimTemplate) ToKubernetesPVC

func (vct *VolumeClaimTemplate) ToKubernetesPVC() (*corev1.PersistentVolumeClaim, error)

ToKubernetesPVC converts to standard Kubernetes PersistentVolumeClaim

type VolumeMount

type VolumeMount struct {
	Name      string `json:"name" yaml:"name"`
	MountPath string `json:"mountPath" yaml:"mountPath"`
	ReadOnly  bool   `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
	SubPath   string `json:"subPath,omitempty" yaml:"subPath,omitempty"`
}

func (VolumeMount) ToKubernetesVolumeMount

func (vm VolumeMount) ToKubernetesVolumeMount() corev1.VolumeMount

type VolumeSource

type VolumeSource struct {
	EmptyDir  *EmptyDirVolumeSource  `json:"emptyDir,omitempty" yaml:"emptyDir,omitempty"`
	ConfigMap *ConfigMapVolumeSource `json:"configMap,omitempty" yaml:"configMap,omitempty"`
	Secret    *SecretVolumeSource    `json:"secret,omitempty" yaml:"secret,omitempty"`
	HostPath  *HostPathVolumeSource  `json:"hostPath,omitempty" yaml:"hostPath,omitempty"`
}

type WorkloadType

type WorkloadType string

WorkloadType enumerates the supported Kubernetes workload kinds.

const (
	DeploymentWorkload  WorkloadType = "Deployment"
	StatefulSetWorkload WorkloadType = "StatefulSet"
	DaemonSetWorkload   WorkloadType = "DaemonSet"
)

Jump to

Keyboard shortcuts

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