common

package
v0.0.0-...-3648c5b Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

pkg/apis/common/constants.go

pkg/apis/common/types.go +kubebuilder:object:generate=true +groupName=common.infini.cloud

Index

Constants

View Source
const (
	AppNameLabel           = "infini.cloud/application-name"   // Label for ApplicationDefinition name
	CompNameLabel          = "infini.cloud/component-name"     // Label for ComponentDefinition name (type)
	CompInstanceLabel      = "infini.cloud/component-instance" // Label for ApplicationComponent name (instance)
	ManagedByLabel         = "app.kubernetes.io/managed-by"    // Standard Kubernetes label
	OperatorName           = "runtime-operator"                // Name of this operator
	InClusterNamespacePath = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
)

Constants for standard labels and operator identification.

Variables

View Source
var Namespace string

Functions

This section is empty.

Types

type AffinitySpec

type AffinitySpec = corev1.Affinity

AffinitySpec uses corev1.Affinity directly.

type AppConfigData

type AppConfigData map[string]string

AppConfigData holds configuration data as key-value strings (filename -> content).

func (AppConfigData) DeepCopy

func (in AppConfigData) DeepCopy() AppConfigData

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppConfigData.

func (AppConfigData) DeepCopyInto

func (in AppConfigData) DeepCopyInto(out *AppConfigData)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConfigMountSpec

type ConfigMountSpec struct {
	// +kubebuilder:validation:Required
	Name string `json:"name"`
	// +optional
	VolumeName string `json:"volumeName,omitempty"`
	// +kubebuilder:validation:Required
	MountPath string `json:"mountPath"`
	// +optional
	SubPath *string `json:"subPath,omitempty"`
	// +optional
	Items []corev1.KeyToPath `json:"items,omitempty"`
	// +optional
	ReadOnly *bool `json:"readOnly,omitempty"`
}

ConfigMountSpec defines how to mount a ConfigMap as a volume.

func (*ConfigMountSpec) DeepCopy

func (in *ConfigMountSpec) DeepCopy() *ConfigMountSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMountSpec.

func (*ConfigMountSpec) DeepCopyInto

func (in *ConfigMountSpec) DeepCopyInto(out *ConfigMountSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerSecurityContextSpec

type ContainerSecurityContextSpec = corev1.SecurityContext

ContainerSecurityContextSpec uses corev1.SecurityContext directly.

type DeploymentStrategyPart

type DeploymentStrategyPart = appsv1.DeploymentStrategy

DeploymentStrategyPart uses appsv1.DeploymentStrategy directly.

type EnvFromSourceSpec

type EnvFromSourceSpec = corev1.EnvFromSource

EnvFromSourceSpec uses corev1.EnvFromSource directly.

type EnvVarSpec

type EnvVarSpec = corev1.EnvVar

EnvVarSpec uses corev1.EnvVar directly.

type ImageSpec

type ImageSpec struct {
	// +optional
	Repository string `json:"repository,omitempty"`
	// +optional
	Tag string `json:"tag,omitempty"`
	// +optional
	PullPolicy corev1.PullPolicy `json:"pullPolicy,omitempty"`
}

ImageSpec defines the container image configuration.

func (*ImageSpec) DeepCopy

func (in *ImageSpec) DeepCopy() *ImageSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageSpec.

func (*ImageSpec) DeepCopyInto

func (in *ImageSpec) DeepCopyInto(out *ImageSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeSelectorSpec

type NodeSelectorSpec map[string]string

NodeSelectorSpec uses map directly.

func (NodeSelectorSpec) DeepCopy

func (in NodeSelectorSpec) DeepCopy() NodeSelectorSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSelectorSpec.

func (NodeSelectorSpec) DeepCopyInto

func (in NodeSelectorSpec) DeepCopyInto(out *NodeSelectorSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PersistenceSpec

type PersistenceSpec struct {
	// +optional
	Enabled bool `json:"enabled,omitempty"`
	// +optional
	Size *resource.Quantity `json:"size,omitempty"`
	// +optional
	VolumeName string `json:"volumeName,omitempty"`
	// +optional
	MountPath string `json:"mountPath,omitempty"`
	// +optional
	StorageClassName *string `json:"storageClassName,omitempty"`
	// +optional
	AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`
}

PersistenceSpec defines configuration for a shared PersistentVolumeClaim (for Deployment).

func (*PersistenceSpec) DeepCopy

func (in *PersistenceSpec) DeepCopy() *PersistenceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistenceSpec.

func (*PersistenceSpec) DeepCopyInto

func (in *PersistenceSpec) DeepCopyInto(out *PersistenceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PodDisruptionBudgetSpecV1

type PodDisruptionBudgetSpecV1 = policyv1.PodDisruptionBudgetSpec

双版本类型定义

type PodDisruptionBudgetSpecV1beta1

type PodDisruptionBudgetSpecV1beta1 = policyv1beta1.PodDisruptionBudgetSpec

双版本类型定义

type PodManagementPolicyTypePart

type PodManagementPolicyTypePart = appsv1.PodManagementPolicyType

PodManagementPolicyTypePart uses appsv1.PodManagementPolicyType directly.

type PodSecurityContextSpec

type PodSecurityContextSpec = corev1.PodSecurityContext

PodSecurityContextSpec uses corev1.PodSecurityContext directly.

type PortSpec

type PortSpec struct {
	// +optional
	Name string `json:"name,omitempty"`
	// +kubebuilder:validation:Required
	ContainerPort int32 `json:"containerPort"`
	// +optional
	Protocol corev1.Protocol `json:"protocol,omitempty"`
	// +optional
	TargetPort *intstr.IntOrString `json:"targetPort,omitempty"`
	// +optional
	NodePort int32 `json:"nodePort,omitempty"`
}

PortSpec defines a container or service port.

func (*PortSpec) DeepCopy

func (in *PortSpec) DeepCopy() *PortSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortSpec.

func (*PortSpec) DeepCopyInto

func (in *PortSpec) DeepCopyInto(out *PortSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ProbesConfig

type ProbesConfig struct {
	// +optional
	Liveness *corev1.Probe `json:"liveness,omitempty"`
	// +optional
	Readiness *corev1.Probe `json:"readiness,omitempty"`
	// +optional
	Startup *corev1.Probe `json:"startup,omitempty"`
}

ProbesConfig groups different types of probes.

func (*ProbesConfig) DeepCopy

func (in *ProbesConfig) DeepCopy() *ProbesConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProbesConfig.

func (*ProbesConfig) DeepCopyInto

func (in *ProbesConfig) DeepCopyInto(out *ProbesConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourcesSpec

type ResourcesSpec struct {
	// +optional
	Limits corev1.ResourceList `json:"limits,omitempty"`
	// +optional
	Requests corev1.ResourceList `json:"requests,omitempty"`
}

ResourcesSpec defines the CPU and Memory requests and limits.

func (*ResourcesSpec) DeepCopy

func (in *ResourcesSpec) DeepCopy() *ResourcesSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcesSpec.

func (*ResourcesSpec) DeepCopyInto

func (in *ResourcesSpec) DeepCopyInto(out *ResourcesSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RuntimeConfig

type RuntimeConfig struct {

	// Replicas defines the number of desired pods.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Minimum=0
	// +optional
	Replicas *int32 `json:"replicas,omitempty"` // Pointer to allow zero value

	// Image specifies the container image details.
	// +kubebuilder:validation:Required
	// +optional
	Image   *ImageSpec `json:"image,omitempty"` // Pointer as it's checked for nil
	Command []string   `json:"command,omitempty" protobuf:"bytes,3,rep,name=command"`
	Args    []string   `json:"args,omitempty" protobuf:"bytes,4,rep,name=args"`

	// Ports defines the network ports exposed by the container.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +optional
	Ports []PortSpec `json:"ports,omitempty"` // Slice, builder checks for emptiness

	InitContainer *corev1.Container

	// Resources specifies CPU and memory resource requests and limits for the main container.
	// +optional
	Resources *ResourcesSpec `json:"resources,omitempty"`

	// Env defines environment variables for the main container.
	// +optional
	Env []EnvVarSpec `json:"env,omitempty"` // EnvVarSpec is likely corev1.EnvVar

	// EnvFrom defines sources to populate environment variables from (e.g., ConfigMaps, Secrets).
	// +optional
	EnvFrom []EnvFromSourceSpec `json:"envFrom,omitempty"` // EnvFromSourceSpec is likely corev1.EnvFromSource

	// Probes defines liveness, readiness, and startup probe configurations.
	// +optional
	Probes *ProbesConfig `json:"probes,omitempty"`

	// ContainerSecurityContext defines security settings specific to the main container.
	// +optional
	ContainerSecurityContext *ContainerSecurityContextSpec `json:"containerSecurityContext,omitempty"` // Likely *corev1.SecurityContext

	// PodSecurityContext defines security settings for the entire pod.
	// +optional
	PodSecurityContext *PodSecurityContextSpec `json:"podSecurityContext,omitempty"` // Likely *corev1.PodSecurityContext

	// ServiceAccount defines configuration for the Kubernetes Service Account.
	// +optional
	ServiceAccount *ServiceAccountSpec `json:"serviceAccount,omitempty"`

	// NodeSelector specifies label selectors for node assignment.
	// +optional
	NodeSelector NodeSelectorSpec `json:"nodeSelector,omitempty"` // Likely map[string]string

	// Tolerations specify pod tolerations for scheduling.
	// +optional
	Tolerations []TolerationsSpec `json:"tolerations,omitempty"` // Likely []corev1.Toleration

	// Affinity specifies pod affinity and anti-affinity rules.
	// +optional
	Affinity *AffinitySpec `json:"affinity,omitempty"` // Likely *corev1.Affinity

	// Persistence defines configuration for a shared PersistentVolumeClaim (typically for Deployment).
	// +optional
	Persistence *PersistenceSpec `json:"persistence,omitempty"`

	// Storage defines the template for PersistentVolumeClaims created per replica (typically for StatefulSet).
	// +optional
	Storage *StorageSpec `json:"storage,omitempty"`

	// Service defines how to expose the pods via a Kubernetes Service.
	// +optional
	Service *ServiceSpecPart `json:"service,omitempty"` // Use the helper struct defined below

	// ConfigFiles provides configuration file content as key-value pairs (filename -> content).
	// These will typically be mounted via a ConfigMap generated by the operator.
	// +optional
	ConfigFiles AppConfigData `json:"configFiles,omitempty"` // Likely map[string]string

	// ConfigMounts specifies how to mount existing ConfigMaps as volumes.
	// +optional
	ConfigMounts []ConfigMountSpec `json:"configMounts,omitempty"`

	// SecretMounts specifies how to mount existing Secrets as volumes.
	// +optional
	SecretMounts []SecretMountSpec `json:"secretMounts,omitempty"`

	// AdditionalVolumes allows specifying custom volumes (e.g., emptyDir, hostPath) directly.
	// Use with caution.
	// +optional
	AdditionalVolumes []corev1.Volume `json:"additionalVolumes,omitempty"`

	// VolumeMounts allows specifying custom volume mounts for the main container.
	// Use with caution, ensure volume names match defined volumes.
	// +optional
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`

	// StatefulSetUpdateStrategy defines the update strategy for the StatefulSet.
	// +optional
	StatefulSetUpdateStrategy *StatefulSetUpdateStrategyPart `json:"statefulSetUpdateStrategy,omitempty"` // Likely *appsv1.StatefulSetUpdateStrategy

	// PodManagementPolicy defines the pod management policy for the StatefulSet.
	// +optional
	PodManagementPolicy *PodManagementPolicyTypePart `json:"podManagementPolicy,omitempty"` // Likely *appsv1.PodManagementPolicyType

	// PodDisruptionBudget defines the PDB settings for the deployment/statefulset.
	// +optional
	PodDisruptionBudgetBeta1 *PodDisruptionBudgetSpecV1beta1 `json:"podDisruptionBudgetBeta1,omitempty"`
	PodDisruptionBudget      *PodDisruptionBudgetSpecV1      `json:"podDisruptionBudget,omitempty"`
}

It includes core workload settings and potentially overrides for common components.

func (*RuntimeConfig) DeepCopy

func (in *RuntimeConfig) DeepCopy() *RuntimeConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeConfig.

func (*RuntimeConfig) DeepCopyInto

func (in *RuntimeConfig) DeepCopyInto(out *RuntimeConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SecretMountSpec

type SecretMountSpec struct {
	// +kubebuilder:validation:Required
	SecretName string `json:"secretName"`
	// +optional
	VolumeName string `json:"volumeName,omitempty"`
	// +kubebuilder:validation:Required
	MountPath string `json:"mountPath"`
	// +optional
	Items []corev1.KeyToPath `json:"items,omitempty"`
	// +optional
	ReadOnly *bool `json:"readOnly,omitempty"`
}

SecretMountSpec defines how to mount a Secret as a volume.

func (*SecretMountSpec) DeepCopy

func (in *SecretMountSpec) DeepCopy() *SecretMountSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretMountSpec.

func (*SecretMountSpec) DeepCopyInto

func (in *SecretMountSpec) DeepCopyInto(out *SecretMountSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceAccountSpec

type ServiceAccountSpec struct {
	// +optional
	Create *bool `json:"create,omitempty"` // Default: false
	// +optional
	Name string `json:"name,omitempty"`
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`
}

ServiceAccountSpec defines Service Account creation and usage.

func (*ServiceAccountSpec) DeepCopy

func (in *ServiceAccountSpec) DeepCopy() *ServiceAccountSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccountSpec.

func (*ServiceAccountSpec) DeepCopyInto

func (in *ServiceAccountSpec) DeepCopyInto(out *ServiceAccountSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceSpecPart

type ServiceSpecPart struct {
	// Type specifies the Kubernetes Service type (ClusterIP, NodePort, LoadBalancer).
	// Defaults to ClusterIP if not specified.
	// +optional
	Type *corev1.ServiceType `json:"type,omitempty"`

	// Ports defines the ports the Service should expose.
	// If not specified, ports from the main component config might be used.
	// +optional
	Ports []PortSpec `json:"ports,omitempty"`

	// Annotations specific to the Service resource.
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`
}

ServiceSpecPart is a helper struct grouping common Service configuration fields. Used within specific component configs like RuntimeConfig.

func (*ServiceSpecPart) DeepCopy

func (in *ServiceSpecPart) DeepCopy() *ServiceSpecPart

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSpecPart.

func (*ServiceSpecPart) DeepCopyInto

func (in *ServiceSpecPart) DeepCopyInto(out *ServiceSpecPart)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StatefulSetUpdateStrategyPart

type StatefulSetUpdateStrategyPart = appsv1.StatefulSetUpdateStrategy

StatefulSetUpdateStrategyPart uses appsv1.StatefulSetUpdateStrategy directly.

type StorageSpec

type StorageSpec struct {
	// +optional
	Enabled bool `json:"enabled,omitempty"`
	// +optional
	Size *resource.Quantity `json:"size,omitempty"`
	// +optional
	VolumeClaimTemplateName string `json:"volumeClaimTemplateName,omitempty"`
	// +optional
	MountPath string `json:"mountPath,omitempty"`
	// +optional
	StorageClassName *string `json:"storageClassName,omitempty"`
	// +optional
	AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`
	// +optional
	DataSubpath *string `json:"dataSubpath,omitempty"`
}

StorageSpec defines the template for PersistentVolumeClaims created per replica (for StatefulSet).

func (*StorageSpec) DeepCopy

func (in *StorageSpec) DeepCopy() *StorageSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageSpec.

func (*StorageSpec) DeepCopyInto

func (in *StorageSpec) DeepCopyInto(out *StorageSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TolerationsSpec

type TolerationsSpec = corev1.Toleration

TolerationsSpec uses corev1.Toleration directly.

type WorkloadReference

type WorkloadReference struct {
	// +kubebuilder:validation:Required
	APIVersion string `json:"apiVersion"`
	// +kubebuilder:validation:Required
	Kind string `json:"kind"`
}

WorkloadReference indicates the target Kubernetes workload type.

func (*WorkloadReference) DeepCopy

func (in *WorkloadReference) DeepCopy() *WorkloadReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadReference.

func (*WorkloadReference) DeepCopyInto

func (in *WorkloadReference) DeepCopyInto(out *WorkloadReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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