1- // Copyright 2024 StreamNative
1+ // Copyright 2025 StreamNative
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -17,6 +17,8 @@ package v1alpha1
1717import (
1818 "reflect"
1919
20+ corev1 "k8s.io/api/core/v1"
21+
2022 "k8s.io/apimachinery/pkg/api/meta"
2123 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2224
@@ -217,3 +219,141 @@ type FunctionSecretKeyRef struct {
217219 Path string `json:"path"`
218220 Key string `json:"key"`
219221}
222+
223+ // PodTemplate defines the pod template configuration
224+ type PodTemplate struct {
225+ // Standard object's metadata.
226+ // +optional
227+ ObjectMeta ObjectMeta `json:"metadata,omitempty"`
228+
229+ // Specification of the desired behavior of the pod.
230+ // +optional
231+ Spec PodTemplateSpec `json:"spec,omitempty"`
232+ }
233+
234+ // ObjectMeta is metadata that all persisted resources must have
235+ type ObjectMeta struct {
236+ // Name of the resource
237+ // +optional
238+ Name string `json:"name,omitempty"`
239+
240+ // Namespace of the resource
241+ // +optional
242+ Namespace string `json:"namespace,omitempty"`
243+
244+ // Labels of the resource
245+ // +optional
246+ Labels map [string ]string `json:"labels,omitempty"`
247+
248+ // Annotations of the resource
249+ // +optional
250+ Annotations map [string ]string `json:"annotations,omitempty"`
251+ }
252+
253+ // PodTemplateSpec describes the data a pod should have when created from a template
254+ type PodTemplateSpec struct {
255+ // List of volumes that can be mounted by containers belonging to the pod.
256+ // +optional
257+ Volumes []Volume `json:"volumes,omitempty"`
258+
259+ // List of initialization containers belonging to the pod.
260+ // +optional
261+ InitContainers []Container `json:"initContainers,omitempty"`
262+
263+ // List of containers belonging to the pod.
264+ // +optional
265+ Containers []Container `json:"containers,omitempty"`
266+
267+ // ServiceAccountName is the name of the ServiceAccount to use to run this pod.
268+ // +optional
269+ ServiceAccountName string `json:"serviceAccountName,omitempty"`
270+
271+ // NodeSelector is a selector which must be true for the pod to fit on a node.
272+ // +optional
273+ NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
274+
275+ // SecurityContext holds pod-level security attributes and common container settings.
276+ // +optional
277+ SecurityContext * corev1.PodSecurityContext `json:"securityContext,omitempty"`
278+
279+ // 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.
280+ // +optional
281+ ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
282+
283+ // If specified, the pod's scheduling constraints
284+ // +optional
285+ Affinity * corev1.Affinity `json:"affinity,omitempty"`
286+
287+ // If specified, the pod's tolerations.
288+ // +optional
289+ Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
290+ }
291+
292+ // Container defines a single application container
293+ type Container struct {
294+ // Name of the container specified as a DNS_LABEL.
295+ // +optional
296+ Name string `json:"name,omitempty"`
297+
298+ // Docker image name.
299+ // +optional
300+ Image string `json:"image,omitempty"`
301+
302+ // Entrypoint array. Not executed within a shell.
303+ // +optional
304+ Command []string `json:"command,omitempty"`
305+
306+ // Arguments to the entrypoint.
307+ // +optional
308+ Args []string `json:"args,omitempty"`
309+
310+ // Container's working directory.
311+ // +optional
312+ WorkingDir string `json:"workingDir,omitempty"`
313+
314+ // List of environment variables to set in the container.
315+ // +optional
316+ Env []corev1.EnvVar `json:"env,omitempty"`
317+
318+ // List of sources to populate environment variables in the container.
319+ // +optional
320+ EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
321+
322+ // Compute Resources required by this container.
323+ // +optional
324+ Resources corev1.ResourceRequirements `json:"resources,omitempty"`
325+
326+ // Pod volumes to mount into the container's filesystem.
327+ // +optional
328+ VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
329+
330+ // Image pull policy.
331+ // +optional
332+ ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
333+
334+ // Security context at container level
335+ // +optional
336+ SecurityContext * corev1.SecurityContext `json:"securityContext,omitempty"`
337+ }
338+
339+ // Volume represents a named volume in a pod
340+ type Volume struct {
341+ // Volume's name.
342+ // +required
343+ Name string `json:"name"`
344+
345+ // VolumeSource represents the location and type of the mounted volume.
346+ // +required
347+ VolumeSource `json:",inline"`
348+ }
349+
350+ // VolumeSource represents the source location of a volume to mount.
351+ type VolumeSource struct {
352+ // ConfigMap represents a configMap that should populate this volume
353+ // +optional
354+ ConfigMap * corev1.ConfigMapVolumeSource `json:"configMap,omitempty"`
355+
356+ // Secret represents a secret that should populate this volume.
357+ // +optional
358+ Secret * corev1.SecretVolumeSource `json:"secret,omitempty"`
359+ }
0 commit comments