Documentation
¶
Index ¶
- Constants
- Variables
- func ClusterHeadlessSvcName(name string, i int) string
- func ClusterNodeSvcName(clusterName string, shard, repl int) string
- func ClusterStatefulSetName(clusterName string, i int) string
- func ClusterStatefulSetSvcName(clusterName string, index string) string
- func GenerateClusterACLConfigMapName(name string) string
- func GenerateClusterACLOperatorSecretName(name string) string
- func GenerateClusterDefaultRedisUserName(name string) string
- func GenerateClusterOperatorsRedisUser(rc types.RedisClusterInstance, passwordsecret string) redismiddlewarealaudaiov1.RedisUser
- func GenerateClusterOperatorsRedisUserName(name string) string
- func GenerateClusterRedisUser(obj metav1.Object, u *user.User) *redismiddlewarealaudaiov1.RedisUser
- func GenerateClusterRedisUserName(instName, name string) string
- func GenerateClusterTLSSecretName(name string) string
- func GetClusterLabels(name string, extra map[string]string) map[string]string
- func GetClusterPassword(client client.Client, cluster *redisv1alpha1.DistributedRedisCluster) (string, error)
- func GetClusterStatefulsetLabels(name string, index int) map[string]string
- func GetClusterStatefulsetSelectorLabels(name string, index int) map[string]string
- func GetOldRedisClusterPassword(client client.Client, sts *appsv1.StatefulSet) (string, error)
- func IsPasswordChanged(cluster *redisv1alpha1.DistributedRedisCluster, sts *appsv1.StatefulSet) bool
- func IsPodTemplasteChanged(newTplSpec, oldTplSpec *v1.PodTemplateSpec, logger logr.Logger) bool
- func IsStatefulsetChanged(newSts, sts *appv1.StatefulSet, logger logr.Logger) bool
- func NewCertificate(drc *redisv1alpha1.DistributedRedisCluster) *certv1.Certificate
- func NewClusterOpSecret(drc *redisv1alpha1.DistributedRedisCluster) *corev1.Secret
- func NewClusterRole(obj client.Object) *rbacv1.ClusterRole
- func NewClusterRoleBinding(obj client.Object) *rbacv1.ClusterRoleBinding
- func NewConfigMapForCR(cluster types.RedisClusterInstance) (*corev1.ConfigMap, error)
- func NewHeadlessSvcForCR(cluster *redisv1alpha1.DistributedRedisCluster, index int) *corev1.Service
- func NewNodeportSvc(cluster *redisv1alpha1.DistributedRedisCluster, name string, ...) *corev1.Service
- func NewPodDisruptionBudgetForCR(cluster *redisv1alpha1.DistributedRedisCluster, index int) *policyv1.PodDisruptionBudget
- func NewPodService(cluster *redisv1alpha1.DistributedRedisCluster, name string, ...) *corev1.Service
- func NewRedisClusterDetailedStatusConfigMap(inst types.RedisClusterInstance, ...) (*corev1.ConfigMap, error)
- func NewRole(obj client.Object) *rbacv1.Role
- func NewRoleBinding(obj client.Object) *rbacv1.RoleBinding
- func NewServiceAccount(obj client.Object) *corev1.ServiceAccount
- func NewServiceForCR(cluster *redisv1alpha1.DistributedRedisCluster) *corev1.Service
- func NewServiceMonitorForCR(cluster *redisv1alpha1.DistributedRedisCluster) *smv1.ServiceMonitor
- func NewServiceWithType(cluster *redisv1alpha1.DistributedRedisCluster, typ corev1.ServiceType, ...) *corev1.Service
- func NewStatefulSetForCR(c types.RedisClusterInstance, isAllACLSupported bool, index int) (*appsv1.StatefulSet, error)
- func ParsePodShardAndIndex(name string) (shard int, index int, err error)
- func ParseRenameConfigs(val string) (ret map[string]string, err error)
- func RedisConfigMapName(clusterName string) string
- func RedisNodePortSvcName(clusterName string) string
- func RedisProxySvcName(clusterName string) string
- func ShouldUpdateDetailedStatusConfigMap(cm *corev1.ConfigMap, status *v1alpha1.DistributedRedisClusterDetailedStatus) bool
- type RedisConfig
- type RedisConfigSettingRule
- type RedisConfigValues
Constants ¶
const ( RedisConfig_MaxMemory = "maxmemory" RedisConfig_MaxMemoryPolicy = "maxmemory-policy" RedisConfig_ClientOutputBufferLimit = "client-output-buffer-limit" RedisConfig_Save = "save" RedisConfig_RenameCommand = "rename-command" RedisConfig_Appendonly = "appendonly" RedisConfig_ReplDisklessSync = "repl-diskless-sync" )
const ( RedisInstanceServiceAccountName = "redis-instance-account" RedisInstanceRoleName = "redis-instance-role" RedisInstanceRoleBindingName = "redis-instance-rolebinding" )
const ( DefaultScrapInterval = "60s" DefaultScrapeTimeout = "10s" )
const ( DefaultRedisServerPort = 6379 DefaultRedisServerBusPort = 16379 GenericKey = "redis.kun" LabelClusterName = GenericKey + "/name" StatefulSetLabel = "statefulSet" // Container CheckContainerName = "init" ServerContainerName = "redis" ExporterContainerName = "exporter" ConfigSyncContainerName = "sidecar" RedisDataContainerPortName = "client" // Volume RedisStorageVolumeName = "redis-data" RedisTempVolumeName = "temp" RedisOperatorPasswordVolumeName = "operator-password" ConfigVolumeName = "conf" RedisTLSVolumeName = "redis-tls" RedisOptVolumeName = "redis-opt" // Mount path StorageVolumeMountPath = "/data" OperatorPasswordVolumeMountPath = "/account" ConfigVolumeMountPath = "/conf" TLSVolumeMountPath = "/tls" RedisOptVolumeMountPath = "/opt" RedisTmpVolumeMountPath = "/tmp" // Env OperatorUsername = "OPERATOR_USERNAME" OperatorSecretName = "OPERATOR_SECRET_NAME" PrometheusExporterPortNumber = 9100 PrometheusExporterTelemetryPath = "/metrics" )
const ( ProbeDelaySeconds = 30 DefaultTerminationGracePeriodSeconds int64 = 300 )
const (
PasswordENV = "REDIS_PASSWORD"
)
const (
RedisClusterServiceMonitorName = "redis-cluster"
)
const (
RedisConfKey = "redis.conf"
)
Variables ¶
var ForbidToRenameCommands = map[string]struct{}{
"config": {},
"cluster": {},
}
var RedisConfigRestartPolicy = map[string]RedisConfigSettingRule{ "include": Forbid, "loadmodule": Forbid, "bind": Forbid, "protected-mode": Forbid, "port": Forbid, "tls-port": Forbid, "tls-cert-file": Forbid, "tls-key-file": Forbid, "tls-ca-cert-file": Forbid, "tls-ca-cert-dir": Forbid, "unixsocket": Forbid, "unixsocketperm": Forbid, "daemonize": Forbid, "supervised": Forbid, "pidfile": Forbid, "logfile": Forbid, "syslog-enabled": Forbid, "syslog-ident": Forbid, "syslog-facility": Forbid, "always-show-logo": Forbid, "dbfilename": Forbid, "appendfilename": Forbid, "dir": Forbid, "slaveof": Forbid, "replicaof": Forbid, "gopher-enabled": Forbid, "aclfile": Forbid, "requirepass": Forbid, "masterauth": Forbid, "masteruser": Forbid, "slave-announce-ip": Forbid, "replica-announce-ip": Forbid, "slave-announce-port": Forbid, "replica-announce-port": Forbid, "cluster-enabled": Forbid, "cluster-config-file": Forbid, "tcp-backlog": RequireRestart, "databases": RequireRestart, "rename-command": RequireRestart, "rdbchecksum": RequireRestart, "io-threads": RequireRestart, "io-threads-do-reads": RequireRestart, }
Functions ¶
func ClusterHeadlessSvcName ¶
func ClusterNodeSvcName ¶
func ClusterStatefulSetName ¶
func GenerateClusterOperatorsRedisUser ¶
func GenerateClusterOperatorsRedisUser(rc types.RedisClusterInstance, passwordsecret string) redismiddlewarealaudaiov1.RedisUser
func GetClusterLabels ¶
GetClusterStaticLabels this labels are const, take care of modify this.
func GetClusterPassword ¶
func GetClusterPassword(client client.Client, cluster *redisv1alpha1.DistributedRedisCluster) (string, error)
GetClusterPassword return current redis cluster's password.
func GetClusterStatefulsetLabels ¶
GetClusterStatefulsetLabels this labels are const, take care of update this
func GetClusterStatefulsetSelectorLabels ¶
GetClusterStatefulsetSelectorLabels this labels are const, take care of update this
func GetOldRedisClusterPassword ¶
GetOldRedisClusterPassword return old redis cluster's password.
func IsPasswordChanged ¶
func IsPasswordChanged(cluster *redisv1alpha1.DistributedRedisCluster, sts *appsv1.StatefulSet) bool
IsPasswordChanged determine whether the password is changed.
func IsPodTemplasteChanged ¶
func IsPodTemplasteChanged(newTplSpec, oldTplSpec *v1.PodTemplateSpec, logger logr.Logger) bool
func IsStatefulsetChanged ¶
func IsStatefulsetChanged(newSts, sts *appv1.StatefulSet, logger logr.Logger) bool
IsStatefulsetChanged
func NewCertificate ¶
func NewCertificate(drc *redisv1alpha1.DistributedRedisCluster) *certv1.Certificate
NewCertificate
func NewClusterOpSecret ¶
func NewClusterOpSecret(drc *redisv1alpha1.DistributedRedisCluster) *corev1.Secret
func NewClusterRole ¶
func NewClusterRole(obj client.Object) *rbacv1.ClusterRole
func NewClusterRoleBinding ¶
func NewClusterRoleBinding(obj client.Object) *rbacv1.ClusterRoleBinding
func NewConfigMapForCR ¶
func NewConfigMapForCR(cluster types.RedisClusterInstance) (*corev1.ConfigMap, error)
NewConfigMapForCR creates a new ConfigMap for the given Cluster
func NewHeadlessSvcForCR ¶
func NewHeadlessSvcForCR(cluster *redisv1alpha1.DistributedRedisCluster, index int) *corev1.Service
NewHeadlessSvcForCR creates a new headless service for the given Cluster.
func NewNodeportSvc ¶
func NewNodeportSvc(cluster *redisv1alpha1.DistributedRedisCluster, name string, labels map[string]string, port int32) *corev1.Service
func NewPodDisruptionBudgetForCR ¶
func NewPodDisruptionBudgetForCR(cluster *redisv1alpha1.DistributedRedisCluster, index int) *policyv1.PodDisruptionBudget
func NewPodService ¶
func NewPodService(cluster *redisv1alpha1.DistributedRedisCluster, name string, typ corev1.ServiceType, labels map[string]string, annotations map[string]string) *corev1.Service
func NewRedisClusterDetailedStatusConfigMap ¶
func NewRedisClusterDetailedStatusConfigMap(inst types.RedisClusterInstance, status *v1alpha1.DistributedRedisClusterDetailedStatus) (*corev1.ConfigMap, error)
NewRedisClusterDetailedStatusConfigMap creates a new ConfigMap for the given Cluster
func NewServiceAccount ¶
func NewServiceAccount(obj client.Object) *corev1.ServiceAccount
NewServiceAccount
func NewServiceForCR ¶
func NewServiceForCR(cluster *redisv1alpha1.DistributedRedisCluster) *corev1.Service
func NewServiceMonitorForCR ¶
func NewServiceMonitorForCR(cluster *redisv1alpha1.DistributedRedisCluster) *smv1.ServiceMonitor
func NewServiceWithType ¶
func NewServiceWithType(cluster *redisv1alpha1.DistributedRedisCluster, typ corev1.ServiceType, port int32) *corev1.Service
func NewStatefulSetForCR ¶
func NewStatefulSetForCR(c types.RedisClusterInstance, isAllACLSupported bool, index int) (*appsv1.StatefulSet, error)
NewStatefulSetForCR creates a new StatefulSet for the given Cluster.
func ParsePodShardAndIndex ¶
func RedisConfigMapName ¶
func RedisNodePortSvcName ¶
func RedisProxySvcName ¶
func ShouldUpdateDetailedStatusConfigMap ¶
func ShouldUpdateDetailedStatusConfigMap(cm *corev1.ConfigMap, status *v1alpha1.DistributedRedisClusterDetailedStatus) bool
Types ¶
type RedisConfig ¶
type RedisConfig map[string]RedisConfigValues
RedisConfig
func (RedisConfig) Diff ¶
func (o RedisConfig) Diff(n RedisConfig) (added, changed, deleted map[string]RedisConfigValues)
Diff return diff two n RedisConfig
type RedisConfigSettingRule ¶
type RedisConfigSettingRule string
const ( OK RedisConfigSettingRule = "OK" RequireRestart RedisConfigSettingRule = "Restart" Forbid RedisConfigSettingRule = "Forbid" )
type RedisConfigValues ¶
type RedisConfigValues []string
func (*RedisConfigValues) String ¶
func (v *RedisConfigValues) String() string