v1alpha1

package
v0.0.0-...-52d723a Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the redis.kun v1alpha1 API group +kubebuilder:object:generate=true +groupName=redis.kun

Index

Constants

This section is empty.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "redis.kun", Version: "v1alpha1"}

	// 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 ClusterServiceStatus

type ClusterServiceStatus string

ClusterServiceStatus

const (
	ClusterInService    ClusterServiceStatus = "InService"
	ClusterOutOfService ClusterServiceStatus = "OutOfService"
)

type ClusterShardConfig

type ClusterShardConfig struct {
	// Slots is the slot range for the shard, eg: 0-1000,1002,1005-1100
	//+kubebuilder:validation:Pattern:=`^(\d{1,5}|(\d{1,5}-\d{1,5}))(,(\d{1,5}|(\d{1,5}-\d{1,5})))*$`
	Slots string `json:"slots,omitempty"`
}

func (*ClusterShardConfig) DeepCopy

func (in *ClusterShardConfig) DeepCopy() *ClusterShardConfig

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

func (*ClusterShardConfig) DeepCopyInto

func (in *ClusterShardConfig) DeepCopyInto(out *ClusterShardConfig)

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

type ClusterShards

type ClusterShards struct {
	// ID match the shard-id in redis 7.0
	Id string `json:"id,omitempty"`
	// Index the shard index
	Index int32 `json:"index"`
	// Slots records the slots status of this shard
	Slots []*ClusterShardsSlotStatus `json:"slots"`
}

ClusterShards

func (*ClusterShards) DeepCopy

func (in *ClusterShards) DeepCopy() *ClusterShards

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

func (*ClusterShards) DeepCopyInto

func (in *ClusterShards) DeepCopyInto(out *ClusterShards)

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

type ClusterShardsSlotStatus

type ClusterShardsSlotStatus struct {
	// Slots slots this shard holds or will holds
	Slots string `json:"slots,omitempty"`
	// Status the status of this status
	Status string `json:"status,omitempty"`
	// ShardIndex indicates the slots importing from or migrate to
	ShardIndex *int32 `json:"shardId"`
}

ClusterShardsSlotStatus

func (*ClusterShardsSlotStatus) DeepCopy

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

func (*ClusterShardsSlotStatus) DeepCopyInto

func (in *ClusterShardsSlotStatus) DeepCopyInto(out *ClusterShardsSlotStatus)

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

type ClusterStatus

type ClusterStatus string

ClusterStatus Redis Cluster status

const (
	// ClusterStatusOK ClusterStatus OK
	ClusterStatusOK ClusterStatus = "Healthy"
	// ClusterStatusKO ClusterStatus KO
	ClusterStatusKO ClusterStatus = "Failed"
	// ClusterStatusCreating ClusterStatus Creating
	ClusterStatusCreating = "Creating"
	// ClusterStatusRollingUpdate ClusterStatus RollingUpdate
	ClusterStatusRollingUpdate ClusterStatus = "RollingUpdate"
	// ClusterStatusRebalancing ClusterStatus rebalancing
	ClusterStatusRebalancing ClusterStatus = "Rebalancing"
	// clusterStatusPaused cluster status paused
	ClusterStatusPaused ClusterStatus = "Paused"
)

type DistributedRedisCluster

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

	Spec   DistributedRedisClusterSpec   `json:"spec,omitempty"`
	Status DistributedRedisClusterStatus `json:"status,omitempty"`
}

DistributedRedisCluster is the Schema for the distributedredisclusters API

func (*DistributedRedisCluster) DeepCopy

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

func (*DistributedRedisCluster) DeepCopyInto

func (in *DistributedRedisCluster) DeepCopyInto(out *DistributedRedisCluster)

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

func (*DistributedRedisCluster) DeepCopyObject

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

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

func (*DistributedRedisCluster) Default

func (ins *DistributedRedisCluster) Default() error

Init

type DistributedRedisClusterDetailedStatus

type DistributedRedisClusterDetailedStatus struct {
	// Status indicates current status of the cluster
	Status ClusterStatus `json:"status"`
	// Reason explains the status
	Reason string `json:"reason,omitempty"`
	// NumberOfMaster the number of master nodes
	NumberOfMaster int32 `json:"numberOfMaster,omitempty"`
	// MinReplicationFactor the min replication factor
	MinReplicationFactor int32 `json:"minReplicationFactor,omitempty"`
	// MaxReplicationFactor the max replication factor
	MaxReplicationFactor int32 `json:"maxReplicationFactor,omitempty"`
	// NodesPlacement the nodes placement mode
	NodesPlacement NodesPlacementInfo `json:"nodesPlacementInfo,omitempty"`
	// Nodes the redis cluster nodes
	Nodes []core.RedisDetailedNode `json:"nodes,omitempty"`
	// ClusterStatus the cluster status
	ClusterStatus ClusterServiceStatus `json:"clusterStatus,omitempty"`
	// Shards the cluster shards
	Shards []*ClusterShards `json:"shards,omitempty"`
}

DistributedRedisClusterDetailedStatus defines the detailed status of DistributedRedisCluster

func NewDistributedRedisClusterDetailedStatus

func NewDistributedRedisClusterDetailedStatus(status *DistributedRedisClusterStatus, nodes []core.RedisDetailedNode) *DistributedRedisClusterDetailedStatus

NewDistributedRedisClusterDetailedStatus create a new DistributedRedisClusterDetailedStatus

func (*DistributedRedisClusterDetailedStatus) DeepCopy

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

func (*DistributedRedisClusterDetailedStatus) DeepCopyInto

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

type DistributedRedisClusterList

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

DistributedRedisClusterList contains a list of DistributedRedisCluster

func (*DistributedRedisClusterList) DeepCopy

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

func (*DistributedRedisClusterList) DeepCopyInto

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

func (*DistributedRedisClusterList) DeepCopyObject

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

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

type DistributedRedisClusterSpec

type DistributedRedisClusterSpec struct {
	// Image is the Redis image
	Image string `json:"image,omitempty"`
	// ImagePullPolicy is the Redis image pull policy
	// TODO: reset the default value to IfNotPresent in 3.20
	ImagePullPolicy  corev1.PullPolicy             `json:"imagePullPolicy,omitempty"`
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
	Command          []string                      `json:"command,omitempty"`
	// Env is the environment variables
	// TODO: remove in 3.20
	Env []corev1.EnvVar `json:"env,omitempty"`
	// MasterSize is the number of master nodes
	// +kubebuilder:validation:Minimum=3
	MasterSize int32 `json:"masterSize"`
	// ClusterReplicas is the number of replicas for each master node
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=5
	ClusterReplicas int32 `json:"clusterReplicas"`
	// This field specifies the assignment of cluster shard slots.
	// this config is only works for new create instance, update will not take effect after instance is startup
	Shards []ClusterShardConfig `json:"shards,omitempty"`

	// ServiceName is the service name
	// TODO: remove in 3.20, this should not changed or specified
	ServiceName string `json:"serviceName,omitempty"`

	// Use this map to setup redis service. Most of the settings is key-value format.
	//
	// For client-output-buffer-limit and rename, the values is split by group.
	Config map[string]string `json:"config,omitempty"`

	// AffinityPolicy
	// +kubebuilder:validation:Enum=SoftAntiAffinity;AntiAffinityInSharding;AntiAffinity
	AffinityPolicy core.AffinityPolicy `json:"affinityPolicy,omitempty"`

	// Set RequiredAntiAffinity to force the master-slave node anti-affinity.
	//+kubebuilder:deprecatedversion:warning="redis.kun/v1alpha2 DistributedRedisCluster is deprecated, use AffinityPolicy instead"
	// TODO: remove in 3.20
	RequiredAntiAffinity bool `json:"requiredAntiAffinity,omitempty"`
	// Affinity
	// TODO: remove in 3.20
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// NodeSelector
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
	// Tolerations
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	SecurityContext          *corev1.PodSecurityContext   `json:"securityContext,omitempty"`
	ContainerSecurityContext *corev1.SecurityContext      `json:"containerSecurityContext,omitempty"`
	PodAnnotations           map[string]string            `json:"annotations,omitempty"`
	Storage                  *RedisStorage                `json:"storage,omitempty"`
	Resources                *corev1.ResourceRequirements `json:"resources,omitempty"`
	PasswordSecret           *corev1.LocalObjectReference `json:"passwordSecret,omitempty"`

	// Monitor
	// TODO: added an global button to controller wether to enable monitor
	Monitor *Monitor `json:"monitor,omitempty"`
	// ServiceMonitor
	//+kubebuilder:deprecatedversion
	// not support setup service monitor for each instance
	ServiceMonitor *RedisServiceMonitorSpec `json:"serviceMonitor,omitempty"`

	// Set backup schedule
	Backup core.RedisBackup `json:"backup,omitempty"`
	// Restore restore redis data from backup
	Restore core.RedisRestore `json:"restore,omitempty"`

	// EnableTLS
	EnableTLS bool `json:"enableTLS,omitempty"`

	// Expose config for service access
	// TODO: should rename Expose to Access
	Expose core.InstanceAccess `json:"expose,omitempty"`

	// IPFamilyPrefer the prefered IP family, enum: IPv4, IPv6
	IPFamilyPrefer corev1.IPFamily `json:"ipFamilyPrefer,omitempty"`

	// EnableActiveRedis enable active-active model for Redis
	EnableActiveRedis bool `json:"enableActiveRedis,omitempty"`
	// ServiceID the service id for activeredis
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=15
	ServiceID *int32 `json:"serviceID,omitempty"`
}

DistributedRedisClusterSpec defines the desired state of DistributedRedisCluster

func (*DistributedRedisClusterSpec) DeepCopy

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

func (*DistributedRedisClusterSpec) DeepCopyInto

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

type DistributedRedisClusterStatus

type DistributedRedisClusterStatus struct {
	// Status the status of the cluster
	Status ClusterStatus `json:"status"`
	// Reason the reason of the status
	Reason string `json:"reason,omitempty"`
	// NumberOfMaster the number of master nodes
	NumberOfMaster int32 `json:"numberOfMaster,omitempty"`
	// MinReplicationFactor the min replication factor
	MinReplicationFactor int32 `json:"minReplicationFactor,omitempty"`
	// MaxReplicationFactor the max replication factor
	MaxReplicationFactor int32 `json:"maxReplicationFactor,omitempty"`
	// NodesPlacement the nodes placement mode
	NodesPlacement NodesPlacementInfo `json:"nodesPlacementInfo,omitempty"`
	// Nodes the redis cluster nodes
	Nodes []core.RedisNode `json:"nodes,omitempty"`
	// ClusterStatus the cluster status
	ClusterStatus ClusterServiceStatus `json:"clusterStatus,omitempty"`
	// Shards the cluster shards
	Shards []*ClusterShards `json:"shards,omitempty"`

	// DetailedStatusRef detailed status resource ref
	DetailedStatusRef *corev1.ObjectReference `json:"detailedStatusRef,omitempty"`
}

DistributedRedisClusterStatus defines the observed state of DistributedRedisCluster

func (*DistributedRedisClusterStatus) DeepCopy

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

func (*DistributedRedisClusterStatus) DeepCopyInto

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

type Monitor

type Monitor struct {
	Image           string            `json:"image,omitempty"`
	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

	Prometheus *PrometheusSpec `json:"prometheus,omitempty"`
	// Arguments to the entrypoint.
	// The docker image's CMD is used if this is not provided.
	// Variable references $(VAR_NAME) are expanded using the container's environment. If a variable
	// cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax
	// can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded,
	// regardless of whether the variable exists or not.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
	// +optional
	Args []string `json:"args,omitempty"`
	// List of environment variables to set in the container.
	// Cannot be updated.
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
	// Compute Resources required by exporter container.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
	// +optional
	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
	// Security options the pod should run with.
	// More info: https://kubernetes.io/docs/concepts/policy/security-context/
	// More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
	// +optional
	SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
}

Monitor

func (*Monitor) DeepCopy

func (in *Monitor) DeepCopy() *Monitor

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

func (*Monitor) DeepCopyInto

func (in *Monitor) DeepCopyInto(out *Monitor)

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

type NodesPlacementInfo

type NodesPlacementInfo string

NodesPlacementInfo Redis Nodes placement mode information

const (
	// NodesPlacementInfoBestEffort the cluster nodes placement is in best effort,
	// it means you can have 2 masters (or more) on the same VM.
	NodesPlacementInfoBestEffort NodesPlacementInfo = "BestEffort"
	// NodesPlacementInfoOptimal the cluster nodes placement is optimal,
	// it means on master by VM
	NodesPlacementInfoOptimal NodesPlacementInfo = "Optimal"
)

type PrometheusSpec

type PrometheusSpec struct {
	// Port number for the exporter side car.
	Port int32 `json:"port,omitempty"`

	// Namespace of Prometheus. Service monitors will be created in this namespace.
	Namespace string `json:"namespace,omitempty"`
	// Labels are key value pairs that is used to select Prometheus instance via ServiceMonitor labels.
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Interval at which metrics should be scraped
	Interval string `json:"interval,omitempty"`
}

PrometheusSpec

this struct must be Deprecated, only port is used.

func (*PrometheusSpec) DeepCopy

func (in *PrometheusSpec) DeepCopy() *PrometheusSpec

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

func (*PrometheusSpec) DeepCopyInto

func (in *PrometheusSpec) DeepCopyInto(out *PrometheusSpec)

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

type RedisServiceMonitorSpec

type RedisServiceMonitorSpec struct {
	CustomMetricRelabelings bool                  `json:"customMetricRelabelings,omitempty"`
	MetricRelabelConfigs    []*smv1.RelabelConfig `json:"metricRelabelings,omitempty"`
	Interval                string                `json:"interval,omitempty"`
	ScrapeTimeout           string                `json:"scrapeTimeout,omitempty"`
}

RedisServiceMonitorSpec

func (*RedisServiceMonitorSpec) DeepCopy

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

func (*RedisServiceMonitorSpec) DeepCopyInto

func (in *RedisServiceMonitorSpec) DeepCopyInto(out *RedisServiceMonitorSpec)

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

type RedisStorage

type RedisStorage struct {
	Size        resource.Quantity `json:"size"`
	Type        StorageType       `json:"type,omitempty"`
	Class       string            `json:"class"`
	DeleteClaim bool              `json:"deleteClaim,omitempty"`
}

RedisStorage defines the structure used to store the Redis Data

func (*RedisStorage) DeepCopy

func (in *RedisStorage) DeepCopy() *RedisStorage

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

func (*RedisStorage) DeepCopyInto

func (in *RedisStorage) DeepCopyInto(out *RedisStorage)

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

type StorageType

type StorageType string

StorageType

const (
	PersistentClaim StorageType = "persistent-claim"
	Ephemeral       StorageType = "ephemeral"
)

Jump to

Keyboard shortcuts

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