Documentation
¶
Index ¶
- func GenerateResources(cfg *Config, app *stack.Application) ([]*client.Object, error)
- type Config
- type ConfigMapKeySelector
- type ConfigMapVolumeSource
- type ContainerConfig
- type ContainerPort
- type EmptyDirVolumeSource
- type EnvVar
- type EnvVarSource
- type ExecAction
- type HTTPGetAction
- type HostPathVolumeSource
- type IngressConfig
- type ObjectFieldSelector
- type Probe
- type ResourceRequirements
- type SecretKeySelector
- type SecretVolumeSource
- type ServiceConfig
- type Volume
- type VolumeClaimTemplate
- type VolumeMount
- type VolumeSource
- type WorkloadType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateResources ¶
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 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 ¶
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 HostPathVolumeSource ¶
type HostPathVolumeSource struct {
Path string `json:"path" yaml:"path"`
}
type IngressConfig ¶
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 ¶
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 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 ¶
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" )
Click to show internal directories.
Click to hide internal directories.