v1alpha1

package
v0.0.0-...-24f4e42 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the db v1alpha1 API group +kubebuilder:object:generate=true +groupName=db.ibm.com

Index

Constants

View Source
const (
	// ClusterNameLabelKey Label key for the ClusterName
	ClusterNameLabelKey string = "redis-operator.k8s.io/cluster-name"
	// PodSpecMD5LabelKey label key for the PodSpec MD5 hash
	PodSpecMD5LabelKey string = "redis-operator.k8s.io/podspec-md5"
	// UnknownZone label for unknown zone
	UnknownZone string = "unknown"
)
View Source
const (
	GroupName = "db.ibm.com"
	// ResourcePlural is the id to identify plural resource
	ResourcePlural = "redisclusters"
	// ResourceSingular represents the id for identify singular resource
	ResourceSingular = "rediscluster"
	// ResourceKind represent the resource kind
	ResourceKind = "RedisCluster"
	// ResourceVersion represent the resource version
	ResourceVersion = "v1alpha1"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: GroupName, Version: ResourceVersion}
	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func IsRedisClusterDefaulted

func IsRedisClusterDefaulted(rc *RedisCluster) bool

IsRedisClusterDefaulted check if the RedisCluster is already defaulted

func NewClient

func NewClient(cfg *rest.Config) (*rest.RESTClient, error)

Types

type ClusterStatus

type ClusterStatus string

ClusterStatus Redis Cluster status

const (
	// ClusterStatusOK ClusterStatus OK
	ClusterStatusOK ClusterStatus = "OK"
	// ClusterStatusKO ClusterStatus KO
	ClusterStatusKO ClusterStatus = "KO"
	// ClusterStatusScaling ClusterStatus Scaling
	ClusterStatusScaling ClusterStatus = "Scaling"
	// ClusterStatusRebalancing ClusterStatus Rebalancing
	ClusterStatusRebalancing ClusterStatus = "Rebalancing"
	// ClusterStatusRollingUpdate ClusterStatus RollingUpdate
	ClusterStatusRollingUpdate ClusterStatus = "RollingUpdate"
)

type Migration

type Migration struct {
	// Number of keys to get from a single slot during each migration iteration
	KeyBatchSize *int32 `json:"keyBatchSize,omitempty"`
	// Number of slots to to migrate on each iteration
	SlotBatchSize *int32 `json:"slotBatchSize,omitempty"`
	// Maximum idle time at any point during key migration
	IdleTimeoutMillis *int32 `json:"idleTimeoutMillis,omitempty"`
}

func (*Migration) DeepCopy

func (in *Migration) DeepCopy() *Migration

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

func (*Migration) DeepCopyInto

func (in *Migration) DeepCopyInto(out *Migration)

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 (or more) primaries on the same kubernetes node
	NodesPlacementInfoBestEffort NodesPlacementInfo = "BestEffort"
	// NodesPlacementInfoOptimal the cluster nodes placement is optimal,
	// it means one primary per kubernetes node
	NodesPlacementInfoOptimal NodesPlacementInfo = "Optimal"
)

type RedisCluster

type RedisCluster struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object's metadata.
	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec represents the desired RedisCluster specification
	Spec RedisClusterSpec `json:"spec,omitempty"`

	// Status represents the current RedisCluster status
	Status RedisClusterStatus `json:"status,omitempty"`
}

RedisCluster represents a Redis Cluster +kubebuilder:object:root=true +genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +k8s:openapi-gen=true +kubebuilder:resource:scope=Namespaced,shortName=rdc +kubebuilder:subresource:scale:specpath=.spec.numberOfPrimaries,statuspath=.status.cluster.numberOfPrimariesReady,selectorpath=.status.cluster.labelSelectorPath +kubebuilder:subresource:status

func DefaultRedisCluster

func DefaultRedisCluster(baseRedisCluster *RedisCluster) *RedisCluster

DefaultRedisCluster defaults RedisCluster

func (*RedisCluster) DeepCopy

func (in *RedisCluster) DeepCopy() *RedisCluster

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

func (*RedisCluster) DeepCopyInto

func (in *RedisCluster) DeepCopyInto(out *RedisCluster)

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

func (*RedisCluster) DeepCopyObject

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

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

type RedisClusterCondition

type RedisClusterCondition struct {
	// Type of workflow condition
	Type RedisClusterConditionType `json:"type"`
	// Status of the condition, one of True, False, Unknown.
	Status kapiv1.ConditionStatus `json:"status"`
	// Last time the condition was checked.
	LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"`
	// Last time the condition transited from one status to another.
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	// (brief) reason for the condition's last transition.
	Reason string `json:"reason,omitempty"`
	// Human-readable message indicating details about last transition.
	Message string `json:"message,omitempty"`
}

RedisClusterCondition represent the condition of the RedisCluster

func (*RedisClusterCondition) DeepCopy

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

func (*RedisClusterCondition) DeepCopyInto

func (in *RedisClusterCondition) DeepCopyInto(out *RedisClusterCondition)

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

type RedisClusterConditionType

type RedisClusterConditionType string

RedisClusterConditionType is the type of RedisClusterCondition

const (
	// RedisClusterOK means the RedisCluster is in a good shape
	RedisClusterOK RedisClusterConditionType = "ClusterOK"
	// RedisClusterScaling means the RedisCluster is currently in a scaling stage
	RedisClusterScaling RedisClusterConditionType = "Scaling"
	// RedisClusterRebalancing means the RedisCluster is currently rebalancing slots and keys
	RedisClusterRebalancing RedisClusterConditionType = "Rebalancing"
	// RedisClusterRollingUpdate means the RedisCluster is currently performing a rolling update of its nodes
	RedisClusterRollingUpdate RedisClusterConditionType = "RollingUpdate"
)

type RedisClusterList

type RedisClusterList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata
	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
	metav1.ListMeta `json:"metadata,omitempty"`

	// Items is the list of RedisCluster
	Items []RedisCluster `json:"items"`
}

RedisClusterList implements list of RedisCluster. +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*RedisClusterList) DeepCopy

func (in *RedisClusterList) DeepCopy() *RedisClusterList

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

func (*RedisClusterList) DeepCopyInto

func (in *RedisClusterList) DeepCopyInto(out *RedisClusterList)

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

func (*RedisClusterList) DeepCopyObject

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

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

type RedisClusterNode

type RedisClusterNode struct {
	ID         string               `json:"id"`
	Role       RedisClusterNodeRole `json:"role"`
	Zone       string               `json:"zone"`
	IP         string               `json:"ip"`
	Port       string               `json:"port"`
	Slots      []string             `json:"slots,omitempty"`
	PrimaryRef string               `json:"primaryRef,omitempty"`
	PodName    string               `json:"podName"`
	Pod        *kapiv1.Pod          `json:"-"`
}

RedisClusterNode represent a RedisCluster node

func (*RedisClusterNode) DeepCopy

func (in *RedisClusterNode) DeepCopy() *RedisClusterNode

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

func (*RedisClusterNode) DeepCopyInto

func (in *RedisClusterNode) DeepCopyInto(out *RedisClusterNode)

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

func (RedisClusterNode) String

func (n RedisClusterNode) String() string

type RedisClusterNodeRole

type RedisClusterNodeRole string

RedisClusterNodeRole RedisCluster Node Role type

const (
	// RedisClusterNodeRolePrimary RedisCluster Primary node role
	RedisClusterNodeRolePrimary RedisClusterNodeRole = "Primary"
	// RedisClusterNodeRoleReplica RedisCluster Replica node role
	RedisClusterNodeRoleReplica RedisClusterNodeRole = "Replica"
	// RedisClusterNodeRoleHandshake RedisCluster Handshake node role
	RedisClusterNodeRoleHandshake RedisClusterNodeRole = "Handshake"
	// RedisClusterNodeRoleNone None node role
	RedisClusterNodeRoleNone RedisClusterNodeRole = "None"
)

type RedisClusterSpec

type RedisClusterSpec struct {
	// NumberOfPrimaries number of primary nodes
	NumberOfPrimaries *int32 `json:"numberOfPrimaries,omitempty"`

	// ReplicationFactor number of replica nodes per primary node
	ReplicationFactor *int32 `json:"replicationFactor,omitempty"`

	// ServiceName name used to create the kubernetes service that fronts the RedisCluster nodes.
	// If ServiceName is empty, the RedisCluster name will be used for creating the service.
	ServiceName string `json:"serviceName,omitempty"`

	// PodTemplate contains the pod specification that should run the redis-server process
	PodTemplate *kapiv1.PodTemplateSpec `json:"podTemplate,omitempty"`

	// ZoneAwareReplication spreads primary and replica nodes across all available zones
	ZoneAwareReplication *bool `json:"zoneAwareReplication,omitempty"`

	// RollingUpdate configuration for redis key migration
	RollingUpdate *RollingUpdate `json:"rollingUpdate,omitempty"`

	// Scaling configuration for redis key migration
	Scaling *Migration `json:"scaling,omitempty"`

	// Labels for created redis-cluster (deployment, rs, pod) (if any)
	AdditionalLabels map[string]string `json:"additionalLabels,omitempty"`
}

RedisClusterSpec contains RedisCluster specification

func (*RedisClusterSpec) DeepCopy

func (in *RedisClusterSpec) DeepCopy() *RedisClusterSpec

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

func (*RedisClusterSpec) DeepCopyInto

func (in *RedisClusterSpec) DeepCopyInto(out *RedisClusterSpec)

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

type RedisClusterState

type RedisClusterState struct {
	Status                     ClusterStatus  `json:"status"`
	NumberOfPrimaries          int32          `json:"numberOfPrimaries,omitempty"`
	NumberOfPrimariesReady     int32          `json:"numberOfPrimariesReady,omitempty"`
	NumberOfReplicasPerPrimary map[string]int `json:"numberOfReplicasPerPrimary,omitempty"`
	MinReplicationFactor       int32          `json:"minReplicationFactor,omitempty"`
	MaxReplicationFactor       int32          `json:"maxReplicationFactor,omitempty"`

	NodesPlacement NodesPlacementInfo `json:"nodesPlacementInfo,omitempty"`

	// In theory, we always have NumberOfPods > NumberOfRedisNodesRunning > NumberOfPodsReady
	NumberOfPods              int32 `json:"numberOfPods,omitempty"`
	NumberOfPodsReady         int32 `json:"numberOfPodsReady,omitempty"`
	NumberOfRedisNodesRunning int32 `json:"numberOfRedisNodesRunning,omitempty"`

	LabelSelectorPath string `json:"labelSelectorPath"`

	Nodes []RedisClusterNode `json:"nodes,omitempty"`
}

RedisClusterState represent the Redis Cluster status

func (*RedisClusterState) DeepCopy

func (in *RedisClusterState) DeepCopy() *RedisClusterState

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

func (*RedisClusterState) DeepCopyInto

func (in *RedisClusterState) DeepCopyInto(out *RedisClusterState)

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

func (RedisClusterState) String

func (s RedisClusterState) String() string

type RedisClusterStatus

type RedisClusterStatus struct {
	// Conditions represent the latest available observations of an object's current state.
	Conditions []RedisClusterCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
	// StartTime represents time when the workflow was acknowledged by the Workflow controller
	// It is not guaranteed to be set in happens-before order across separate operations.
	// It is represented in RFC3339 form and is in UTC.
	// StartTime doesn't consider startime of `ExternalReference`
	StartTime *metav1.Time `json:"startTime,omitempty"`
	// Cluster a view of the current RedisCluster
	Cluster RedisClusterState `json:"cluster"`
}

RedisClusterStatus contains RedisCluster status

func (*RedisClusterStatus) DeepCopy

func (in *RedisClusterStatus) DeepCopy() *RedisClusterStatus

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

func (*RedisClusterStatus) DeepCopyInto

func (in *RedisClusterStatus) DeepCopyInto(out *RedisClusterStatus)

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

type RollingUpdate

type RollingUpdate struct {
	Migration `json:",inline"`
	// KeyMigration whether or not to migrate keys during a rolling update
	KeyMigration *bool `json:"keyMigration,omitempty"`
	// Amount of time in between each slot batch iteration
	WarmingDelayMillis int32 `json:"warmingDelayMillis,omitempty"`
}

func (*RollingUpdate) DeepCopy

func (in *RollingUpdate) DeepCopy() *RollingUpdate

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

func (*RollingUpdate) DeepCopyInto

func (in *RollingUpdate) DeepCopyInto(out *RollingUpdate)

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