Documentation
¶
Overview ¶
pkg/resources/pods/pod.go
pkg/resources/pods/types.go
Index ¶
- func Create(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- type ResolvedPodSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedPodSpec) error
Create creates a Pod owned by the CR if it does not already exist. Idempotent — if the Pod exists, does nothing and returns nil. Owner reference is set so the Pod is garbage collected when the CR is deleted.
func Delete ¶
func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedPodSpec) error
Delete deletes the Pod if it exists. For most cases owner references handle cascade deletion automatically — only use this when you need explicit cleanup control in onDelete.
func DeleteIfOwned ¶
func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, name, namespace string) error
DeleteIfOwned deletes the Pod if it exists and is owned by the CR.
func Update ¶
func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedPodSpec) error
Update reconciles an existing Pod to match the resolved spec. Pods are largely immutable — image drift triggers delete + recreate. If the Pod does not exist, creates it.
Types ¶
type ResolvedPodSpec ¶
type ResolvedPodSpec struct {
// Name — resolved Pod name. Required.
Name string
// Image — container image. Required.
Image string
// Namespace — target namespace. Required.
Namespace string
// Port — container port. 0 means no port exposed.
Port int
Protocol corev1.Protocol
// Labels — merged labels from both sources.
// Orkestra always adds: managed-by=orkestra, orkestra-owner=<cr-name>
Labels map[string]string
// Annotations — merged annotations from both sources.
Annotations map[string]string
// Resources — CPU and memory requests/limits. nil means no limits set.
Resources *orktypes.ResourceRequirements
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
// +mapType=atomic
NodeSelector map[string]string
// ServiceAccountName is the name of the ServiceAccount to use to run this pod.
// More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
// +optional
ServiceAccountName string
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use
// for pulling any of the images used by this PodSpec.
// If specified, these secrets will be passed to individual puller implementations for them to use.
ImagePullSecrets []string
// Probes — startup, liveness, and readiness probe configuration.
Probes *orktypes.ProbesConfig
// SecurityContext — container-level security settings.
SecurityContext *orktypes.ContainerSecurityContext
// PodSecurity — pod-level security settings.
PodSecurity *orktypes.PodSecurityContext
// Profiles — user-defined profile registry for runtime profile resolution.
Profiles orktypes.ProfileRegistry
// Volumes / VolumeMounts — pod volumes and container mounts.
Volumes []orktypes.VolumeSource
VolumeMounts []orktypes.VolumeMount
// Sleep injects an artificial delay into the reconcile of this resource.
// Useful for autoscale testing, latency simulation, and chaos engineering.
// Accepts extended duration units (s, m, h, d, w, mo, y).
Sleep string
}
ResolvedPodSpec is the fully resolved Pod specification. Produced by merging PodFromCRD (dynamic) and PodFromKatalog (static). fromCRD wins over fromKatalog when both declare the same field. Passed directly to Create, Update, and Delete.
func Resolve ¶
func Resolve(src orktypes.PodTemplateSource, ownerName string, reg orktypes.ProfileRegistry) ResolvedPodSpec
Resolve builds a ResolvedPodSpec from a PodTemplateSource.
Fields are flat on the source struct. Template expressions must already be evaluated by template.Resolver before calling Resolve. This function only reads already-resolved string values and assembles the spec.
Orkestra system labels (managed-by, orkestra-owner) are always added and cannot be overridden by the user.