v1

package
v0.0.0-...-5079041 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package v1 contains API Schema definitions for the seaweed v1 API group +kubebuilder:object:generate=true +groupName=seaweed.seaweedfs.com

Index

Constants

View Source
const (
	GRPCPortDelta = 10000

	MasterHTTPPort = 9333
	VolumeHTTPPort = 8444
	FilerHTTPPort  = 8888
	FilerS3Port    = 8333

	MasterGRPCPort = MasterHTTPPort + GRPCPortDelta
	VolumeGRPCPort = VolumeHTTPPort + GRPCPortDelta
	FilerGRPCPort  = FilerHTTPPort + GRPCPortDelta
)

Constants

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "seaweed.seaweedfs.com", Version: "v1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type ComponentAccessor

type ComponentAccessor interface {
	ImagePullPolicy() corev1.PullPolicy
	ImagePullSecrets() []corev1.LocalObjectReference
	HostNetwork() bool
	Affinity() *corev1.Affinity
	PriorityClassName() *string
	NodeSelector() map[string]string
	Annotations() map[string]string
	Tolerations() []corev1.Toleration
	SchedulerName() string
	DNSPolicy() corev1.DNSPolicy
	BuildPodSpec() corev1.PodSpec
	Env() []corev1.EnvVar
	TerminationGracePeriodSeconds() *int64
	StatefulSetUpdateStrategy() appsv1.StatefulSetUpdateStrategyType
}

ComponentAccessor is the interface to access component details, which respects the cluster-level properties and component-level overrides +kubebuilder:object:root=false +kubebuilder:object:generate=false

type ComponentSpec

type ComponentSpec struct {
	// Version of the component. Override the cluster-level version if non-empty
	Version *string `json:"version,omitempty"`

	// ImagePullPolicy of the component. Override the cluster-level imagePullPolicy if present
	ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

	// Whether Hostnetwork of the component is enabled. Override the cluster-level setting if present
	HostNetwork *bool `json:"hostNetwork,omitempty"`

	// Affinity of the component. Override the cluster-level one if present
	Affinity *corev1.Affinity `json:"affinity,omitempty"`

	// PriorityClassName of the component. Override the cluster-level one if present
	PriorityClassName *string `json:"priorityClassName,omitempty"`

	// SchedulerName of the component. Override the cluster-level one if present
	SchedulerName *string `json:"schedulerName,omitempty"`

	// NodeSelector of the component. Merged into the cluster-level nodeSelector if non-empty
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// Annotations of the component. Merged into the cluster-level annotations if non-empty
	Annotations map[string]string `json:"annotations,omitempty"`

	// Tolerations of the component. Override the cluster-level tolerations if non-empty
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// List of environment variables to set in the container, like
	// v1.Container.Env.
	// Note that following env names cannot be used and may be overrided by operators
	// - NAMESPACE
	// - POD_IP
	// - POD_NAME
	Env []corev1.EnvVar `json:"env,omitempty"`

	// Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
	// Value must be non-negative integer. The value zero indicates delete immediately.
	// If this value is nil, the default grace period will be used instead.
	// The grace period is the duration in seconds after the processes running in the pod are sent
	// a termination signal and the time when the processes are forcibly halted with a kill signal.
	// Set this value longer than the expected cleanup time for your process.
	// Defaults to 30 seconds.
	TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`

	// StatefulSetUpdateStrategy indicates the StatefulSetUpdateStrategy that will be
	// employed to update Pods in the StatefulSet when a revision is made to
	// Template.
	StatefulSetUpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"statefulSetUpdateStrategy,omitempty"`
}

ComponentSpec is the base spec of each component, the fields should always accessed by the Basic<Component>Spec() method to respect the cluster-level properties

func (*ComponentSpec) DeepCopy

func (in *ComponentSpec) DeepCopy() *ComponentSpec

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

func (*ComponentSpec) DeepCopyInto

func (in *ComponentSpec) DeepCopyInto(out *ComponentSpec)

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

type FilerSpec

type FilerSpec struct {
	ComponentSpec               `json:",inline"`
	corev1.ResourceRequirements `json:",inline"`

	// The desired ready replicas
	// +kubebuilder:validation:Minimum=1
	Replicas int32        `json:"replicas"`
	Service  *ServiceSpec `json:"service,omitempty"`

	// Config in raw toml string
	Config *string `json:"config,omitempty"`

	// MetricsPort is the port that the prometheus metrics export listens on
	MetricsPort *int32 `json:"metricsPort,omitempty"`

	// Persistence mounts a volume for local filer data
	Persistence *PersistenceSpec `json:"persistence,omitempty"`

	MaxMB *int32 `json:"maxMB,omitempty"`
	// +kubebuilder:default:=true
	S3 bool `json:"s3,omitempty"`
}

FilerSpec is the spec for filers

func (*FilerSpec) DeepCopy

func (in *FilerSpec) DeepCopy() *FilerSpec

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

func (*FilerSpec) DeepCopyInto

func (in *FilerSpec) DeepCopyInto(out *FilerSpec)

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

type MasterSpec

type MasterSpec struct {
	ComponentSpec               `json:",inline"`
	corev1.ResourceRequirements `json:",inline"`

	// The desired ready replicas
	// +kubebuilder:validation:Minimum=1
	Replicas int32        `json:"replicas"`
	Service  *ServiceSpec `json:"service,omitempty"`

	// Config in raw toml string
	Config *string `json:"config,omitempty"`

	// MetricsPort is the port that the prometheus metrics export listens on
	MetricsPort *int32 `json:"metricsPort,omitempty"`

	VolumePreallocate  *bool   `json:"volumePreallocate,omitempty"`
	VolumeSizeLimitMB  *int32  `json:"volumeSizeLimitMB,omitempty"`
	GarbageThreshold   *string `json:"garbageThreshold,omitempty"`
	PulseSeconds       *int32  `json:"pulseSeconds,omitempty"`
	DefaultReplication *string `json:"defaultReplication,omitempty"`
	// only for testing
	ConcurrentStart *bool `json:"concurrentStart,omitempty"`
}

MasterSpec is the spec for masters

func (*MasterSpec) DeepCopy

func (in *MasterSpec) DeepCopy() *MasterSpec

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

func (*MasterSpec) DeepCopyInto

func (in *MasterSpec) DeepCopyInto(out *MasterSpec)

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

type PersistenceSpec

type PersistenceSpec struct {
	// +kubebuilder:default:=false
	Enabled bool `json:"enabled,omitempty"`

	// ExistingClaim is the name of an existing pvc to use
	ExistingClaim *string `json:"existingClaim,omitempty"`

	// The path the volume will be mounted at
	// +kubebuilder:default:="/data"
	MountPath *string `json:"mountPath,omitempty"`

	// The subdirectory of the volume to mount to
	// +kubebuilder:default:=""
	SubPath *string `json:"subPath,omitempty"`

	// accessModes contains the desired access modes the volume should have.
	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
	// +kubebuilder:default:={"ReadWriteOnce"}
	AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`

	// selector is a label query over volumes to consider for binding.
	// +optional
	Selector *metav1.LabelSelector `json:"selector,omitempty"`

	// resources represents the minimum resources the volume should have.
	// If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements
	// that are lower than previous value but must still be higher than capacity recorded in the
	// status field of the claim.
	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
	// +kubebuilder:default:={requests:{storage:"4Gi"}}
	Resources corev1.VolumeResourceRequirements `json:"resources,omitempty"`

	// volumeName is the binding reference to the PersistentVolume backing this claim.
	// +optional
	VolumeName string `json:"volumeName,omitempty"`

	// storageClassName is the name of the StorageClass required by the claim.
	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1
	// +optional
	StorageClassName *string `json:"storageClassName,omitempty"`

	// volumeMode defines what type of volume is required by the claim.
	// Value of Filesystem is implied when not included in claim spec.
	// +optional
	VolumeMode *corev1.PersistentVolumeMode `json:"volumeMode,omitempty"`

	// dataSource field can be used to specify either:
	// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
	// * An existing PVC (PersistentVolumeClaim)
	// If the provisioner or an external controller can support the specified data source,
	// it will create a new volume based on the contents of the specified data source.
	// If the AnyVolumeDataSource feature gate is enabled, this field will always have
	// the same contents as the DataSourceRef field.
	// +optional
	DataSource *corev1.TypedLocalObjectReference `json:"dataSource,omitempty"`
}

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 Seaweed

type Seaweed struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   SeaweedSpec   `json:"spec,omitempty"`
	Status SeaweedStatus `json:"status,omitempty"`
}

Seaweed is the Schema for the seaweeds API

func (*Seaweed) BaseFilerSpec

func (s *Seaweed) BaseFilerSpec() ComponentAccessor

BaseFilerSpec provides merged spec of filers

func (*Seaweed) BaseMasterSpec

func (s *Seaweed) BaseMasterSpec() ComponentAccessor

BaseMasterSpec provides merged spec of masters

func (*Seaweed) BaseVolumeSpec

func (s *Seaweed) BaseVolumeSpec() ComponentAccessor

BaseVolumeSpec provides merged spec of volumes

func (*Seaweed) DeepCopy

func (in *Seaweed) DeepCopy() *Seaweed

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

func (*Seaweed) DeepCopyInto

func (in *Seaweed) DeepCopyInto(out *Seaweed)

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

func (*Seaweed) DeepCopyObject

func (in *Seaweed) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Seaweed) Default

func (r *Seaweed) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*Seaweed) SetupWebhookWithManager

func (r *Seaweed) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*Seaweed) ValidateCreate

func (r *Seaweed) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*Seaweed) ValidateDelete

func (r *Seaweed) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*Seaweed) ValidateUpdate

func (r *Seaweed) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type SeaweedList

type SeaweedList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Seaweed `json:"items"`
}

SeaweedList contains a list of Seaweed

func (*SeaweedList) DeepCopy

func (in *SeaweedList) DeepCopy() *SeaweedList

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

func (*SeaweedList) DeepCopyInto

func (in *SeaweedList) DeepCopyInto(out *SeaweedList)

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

func (*SeaweedList) DeepCopyObject

func (in *SeaweedList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SeaweedSpec

type SeaweedSpec struct {

	// MetricsAddress is Prometheus gateway address
	MetricsAddress string `json:"metricsAddress,omitempty"`

	// Image
	Image string `json:"image,omitempty"`

	// Version
	Version string `json:"version,omitempty"`

	// Master
	Master *MasterSpec `json:"master,omitempty"`

	// Volume
	Volume *VolumeSpec `json:"volume,omitempty"`

	// Filer
	Filer *FilerSpec `json:"filer,omitempty"`

	// SchedulerName of pods
	SchedulerName string `json:"schedulerName,omitempty"`

	// Persistent volume reclaim policy
	PVReclaimPolicy *corev1.PersistentVolumeReclaimPolicy `json:"pvReclaimPolicy,omitempty"`

	// ImagePullPolicy of pods
	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images.
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

	// Whether enable PVC reclaim for orphan PVC left by statefulset scale-in
	EnablePVReclaim *bool `json:"enablePVReclaim,omitempty"`

	// Whether Hostnetwork is enabled for pods
	HostNetwork *bool `json:"hostNetwork,omitempty"`

	// Affinity of pods
	Affinity *corev1.Affinity `json:"affinity,omitempty"`

	// Base node selectors of Pods, components may add or override selectors upon this respectively
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// Base annotations of Pods, components may add or override selectors upon this respectively
	Annotations map[string]string `json:"annotations,omitempty"`

	// Base tolerations of Pods, components may add more tolerations upon this respectively
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// StatefulSetUpdateStrategy indicates the StatefulSetUpdateStrategy that will be
	// employed to update Pods in the StatefulSet when a revision is made to
	// Template.
	StatefulSetUpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"statefulSetUpdateStrategy,omitempty"`

	VolumeServerDiskCount int32 `json:"volumeServerDiskCount,omitempty"`

	// Ingresses
	HostSuffix *string `json:"hostSuffix,omitempty"`
}

SeaweedSpec defines the desired state of Seaweed

func (*SeaweedSpec) DeepCopy

func (in *SeaweedSpec) DeepCopy() *SeaweedSpec

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

func (*SeaweedSpec) DeepCopyInto

func (in *SeaweedSpec) DeepCopyInto(out *SeaweedSpec)

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

type SeaweedStatus

type SeaweedStatus struct {
}

SeaweedStatus defines the observed state of Seaweed

func (*SeaweedStatus) DeepCopy

func (in *SeaweedStatus) DeepCopy() *SeaweedStatus

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

func (*SeaweedStatus) DeepCopyInto

func (in *SeaweedStatus) DeepCopyInto(out *SeaweedStatus)

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

type ServiceSpec

type ServiceSpec struct {
	// Type of the real kubernetes service
	Type corev1.ServiceType `json:"type,omitempty"`

	// Additional annotations of the kubernetes service object
	Annotations map[string]string `json:"annotations,omitempty"`

	// LoadBalancerIP is the loadBalancerIP of service
	LoadBalancerIP *string `json:"loadBalancerIP,omitempty"`

	// ClusterIP is the clusterIP of service
	ClusterIP *string `json:"clusterIP,omitempty"`
}

ServiceSpec is a subset of the original k8s spec

func (*ServiceSpec) DeepCopy

func (in *ServiceSpec) DeepCopy() *ServiceSpec

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

func (*ServiceSpec) DeepCopyInto

func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec)

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

type VolumeSpec

type VolumeSpec struct {
	ComponentSpec               `json:",inline"`
	corev1.ResourceRequirements `json:",inline"`

	// The desired ready replicas
	// +kubebuilder:validation:Minimum=1
	Replicas int32        `json:"replicas"`
	Service  *ServiceSpec `json:"service,omitempty"`

	StorageClassName *string `json:"storageClassName,omitempty"`

	// MetricsPort is the port that the prometheus metrics export listens on
	MetricsPort *int32 `json:"metricsPort,omitempty"`

	CompactionMBps      *int32 `json:"compactionMBps,omitempty"`
	FileSizeLimitMB     *int32 `json:"fileSizeLimitMB,omitempty"`
	FixJpgOrientation   *bool  `json:"fixJpgOrientation,omitempty"`
	IdleTimeout         *int32 `json:"idleTimeout,omitempty"`
	MaxVolumeCounts     *int32 `json:"maxVolumeCounts,omitempty"`
	MinFreeSpacePercent *int32 `json:"minFreeSpacePercent,omitempty"`
}

VolumeSpec is the spec for volume servers

func (*VolumeSpec) DeepCopy

func (in *VolumeSpec) DeepCopy() *VolumeSpec

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

func (*VolumeSpec) DeepCopyInto

func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec)

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

Jump to

Keyboard shortcuts

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