v1alpha1

package
v0.0.0-...-12521ac Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package v1alpha1 is the v1alpha1 version of the API. +groupName=anywhy.github.io

Index

Constants

View Source
const (
	// Replica means that redis cluster is master/slave
	Replica ClusterMode = "replica"
	// Cluster means redis cluster is shard mode
	Cluster ClusterMode = "cluster"

	// SentinelMemberType is sentinel container type
	SentinelMemberType MemberType = "sentinel"
	// RedisMemberType is sentinel container type
	RedisMemberType MemberType = "redis"
	// UnknownMemberType is unknown container type
	UnknownMemberType MemberType = "unknown"
)

Variables

View Source
var (
	// SchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme applies all the stored functions to the scheme.
	AddToScheme = SchemeBuilder.AddToScheme

	// Scheme is the scheme instance of operator
	Scheme *runtime.Scheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: groupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type ClusterMode

type ClusterMode string

ClusterMode describes a redis cluster mode

type ContainerSpec

type ContainerSpec struct {
	Image           string               `json:"image,omitempty"`
	ImagePullPolicy corev1.PullPolicy    `json:"imagePullPolicy,omitempty"`
	Requests        *ResourceRequirement `json:"requests,omitempty"`
	Limits          *ResourceRequirement `json:"limits,omitempty"`
}

ContainerSpec is the container spec of a pod

func (*ContainerSpec) DeepCopy

func (in *ContainerSpec) DeepCopy() *ContainerSpec

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

func (*ContainerSpec) DeepCopyInto

func (in *ContainerSpec) DeepCopyInto(out *ContainerSpec)

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

type MemberPhase

type MemberPhase string

MemberPhase is the current state of member

const (
	// NormalPhase represents normal state of Redis cluster.
	NormalPhase MemberPhase = "Normal"
	// UpgradePhase represents the Upgrading state of Redis cluster.
	UpgradePhase MemberPhase = "Upgrading"
)

type MemberType

type MemberType string

MemberType represents member type

func (MemberType) String

func (mt MemberType) String() string

type PodAttributesSpec

type PodAttributesSpec struct {
	Affinity           *corev1.Affinity           `json:"affinity,omitempty"`
	NodeSelector       map[string]string          `json:"nodeSelector,omitempty"`
	Tolerations        []corev1.Toleration        `json:"tolerations,omitempty"`
	Annotations        map[string]string          `json:"annotations,omitempty"`
	HostNetwork        bool                       `json:"hostNetwork,omitempty"`
	PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
	PriorityClassName  string                     `json:"priorityClassName,omitempty"`
}

PodAttributesSpec is a spec of some general attributes of Server, Sentinel Pods

func (*PodAttributesSpec) DeepCopy

func (in *PodAttributesSpec) DeepCopy() *PodAttributesSpec

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

func (*PodAttributesSpec) DeepCopyInto

func (in *PodAttributesSpec) DeepCopyInto(out *PodAttributesSpec)

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

type RedisCluster

type RedisCluster struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines of the redis cluster
	Spec RedisClusterSpec `json:"spec"`

	// Most recently observed status of the redis cluster
	Status RedisClusterStatus `json:"status"`
}

RedisCluster is a redis cluster control's spec

func (*RedisCluster) AllSentinelPodsStarted

func (rc *RedisCluster) AllSentinelPodsStarted() bool

AllSentinelPodsStarted sentinel is ok

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.

func (*RedisCluster) RedisAllPodsStarted

func (rc *RedisCluster) RedisAllPodsStarted() bool

RedisAllPodsStarted redis all pod started

func (*RedisCluster) RedisRealReplicas

func (rc *RedisCluster) RedisRealReplicas() int32

RedisRealReplicas redis real replicas

func (*RedisCluster) ReplicaUpgrading

func (rc *RedisCluster) ReplicaUpgrading() bool

ReplicaUpgrading return replica cluster is Upgrading status

func (*RedisCluster) ShoudEnableSentinel

func (rc *RedisCluster) ShoudEnableSentinel() bool

ShoudEnableSentinel sentinel is enable

type RedisClusterList

type RedisClusterList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []RedisCluster `json:"items"`
}

RedisClusterList is Redis cluster list

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 RedisClusterSpec

type RedisClusterSpec struct {
	// Mode choose from /replica/cluster
	Mode          ClusterMode `json:"mode"`
	SchedulerName string      `json:"schedulerName,omitempty"`

	Redis    ServerSpec   `json:"redis"`
	Sentinel SentinelSpec `json:"sentinel,omitempty"`

	// Services list non-headless services type used in Redis
	Services        []Service                            `json:"services,omitempty"`
	PVReclaimPolicy corev1.PersistentVolumeReclaimPolicy `json:"pvReclaimPolicy,omitempty"`
}

RedisClusterSpec redis cluster attributes

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 RedisClusterStatus

type RedisClusterStatus struct {
	Redis    ServerStatus   `json:"redis,omitempty"`
	Sentinel SentinelStatus `json:"sentinel,omitempty"`
}

RedisClusterStatus represents the current status of a redis cluster.

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 RedisFailureMember

type RedisFailureMember struct {
	PodName   string      `json:"podName,omitempty"`
	CreatedAt metav1.Time `json:"createdAt,omitempty"`
}

RedisFailureMember is the redis cluster failure member information

func (*RedisFailureMember) DeepCopy

func (in *RedisFailureMember) DeepCopy() *RedisFailureMember

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

func (*RedisFailureMember) DeepCopyInto

func (in *RedisFailureMember) DeepCopyInto(out *RedisFailureMember)

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

type RedisMember

type RedisMember struct {
	Name   string `json:"name"`
	ID     string `json:"id"`
	Role   string `json:"role"`
	Health bool   `json:"health"`
	// Last time the health transitioned from one to another.
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}

RedisMember redis server

func (*RedisMember) DeepCopy

func (in *RedisMember) DeepCopy() *RedisMember

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

func (*RedisMember) DeepCopyInto

func (in *RedisMember) DeepCopyInto(out *RedisMember)

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

type ResourceRequirement

type ResourceRequirement struct {
	// CPU is how many cores a pod requires
	CPU string `json:"cpu,omitempty"`
	// Memory is how much memory a pod requires
	Memory string `json:"memory,omitempty"`
	// Storage is storage size a pod requires
	Storage string `json:"storage,omitempty"`
}

ResourceRequirement is resource requirements for a pod

func (*ResourceRequirement) DeepCopy

func (in *ResourceRequirement) DeepCopy() *ResourceRequirement

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

func (*ResourceRequirement) DeepCopyInto

func (in *ResourceRequirement) DeepCopyInto(out *ResourceRequirement)

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

type SentinelSpec

type SentinelSpec struct {
	Replicas int32  `json:"replicas,omitempty"`
	Password string `json:"password,omitempty"`

	Requests *ResourceRequirement `json:"requests,omitempty"`
	Limits   *ResourceRequirement `json:"limits,omitempty"`
}

SentinelSpec redis sentinel attributes

func (*SentinelSpec) DeepCopy

func (in *SentinelSpec) DeepCopy() *SentinelSpec

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

func (*SentinelSpec) DeepCopyInto

func (in *SentinelSpec) DeepCopyInto(out *SentinelSpec)

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

type SentinelStatus

type SentinelStatus struct {
	Phase       MemberPhase             `json:"phase,omitempty"`
	StatefulSet *apps.StatefulSetStatus `json:"statefulset,omitempty"`
	Subscribed  bool                    `json:"subscribed,omitempty"`
}

SentinelStatus is redis sentinel status

func (*SentinelStatus) DeepCopy

func (in *SentinelStatus) DeepCopy() *SentinelStatus

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

func (*SentinelStatus) DeepCopyInto

func (in *SentinelStatus) DeepCopyInto(out *SentinelStatus)

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

type ServerSpec

type ServerSpec struct {
	ContainerSpec

	PodAttributesSpec

	// The number of cluster replicas
	Replicas int32 `json:"replicas"`

	StorageClassName string `json:"storageClassName,omitempty"`

	// The number of replicas for each master(redis cluster mode)
	ReplicationFactor *int32 `json:"replicationFactor,omitempty"`
}

ServerSpec redis instance attributes

func (*ServerSpec) DeepCopy

func (in *ServerSpec) DeepCopy() *ServerSpec

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

func (*ServerSpec) DeepCopyInto

func (in *ServerSpec) DeepCopyInto(out *ServerSpec)

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

type ServerStatus

type ServerStatus struct {
	Phase          MemberPhase                   `json:"phase,omitempty"`
	StatefulSet    *apps.StatefulSetStatus       `json:"statefulset,omitempty"`
	Members        map[string]RedisMember        `json:"members,omitempty"`
	FailureMembers map[string]RedisFailureMember `json:"failureMembers,omitempty"`
	Masters        []string                      `json:"masters,omitempty"`
	Synced         bool                          `json:"synced,omitempty"`
}

ServerStatus is cluster status

func (*ServerStatus) DeepCopy

func (in *ServerStatus) DeepCopy() *ServerStatus

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

func (*ServerStatus) DeepCopyInto

func (in *ServerStatus) DeepCopyInto(out *ServerStatus)

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

type Service

type Service struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

Service represent service type used in Redis

func (*Service) DeepCopy

func (in *Service) DeepCopy() *Service

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

func (*Service) DeepCopyInto

func (in *Service) DeepCopyInto(out *Service)

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