Component

Component describes your workload.

For example, the following component configuration sets up a hello-world workload running the kalmhq/echoserver image, the workload has one replica and exposes the 8001 port for receiving requests.

apiVersion: core.kalm.dev/v1alpha1
kind: Component
metadata:
name: hello-world
namespace: default
spec:
replicas: 1
workloadType: server
image: kalmhq/echoserver
ports:
- containerPort: 8001
protocol: http
servicePort: 8001

Component

FieldTypeDescriptionRequired
labelsmap[string]stringlabels will add to podsFalse
annotationsmap[string]stringannotations will add to podsFalse
envEnvVar[]List of environment variables to set in the containerFalse
imagestringDocker image nameTrue
replicas*int32the number of desired pods, default to 1False
nodeSelectorLabelsmap[string]stringif set, pod will only be scheduled onto the node with given labelsFalse
preferNotCoLocatedboolif set, will avoid putting pods of this component in the same nodeFalse
startAfterComponentsstring[]will start this component after the components specifiedFalse
commandstringrun command for podFalse
enableHeadlessServiceboolif set, will start a headless service for the componentFalse
portsPort[]information on the component's service portsFalse
workloadTypeWorkloadTypetype of the component workload, default to: serverFalse
schedulestringREQUIRED if WorkloadType is cronjob, the schedule of cronjob, e.g. * * * * *False
livenessProbe*v1.Probedescribes a health check to be performed against a container to determine whether it is alive to receive traffic.False
readinessProbe*v1.Probesimilar as LivenessProbe, but used to determine if the container is ready to receive trafficFalse
resourceRequirements*v1.ResourceRequirementsdescribes the compute resource requirementsFalse
terminationGracePeriodSeconds*int64duration in seconds the pod needs to terminate gracefully.False
dnsPolicyv1.DNSPolicyhow a pod's DNS will be configured.False
restartPolicyv1.RestartPolicyhow the container should be restarted.False
restartStrategyappsv1.DeploymentStrategyTypeThe deployment strategy to use to replace existing pods with new ones.False
volumesVolume[]temporary or persistent volumes for the podsFalse
runnerPermission*RunnerPermissionsetup RBAC permission for the running podsFalse
preInjectedFilesPreInjectFile[]convenient way to mount files into containersFalse

EnvVar

FieldTypeDescriptionRequired
namestringName of the environment variable.True
valuestringSource for the environment variable's value.False
typeEnvVarTypedifferent types of EnvVar have different ways of parsing EnvVar.ValueFalse
prefixstringprefix of env nameFalse
suffixstringsuffix of env nameFalse

EnvVarType

NameDescription
staticenvironment variable's value is simply EnvVar.Value
EnvVarTypeExternal
linkedEnvVar.Value in format of: serviceName/servicePortName, environment variable's value will resove to: serviceName.currentNamespace:_servicePort, useful if you wanna reference other component's service in same application.
fieldrefEnvVar.Value is pod FieldSelector, environment variable's value will resove to the value of pod field.
builtinpossible EnvVar values are: EnvVarBuiltinHost, EnvVarBuiltinPodName and EnvVarBuiltinNamespace.

- EnvVarBuiltinHost: environment variable's value will resolve to spec.nodeName of the pod
- EnvVarBuiltinPodName: metadata.name of the pod
- EnvVarBuiltinNamespace: metadata.namespace of the pod

Port

FieldTypeDescriptionRequired
containerPortuint32container portTrue
servicePortuint32service port, if absent, will set as same as ContainerPortFalse
protocolPortProtocolprotocol of the serviceFalse

PortProtocol

NameDescription
httpHTTP
httpsHTTPS
http2HTTP2
grpcGRPC
grpc-webGRPCWEB
tcpTCP
udpUDP
unknownUnknown

WorkloadType

NameDescription
servercomponent run as deployment
cronjobcomponent run as CronJob
daemonsetcomponent run as DaemonSet
statefulsetcomponent run as StatefulSet

Volume

FieldTypeDescriptionRequired
pathstringPath within the container at which the volume should be mounted.True
hostPathstringRequired when VolumeType is: VolumeTypeHostPath,Path of the directory on the host.False
sizeresource.Quantitysize of the volumeFalse
typeVolumeTypetype of storage used as volumeFalse
storageClassName*stringName of the StorageClass required by the claim, used for VolumeTypePersistentVolumeClaim and VolumeTypePersistentVolumeClaimTemplateFalse
pvToMatchstringfor VolumeTypePersistentVolumeClaim, re-use volume which has the same same as set by PVToMatchFalse
pvcstringfor VolumeTypePersistentVolumeClaim and VolumeTypePersistentVolumeClaimTemplate, re-use exist PVC.Flase

VolumeType

NameDescription
emptyDirMemoryuse memory as storage
emptyDiruse disk as storage
pvcuse PVC as storage
pvcTemplateuse VolumeCliamTemplate as storage for StatefulSet
hostpathuse host path as storage

RunnerPermission

FieldTypeDescriptionRequired
roleTypestringif is clusterRole, will bind ClusterRole to the serviceAccount of the pod, otherwise, will bind RoleFalse
rulesrbacV1.PolicyRule[]the PolicyRules for the binding ClusterRole or RoleFalse

PreInjectFile

FieldTypeDescriptionRequired
contentstringcontent of the fileTrue
base64boolTo support binary content, it allows set base64 encoded data into Content field and set this flag to true. Binary data will be restored instead of plain string in Content.False
mountPathstringthe mount path of the fileTrue
readonlyboolif true, the file will be readonly, default to falseFalse
runnableboolif true, the file can be executed, default to falseFalse
Last updated on by Liu Mingmin