v1

package
v0.0.0-...-2ea7a04 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

+kubebuilder:object:generate=true +groupName=middleware.alauda.io

Copyright 2023 The RedisOperator Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	PauseAnnotationKey            = "app.cpaas.io/pause-timestamp"
	RedisClusterPVCSizeAnnotation = "middleware.alauda.io/storage_size"

	ConfigReplBacklogSizeKey = "repl-backlog-size"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "middleware.alauda.io", 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 ClusterReplicas

type ClusterReplicas struct {
	// This field specifies the number of master in Redis Cluster.
	// +kubebuilder:validation:Minimum=3
	Shard *int32 `json:"shard"`
	// This field specifies the number of replica nodes per Redis Cluster master.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=5
	Slave *int32 `json:"slave,omitempty"`
	// 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 []clusterv1.ClusterShardConfig `json:"shards,omitempty"`
}

func (*ClusterReplicas) DeepCopy

func (in *ClusterReplicas) DeepCopy() *ClusterReplicas

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

func (*ClusterReplicas) DeepCopyInto

func (in *ClusterReplicas) DeepCopyInto(out *ClusterReplicas)

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

type EmbeddedObjectMeta

type EmbeddedObjectMeta struct {
	// Name must be unique within a namespace. Is required when creating resources, although
	// some resources may allow a client to request the generation of an appropriate name
	// automatically. Name is primarily intended for creation idempotence and configuration
	// definition.
	// Cannot be updated.
	// More info: http://kubernetes.io/docs/user-guide/identifiers#names
	// +optional
	Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`

	// Namespace defines the space within each name must be unique. An empty namespace is
	// equivalent to the "default" namespace, but "default" is the canonical representation.
	// Not all objects are required to be scoped to a namespace - the value of this field for
	// those objects will be empty.
	//
	// Must be a DNS_LABEL.
	// Cannot be updated.
	// More info: http://kubernetes.io/docs/user-guide/namespaces
	// +optional
	Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`

	// Map of string keys and values that can be used to organize and categorize
	// (scope and select) objects. May match selectors of replication controllers
	// and services.
	// More info: http://kubernetes.io/docs/user-guide/labels
	// +optional
	Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"`

	// Annotations is an unstructured key value map stored with a resource that may be
	// set by external tools to store and retrieve arbitrary metadata. They are not
	// queryable and should be preserved when modifying objects.
	// More info: http://kubernetes.io/docs/user-guide/annotations
	// +optional
	Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"`
}

EmbeddedObjectMeta is an embedded subset of the fields included in k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta. Only fields which are relevant to embedded resources are included.

func (*EmbeddedObjectMeta) DeepCopy

func (in *EmbeddedObjectMeta) DeepCopy() *EmbeddedObjectMeta

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

func (*EmbeddedObjectMeta) DeepCopyInto

func (in *EmbeddedObjectMeta) DeepCopyInto(out *EmbeddedObjectMeta)

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

type InstanceAccess

type InstanceAccess struct {
	core.InstanceAccessBase `json:",inline"`

	// EnableNodePort defines if the nodeport is enabled
	// TODO: remove this field in 3.22
	// +kubebuilder:deprecated:warning="use serviceType instead"
	EnableNodePort bool `json:"enableNodePort,omitempty"`
}

InstanceAccess

func (*InstanceAccess) DeepCopy

func (in *InstanceAccess) DeepCopy() *InstanceAccess

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

func (*InstanceAccess) DeepCopyInto

func (in *InstanceAccess) DeepCopyInto(out *InstanceAccess)

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

type Redis

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

	Spec   RedisSpec   `json:"spec,omitempty"`
	Status RedisStatus `json:"status,omitempty"`
}

Redis is the Schema for the redis API

func (*Redis) DeepCopy

func (in *Redis) DeepCopy() *Redis

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

func (*Redis) DeepCopyInto

func (in *Redis) DeepCopyInto(out *Redis)

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

func (*Redis) DeepCopyObject

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

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

func (*Redis) Default

func (r *Redis) Default()

func (*Redis) PasswordIsEmpty

func (r *Redis) PasswordIsEmpty() bool

func (*Redis) RecoverStatusError

func (r *Redis) RecoverStatusError()

func (*Redis) SetMatchLabels

func (r *Redis) SetMatchLabels(labels map[string]string)

func (*Redis) SetPasswordSecret

func (r *Redis) SetPasswordSecret(secretName string)

func (*Redis) SetServiceName

func (r *Redis) SetServiceName(serviceName string)

func (*Redis) SetStatusError

func (r *Redis) SetStatusError(msg string)

func (*Redis) SetStatusInit

func (r *Redis) SetStatusInit()

func (*Redis) SetStatusPaused

func (r *Redis) SetStatusPaused()

func (*Redis) SetStatusReady

func (r *Redis) SetStatusReady()

func (*Redis) SetStatusRebalancing

func (r *Redis) SetStatusRebalancing(msg string)

func (*Redis) SetStatusUnReady

func (r *Redis) SetStatusUnReady(msg string)

func (*Redis) SetupWebhookWithManager

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

func (*Redis) ValidateCreate

func (r *Redis) ValidateCreate() (warns admission.Warnings, err error)

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

func (*Redis) ValidateDelete

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

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

func (*Redis) ValidateUpdate

func (r *Redis) ValidateUpdate(_ runtime.Object) (warns admission.Warnings, err error)

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

type RedisList

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

RedisList contains a list of Redis

func (*RedisList) DeepCopy

func (in *RedisList) DeepCopy() *RedisList

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

func (*RedisList) DeepCopyInto

func (in *RedisList) DeepCopyInto(out *RedisList)

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

func (*RedisList) DeepCopyObject

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

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

type RedisPatchSpec

type RedisPatchSpec struct {
	// Patch configuration for the Service created to serve traffic to the cluster.
	Services []*Service `json:"services,omitempty"`
}

Provides the ability to patch the generated manifest of several child resources.

func (*RedisPatchSpec) DeepCopy

func (in *RedisPatchSpec) DeepCopy() *RedisPatchSpec

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

func (*RedisPatchSpec) DeepCopyInto

func (in *RedisPatchSpec) DeepCopyInto(out *RedisPatchSpec)

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

type RedisPersistent

type RedisPersistent struct {
	// This field specifies the name of the storage class that should be used for the persistent storage of Redis
	// +kubebuilder:validation:Required
	StorageClassName string `json:"storageClassName"`
}

RedisPersistent defines the storage of Redis

func (*RedisPersistent) DeepCopy

func (in *RedisPersistent) DeepCopy() *RedisPersistent

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

func (*RedisPersistent) DeepCopyInto

func (in *RedisPersistent) DeepCopyInto(out *RedisPersistent)

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

type RedisPhase

type RedisPhase string

RedisPhase

const (
	// Initializing
	RedisPhaseInit RedisPhase = "Initializing"
	// Rebalancing
	RedisPhaseRebalancing RedisPhase = "Rebalancing"
	// Ready
	RedisPhaseReady RedisPhase = "Ready"
	// Error
	RedisPhaseError RedisPhase = "Error"
	// Paused
	RedisPhasePaused RedisPhase = "Paused"
)

type RedisReplicas

type RedisReplicas struct {
	// This field specifies the number of replicas for Redis Cluster
	Cluster *ClusterReplicas `json:"cluster,omitempty"`
	// This field specifies the number of replicas for Redis sentinel
	Sentinel *SentinelReplicas `json:"sentinel,omitempty"`
}

RedisReplicas defines the replicas of Redis

func (*RedisReplicas) DeepCopy

func (in *RedisReplicas) DeepCopy() *RedisReplicas

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

func (*RedisReplicas) DeepCopyInto

func (in *RedisReplicas) DeepCopyInto(out *RedisReplicas)

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

type RedisSpec

type RedisSpec struct {
	// Version supports 5.0, 6.0, 6.2, 7.0, 7.2, 7.4
	// +kubebuilder:validation:Enum="5.0";"6.0";"6.2";"7.0";"7.2";"7.4"
	Version string `json:"version"`
	// Arch supports cluster, sentinel
	// +kubebuilder:validation:Enum="cluster";"sentinel";"standalone"
	Arch core.Arch `json:"arch"`
	// Resources for setting resource requirements for the Pod Resources *v1.ResourceRequirements
	Resources *corev1.ResourceRequirements `json:"resources"`

	// Persistent for Redis
	Persistent *RedisPersistent `json:"persistent,omitempty"`
	// PersistentSize set the size of the persistent volume for the Redis
	PersistentSize *resource.Quantity `json:"persistentSize,omitempty"`
	// PasswordSecret set the Kubernetes Secret containing the Redis password PasswordSecret string,key `password`
	PasswordSecret string `json:"passwordSecret,omitempty"`
	// Replicas defines desired number of replicas for Redis
	Replicas *RedisReplicas `json:"replicas,omitempty"`
	// Affinity specifies the affinity for the Pod
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// AffinityPolicy support SoftAntiAffinity, AntiAffinityInSharding, AntiAffinity, Default SoftAntiAffinity
	// +optional
	// +kubebuilder:validation:Enum="SoftAntiAffinity";"AntiAffinityInSharding";"AntiAffinity"
	AffinityPolicy core.AffinityPolicy `json:"affinityPolicy,omitempty"`
	// NodeSelector specifies the node selector for the Pod
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
	// tolerations defines tolerations for the Pod
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	// SecurityContext sets security attributes for the Pod SecurityContex
	// +optional
	SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
	// CustomConfig defines custom Redis configuration settings. Some of these settings can be modified using the config set command at runtime.
	// +optional
	CustomConfig map[string]string `json:"customConfig,omitempty"`
	// PodAnnotations holds Kubernetes Pod annotations PodAnnotations
	// +optional
	PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
	//  Expose defines information for Redis nodePorts settings
	// +optional
	Expose InstanceAccess `json:"expose,omitempty"`
	// Exporter defines Redis exporter settings
	// +optional
	Exporter *redisfailoverv1.RedisExporter `json:"exporter,omitempty"`
	// EnableTLS enables TLS for Redis
	// +optional
	EnableTLS bool `json:"enableTLS,omitempty"`
	// IPFamilyPrefer sets the preferable IP family for the Pod and Redis
	// IPFamily represents the IP Family (IPv4 or IPv6). This type is used to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies).
	// +kubebuilder:validation:Enum="IPv4";"IPv6";""
	IPFamilyPrefer corev1.IPFamily `json:"ipFamilyPrefer,omitempty"`
	// Pause field indicates whether Redis is paused.
	// +optional
	Pause bool `json:"pause,omitempty"`

	// Sentinel defines Sentinel configuration settings Sentinel
	// +optional
	Sentinel *redisfailoverv1.SentinelSettings `json:"sentinel,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"`

	// UpgradeOption defines the upgrade strategy for the Redis instance.
	UpgradeOption *UpgradeOption `json:"upgradeOption,omitempty"`
	// Provides the ability to patch the generated manifest of several child resources.
	Patches *RedisPatchSpec `json:"patches,omitempty"`
}

RedisSpec defines the desired state of Redis

func (*RedisSpec) DeepCopy

func (in *RedisSpec) DeepCopy() *RedisSpec

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

func (*RedisSpec) DeepCopyInto

func (in *RedisSpec) DeepCopyInto(out *RedisSpec)

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

type RedisStatus

type RedisStatus struct {
	// Phase indicates whether all the resource for the instance is ok.
	// Values are as below:
	//   Initializing - Resource is in Initializing or Reconcile
	//   Ready        - All resources is ok. In most cases, Ready means the cluster is ok to use
	//   Error        - Error found when do resource init
	Phase RedisPhase `json:"phase,omitempty"`
	// This field contains an additional message for the instance's status
	Message string `json:"message,omitempty"`
	// The name of the kubernetes Secret that contains Redis password.
	PasswordSecretName string `json:"passwordSecretName,omitempty"`
	// The name of the kubernetes Service for Redis
	ServiceName string `json:"serviceName,omitempty"`
	// Matching labels selector for Redis
	MatchLabels map[string]string `json:"matchLabels,omitempty"`
	// ClusterNodes redis nodes info
	ClusterNodes []core.RedisNode `json:"clusterNodes,omitempty"`
	// Restored indicates whether the instance has been restored from a backup.
	// if the instance is set to restore from a backup, when the restore is completed, the restored field will be set to true.
	Restored bool `json:"restored,omitempty"`
	// LastShardCount indicates the last number of shards in the Redis Cluster.
	LastShardCount int32 `json:"lastShardCount,omitempty"`
	// LastVersion indicates the last version of the Redis instance.
	LastVersion string `json:"lastVersion,omitempty"`

	// UpgradeStatus indicates the status of the bundle upgrade.
	UpgradeStatus UpgradeStatus `json:"upgradeStatus,omitempty"`
	// DetailedStatusRef detailed status resource ref
	DetailedStatusRef *corev1.ObjectReference `json:"detailedStatusRef,omitempty"`
}

RedisStatus defines the observed state of Redis

func (*RedisStatus) DeepCopy

func (in *RedisStatus) DeepCopy() *RedisStatus

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

func (*RedisStatus) DeepCopyInto

func (in *RedisStatus) DeepCopyInto(out *RedisStatus)

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

type SentinelReplicas

type SentinelReplicas struct {
	// sentinel master nodes, only 1
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=1
	Master *int32 `json:"master"`
	// This field specifies the number of replica nodes.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=5
	Slave *int32 `json:"slave,omitempty"`
}

func (*SentinelReplicas) DeepCopy

func (in *SentinelReplicas) DeepCopy() *SentinelReplicas

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

func (*SentinelReplicas) DeepCopyInto

func (in *SentinelReplicas) DeepCopyInto(out *SentinelReplicas)

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

type SentinelSettings

type SentinelSettings struct {
	redisfailoverv1.RedisSentinelSpec `json:",inline"`
	// ExternalSentinel defines the sentinel reference
	ExternalSentinel *redisfailoverv1.SentinelReference `json:"external,omitempty"`
}

SentinelSettings defines the specification of the sentinel cluster

func (*SentinelSettings) DeepCopy

func (in *SentinelSettings) DeepCopy() *SentinelSettings

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

func (*SentinelSettings) DeepCopyInto

func (in *SentinelSettings) DeepCopyInto(out *SentinelSettings)

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

type Service

type Service struct {
	// +optional
	*EmbeddedObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

	// Spec defines the behavior of a Service.
	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
	// +optional
	Spec v1.ServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
}

Patch configuration for the Service created to serve traffic to the cluster. Allows for the manifest of the created Service to be overwritten with custom configuration.

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.

type UpgradeOption

type UpgradeOption struct {
	// CRVersion indicates the version to upgrade to.
	CRVersion string `json:"crVersion,omitempty"`
	// AutoUpgrade whether upgrade automatically
	AutoUpgrade *bool `json:"autoUpgrade,omitempty"`
}

UpgradeOption defines the upgrade strategy for the Redis instance.

func (*UpgradeOption) DeepCopy

func (in *UpgradeOption) DeepCopy() *UpgradeOption

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

func (*UpgradeOption) DeepCopyInto

func (in *UpgradeOption) DeepCopyInto(out *UpgradeOption)

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

type UpgradeStatus

type UpgradeStatus struct {
	// CRVersion indicates the version to upgrade to.
	CRVersion string `json:"crVersion,omitempty"`
	// Message indicates the message of the upgrade.
	Message string `json:"message,omitempty"`
}

UpgradeStatus indicates the status of the bundle upgrade.

func (*UpgradeStatus) DeepCopy

func (in *UpgradeStatus) DeepCopy() *UpgradeStatus

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

func (*UpgradeStatus) DeepCopyInto

func (in *UpgradeStatus) DeepCopyInto(out *UpgradeStatus)

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