Compare commits
14 Commits
9b5319cd30
...
0b22e8d4e0
Author | SHA1 | Date |
---|---|---|
|
0b22e8d4e0 | |
|
a2f7243c7f | |
|
6d294f5cbe | |
|
ed95c2c660 | |
|
fefd300cb9 | |
|
cc0c9b0f92 | |
|
6d2ec60c8e | |
|
aa8d2d9cf1 | |
|
a8ab85d4fa | |
|
d17ea8b4bf | |
|
4a41f558dc | |
|
7d97824d97 | |
|
65fafb74a7 | |
|
0b53f7730d |
226
CHANGELOG.md
226
CHANGELOG.md
|
@ -1,5 +1,229 @@
|
|||
### v0.21.0
|
||||
##### June 2025 Latest
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Round robin where to transfer cluster shards when scaling in a Redis Cluster #1412
|
||||
- Add auto max memory configuration for Redis instances #1411
|
||||
- Add bus port configuration for Redis cluster services #1406
|
||||
- Add automatic Redis pod role label synchronization for rediscluster #1404
|
||||
- RedisCluster observability #1392
|
||||
- Add liveness/readiness probes to values.yaml and templates #1378
|
||||
- Reduce unnecessary requeue when skip reconcile annotation exists #1374
|
||||
- RedisReplication observability, skip reconcile or not #1369
|
||||
- Add Redis Sentinel validation webhook for clusterSize #1361
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Resolve StatefulSet selector immutability issues #1382
|
||||
- Avoid sentinel restart after replication failover #1381
|
||||
- Define named probe port outside webhook block #1354
|
||||
|
||||
#### :tada: Refactors
|
||||
|
||||
- Reorganize manager agent cmd package #1383
|
||||
- Reorganize API structure and update paths #1363
|
||||
- Remove useless structure and refactor package #1362
|
||||
- Reorganize command structure for Redis operator #1351
|
||||
|
||||
### v0.20.2
|
||||
##### May 12, 2024
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Handle panic when retrieving StatefulSet in GetRedisNodesByRole #1330
|
||||
- VCT resize detection logic; add support for scaling out with new VCT size #1342
|
||||
- Service updated before Statefulset during Reconciliation #1348
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Add data assertion generation and enhance Redis configuration commands #1331
|
||||
- Add feature gates support for Redis Operator #1333
|
||||
- Migrate kubebuilder go.kubebuilder.io/v3 to go.kubebuilder.io/v4 #1340
|
||||
|
||||
#### :tada: Refactors
|
||||
|
||||
- Define container port for http probes in operator chart #1326
|
||||
- Enhance environment variable management and CI workflow #1315
|
||||
|
||||
### v0.20.1
|
||||
##### April 27, 2024
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Move VCT logic before diff calculation for stateful set #1322
|
||||
|
||||
### v0.20.0
|
||||
##### April 1, 2024
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Sentinel - support hostname resolve and announce #1247
|
||||
- Add redis agent with bootstrap configuration generation #1254
|
||||
- Implement comprehensive Redis configuration generation for agent bootstrap #1260
|
||||
- Added support for hostport to allow direct connection to the pod #1263
|
||||
- Add preStop hook for Redis Cluster failover #1264
|
||||
- Sentinel - announce-ip when resolve & announce are set #1271
|
||||
- Fix PVC resizing issue and refactor PVC resizing logic #1268
|
||||
- Add redisreplication observability #1274
|
||||
- Add recreate-stateful-strategy, orphan, background, foreground(default) #1286
|
||||
- Update Dockerfile and Makefile for unified operator binary #1294
|
||||
- Add support for anti affinity configuration in helm charts #1296
|
||||
- Guarantee to avoid bad master ip on Sentinel #1289
|
||||
- Add feature gates for sentinel configuration generation in init container #1300
|
||||
- Support redis configuration generation in init container #1303
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Replace hardcoded Redis port 6379 with configurable port from cr.Spec.Port #1261
|
||||
- Update references from master to main in docs and workflow files #1288
|
||||
- Svc finalizer removed #1297
|
||||
- Race condition resulting in permanently broken Redis cluster #1298
|
||||
|
||||
### v0.19.1
|
||||
##### February 19, 2024
|
||||
|
||||
#### :warning: Deprecation Notice
|
||||
|
||||
The v1beta1 API version will be removed in next release. Users are strongly encouraged to migrate to v1beta2, which offers enhanced features and improved stability.
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Add data-assert tool for Redis data management #1204
|
||||
- Check data consistent by external tool #1205
|
||||
- Added actions to publish charts to github container registry #1201
|
||||
- Add headless service configuration support #1219
|
||||
- Update redis-operator cert manager configuration #1220
|
||||
- Add additional service configuration with optional enable flag #1228
|
||||
- Enhance Redis HA and node scheduling strategy #1237
|
||||
- Add securityContext config in chart for redis-exporter #1238
|
||||
- Add dynamic Redis configuration support for Redis Cluster #1241
|
||||
- Configurable operator maxConcurrentReconciles #1242
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Skip-reconcile annotation still skipping reconcile even the value is false #1202
|
||||
- Make recreate statefulset only trigger when value true #1240
|
||||
- Improve pod label patching with error handling and retry mechanism #1231
|
||||
- Changed certificate serverName to pod+namespace #1221
|
||||
- Add missing topologySpreadConstraint on RedisCluster follower #1218
|
||||
|
||||
### v0.19.0
|
||||
##### January 12, 2024
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Add PDB and probes, drop unspecified acl in sentinel helm #1123
|
||||
- Add master/replica service to redis replication #1124
|
||||
- Add recreateStatefulSetOnUpdateInvalid helm chart value #1127
|
||||
- Enhance RedisReplication controller and CRD with additional status #1154
|
||||
- Support PDB in redisreplication #1166
|
||||
- Enhance RedisSentinel reconciliation logic and update workflow #1176
|
||||
- Support redis-cluster topologySpreadConstraints #1177
|
||||
- Add event recording functionality for RedisCluster controller #1182
|
||||
- Support topologySpreadConstraints in replication & sentinel #1184
|
||||
- Redis-cluster add podAntiAffinity #1180
|
||||
- Separate resources section for leader and follower #1188
|
||||
- Enhance RedisCluster resource management by introducing separate resource handling for leader and follower #1199
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- PDB value mapping in redis-sentinel #1136
|
||||
- Chart render error when enable initcontainer #1146
|
||||
- InitContainer enabled properties not define in template #1152
|
||||
- Redis-cluster unexpected downscaling #1173
|
||||
- Reduce the impact of Redis cluster intermediate states #1178
|
||||
- Label selector mapping on redisreplication pdb #1191
|
||||
|
||||
### v0.18.1
|
||||
##### November 7, 2024
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Support setting minReadySeconds on the stateful sets #1023
|
||||
- Add tolerations to operator chart #1051
|
||||
- Add image pull secret for redis operator #1053
|
||||
- Add service monitor to redis sentinel chart #1071
|
||||
- Add readiness/liveness probe to redis operator chart #1072
|
||||
- Upgrade redis/sentinel image to 7.0.15 #1099
|
||||
- Reconcile redissentinel only on master changed #1122
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Fix indentation error when enable additional config #1031
|
||||
- Fix field validate error when enable additional config for sentinel #1033
|
||||
- Fix unknown field error when upgrade chart #1034
|
||||
- Fix bad indentation on redis standalone additional configs #1040
|
||||
- Fix attempt to repair disconnected/failed master nodes before failing over #1105
|
||||
- Fix set controller probe endpoint handler #1121
|
||||
|
||||
### v0.18.0
|
||||
##### July 11, 2024
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Added redisReplicationPassword values to connect secured replication #1021
|
||||
- Added redis/redisreplication/redissentinel/rediscluster chart #1007
|
||||
- Added support for extra volume mounts for redis sentinel #994
|
||||
- Added automountServiceAccountToken values for deployment and serviceaccount #991
|
||||
- Added securityContext for exporter, initcontainers and sidecars #987
|
||||
- Added security context values in operator chart #973
|
||||
- Added rolling update sequence from leader to follower #966
|
||||
- Added support for configurable probe handlers #934
|
||||
- Added redis operator helm chart and release workflow #941
|
||||
- Added support for other container engines #947
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Added default port to enable `SENTINEL_PORT` environment #999
|
||||
- ReadyReplicas need to be checked in `IsStatefulSetReady` #993
|
||||
- watchNamespace value does not take effect in chart #990
|
||||
- Sentinel should not reconcile until replication cluster ready #964
|
||||
- Return ASAP after handling finalizer #940
|
||||
- Check redis replication after handling finalizer #936
|
||||
|
||||
### v0.17.0
|
||||
##### May 14, 2024
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- WATCH_NAMESPACE support multi namespace #919
|
||||
- Add workflow to publish image to ghcr #914
|
||||
- Probe use built-in, discarded healthcheck.sh #907
|
||||
- Implement redis cluster ready state #867
|
||||
- Add redisreplication status masterNode #849
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Runtime panic when delete rediscluster which disable persistent #922
|
||||
- Runtime panic when storage param is empty #887
|
||||
- Exporter can not connect to redis when enable tls #902
|
||||
- Update status if not equal #900
|
||||
- Should get the really leader count when scale in #885
|
||||
- ClusterSlaves result should be cut #884
|
||||
- Redis cluster update as scale out #882
|
||||
- Add common AddFinalizer for all api #858
|
||||
|
||||
### v0.16.0
|
||||
##### March 27, 2024
|
||||
|
||||
#### :tada: Features
|
||||
|
||||
- Added support for multiple CRDs and enhanced functionality
|
||||
- Improved test coverage and CI/CD pipeline
|
||||
- Enhanced Redis cluster management and scaling capabilities
|
||||
- Added support for custom Redis configurations
|
||||
- Implemented advanced security features
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
- Fixed various StatefulSet and service management issues
|
||||
- Resolved Redis cluster scaling problems
|
||||
- Fixed authentication and TLS connectivity issues
|
||||
- Improved error handling and logging
|
||||
|
||||
### v0.15.0
|
||||
##### July 17, 2023 Latest
|
||||
##### July 17, 2023
|
||||
|
||||
#### :beetle: Bug Fixes
|
||||
|
||||
|
|
9
Makefile
9
Makefile
|
@ -41,6 +41,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
|
|||
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
|
||||
KUTTL = $(LOCALBIN)/kuttl-$(KUTTL_VERSION)
|
||||
KIND = $(LOCALBIN)/kind-$(KIND_VERSION)
|
||||
CRD_REF_DOCS = $(LOCALBIN)/crd-ref-docs-$(CRD_REF_DOCS_VERSION)
|
||||
|
||||
# Tool Versions
|
||||
KUSTOMIZE_VERSION ?= v5.6.0
|
||||
|
@ -49,6 +50,7 @@ ENVTEST_VERSION ?= release-0.17
|
|||
GOLANGCI_LINT_VERSION ?= v2.2.2
|
||||
KUTTL_VERSION ?= 0.15.0
|
||||
KIND_VERSION ?= v0.24.0
|
||||
CRD_REF_DOCS_VERSION ?= v0.0.12
|
||||
|
||||
# Options for 'bundle-build'
|
||||
ifneq ($(origin CHANNELS), undefined)
|
||||
|
@ -134,6 +136,11 @@ vet:
|
|||
generate: controller-gen
|
||||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
|
||||
|
||||
# Generate API documentation
|
||||
.PHONY: generate-api-docs
|
||||
generate-api-docs:
|
||||
@hack/api-docs/build.sh
|
||||
|
||||
# Create a new builder instance for Docker Buildx with the specified platforms and set it as the current builder
|
||||
.PHONY: docker-create
|
||||
docker-create:
|
||||
|
@ -169,7 +176,7 @@ bundle-build:
|
|||
|
||||
# Rebuild all generated code
|
||||
.PHONY: codegen
|
||||
codegen: generate manifests sync-crds generate-dataAssert generate-metricsdocs
|
||||
codegen: generate manifests sync-crds generate-dataAssert generate-metricsdocs generate-api-docs
|
||||
|
||||
# Verify that codegen is up to date.
|
||||
.PHONY: verify-codegen
|
||||
|
|
12
README.md
12
README.md
|
@ -3,8 +3,8 @@
|
|||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://dev.azure.com/opstreedevops/DevOps/_apis/build/status/redis-operator/redis-operator?repoName=OT-CONTAINER-KIT%2Fredis-operator&branchName=main">
|
||||
<img src="https://dev.azure.com/opstreedevops/DevOps/_apis/build/status/redis-operator/redis-operator?repoName=OT-CONTAINER-KIT%2Fredis-operator&branchName=main" alt="Azure Pipelines">
|
||||
<a href="https://github.com/OT-CONTAINER-KIT/redis-operator/actions/workflows/ci.yaml">
|
||||
<img src="https://github.com/OT-CONTAINER-KIT/redis-operator/actions/workflows/ci.yaml/badge.svg" alt="CI Pipeline">
|
||||
</a>
|
||||
<a href="https://goreportcard.com/report/github.com/OT-CONTAINER-KIT/redis-operator">
|
||||
<img src="https://goreportcard.com/badge/github.com/OT-CONTAINER-KIT/redis-operator" alt="GoReportCard">
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
A Golang based redis operator that will make/oversee Redis standalone and cluster mode setup on top of the Kubernetes. It can create a redis cluster setup with best practices on Cloud as well as the Bare metal environment. Also, it provides an in-built monitoring capability using redis-exporter.
|
||||
|
||||
For documentation, please refer to <https://ot-redis-operator.netlify.app/>
|
||||
For documentation, please refer to <https://redis-operator.opstree.dev/>
|
||||
|
||||
Organizations that are using Redis Operator to manage their redis workload can be found [here](./USED_BY_ORGANIZATIONS.md). If your organization is also using Redis Operator, please free to add by creating a [pull request](https://github.com/OT-CONTAINER-KIT/redis-operator/pulls)
|
||||
|
||||
|
@ -53,12 +53,6 @@ Here the features which are supported by this operator:-
|
|||
- Ipv4 and Ipv6 support for redis setup
|
||||
- Detailed monitoring grafana dashboard
|
||||
|
||||
## Getting Started
|
||||
|
||||
If you want to deploy redis-operator from scratch to a local Minikube cluster, begin with the [Getting started](https://ot-container-kit.github.io/redis-operator/#/quickstart/quickstart) document. It will guide your through the setup step-by-step.
|
||||
|
||||
The configuration of Redis setup should be described in [CRD definitions](config/crd/bases). All the examples related to redis standalone and cluster setup can be found inside [example](./example) folder.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Redis operator requires a Kubernetes cluster of version `>=1.18.0`. If you have just started with Operators, it's highly recommended using the latest version of Kubernetes.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
|
@ -14,6 +14,7 @@ type KubernetesConfig struct {
|
|||
ExistingPasswordSecret *ExistingPasswordSecret `json:"redisSecret,omitempty"`
|
||||
ImagePullSecrets *[]corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
|
||||
UpdateStrategy appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`
|
||||
PersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
|
||||
Service *ServiceConfig `json:"service,omitempty"`
|
||||
IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"`
|
||||
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright 2020 Opstree Solutions.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Package v1beta2 contains common types used by Redis Operator APIs.
|
||||
// These types are shared across different Redis resource types.
|
||||
//
|
||||
// +groupName=redis.redis.opstreelabs.in
|
||||
package v1beta2
|
|
@ -18,9 +18,10 @@ limitations under the License.
|
|||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package api
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
|
@ -172,6 +173,11 @@ func (in *KubernetesConfig) DeepCopyInto(out *KubernetesConfig) {
|
|||
}
|
||||
}
|
||||
in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy)
|
||||
if in.PersistentVolumeClaimRetentionPolicy != nil {
|
||||
in, out := &in.PersistentVolumeClaimRetentionPolicy, &out.PersistentVolumeClaimRetentionPolicy
|
||||
*out = new(appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy)
|
||||
**out = **in
|
||||
}
|
||||
if in.Service != nil {
|
||||
in, out := &in.Service, &out.Service
|
||||
*out = new(ServiceConfig)
|
||||
|
|
|
@ -17,15 +17,84 @@ limitations under the License.
|
|||
package v1beta2
|
||||
|
||||
import (
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
)
|
||||
|
||||
//+kubebuilder:webhook:path=/mutate-core-v1-pod,mutating=true,failurePolicy=fail,sideEffects=None,groups=core,resources=pods,verbs=create,versions=v1,name=ot-mutate-pod.opstree.com,admissionReviewVersions=v1
|
||||
const (
|
||||
webhookPath = "/validate-redis-redis-opstreelabs-in-v1beta2-rediscluster"
|
||||
)
|
||||
|
||||
// log is for logging in this package.
|
||||
var redisclusterlog = logf.Log.WithName("rediscluster-v1beta2-validation")
|
||||
|
||||
// +kubebuilder:webhook:path=/validate-redis-redis-opstreelabs-in-v1beta2-rediscluster,mutating=false,failurePolicy=fail,sideEffects=None,groups=redis.redis.opstreelabs.in,resources=redisclusters,verbs=create;update,versions=v1beta2,name=validate-rediscluster.redis.opstreelabs.in,admissionReviewVersions=v1
|
||||
|
||||
// SetupWebhookWithManager will setup the manager
|
||||
func (r *RedisCluster) SetupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).
|
||||
For(r).
|
||||
Complete()
|
||||
}
|
||||
|
||||
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
var _ webhook.Validator = &RedisCluster{}
|
||||
|
||||
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *RedisCluster) ValidateCreate() (admission.Warnings, error) {
|
||||
redisclusterlog.Info("validate create", "name", r.Name)
|
||||
|
||||
return r.validate(nil)
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *RedisCluster) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
|
||||
redisclusterlog.Info("validate update", "name", r.Name)
|
||||
|
||||
return r.validate(old.(*RedisCluster))
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
|
||||
func (r *RedisCluster) ValidateDelete() (admission.Warnings, error) {
|
||||
redisclusterlog.Info("validate delete", "name", r.Name)
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// validate validates the Redis Cluster CR
|
||||
func (r *RedisCluster) validate(_ *RedisCluster) (admission.Warnings, error) {
|
||||
var errors field.ErrorList
|
||||
var warnings admission.Warnings
|
||||
|
||||
if r.Spec.Size == nil {
|
||||
return warnings, nil
|
||||
}
|
||||
|
||||
// Check if the Size is at least 3 for proper cluster operation
|
||||
if *r.Spec.Size < 3 {
|
||||
errors = append(errors, field.Invalid(
|
||||
field.NewPath("spec").Child("clusterSize"),
|
||||
*r.Spec.Size,
|
||||
"Redis cluster must have at least 3 shards",
|
||||
))
|
||||
}
|
||||
|
||||
if len(errors) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return nil, apierrors.NewInvalid(
|
||||
schema.GroupKind{Group: "redis.redis.opstreelabs.in", Kind: "RedisCluster"},
|
||||
r.Name,
|
||||
errors,
|
||||
)
|
||||
}
|
||||
|
||||
func (r *RedisCluster) WebhookPath() string {
|
||||
return webhookPath
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
package v1beta2_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/rediscluster/v1beta2"
|
||||
"github.com/OT-CONTAINER-KIT/redis-operator/internal/testutil/webhook"
|
||||
"github.com/stretchr/testify/require"
|
||||
admissionv1beta1 "k8s.io/api/admission/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestRedisClusterWebhook(t *testing.T) {
|
||||
cases := []webhook.ValidationWebhookTestCase{
|
||||
{
|
||||
Name: "success-create-v1beta2-rediscluster-validate-clusterSize-3",
|
||||
Operation: admissionv1beta1.Create,
|
||||
Object: func(t *testing.T, uid string) []byte {
|
||||
t.Helper()
|
||||
cluster := mkRedisCluster(uid)
|
||||
cluster.Spec.Size = ptr.To(int32(3))
|
||||
return marshal(t, cluster)
|
||||
},
|
||||
Check: webhook.ValidationWebhookSucceeded,
|
||||
},
|
||||
{
|
||||
Name: "failed-create-v1beta2-rediscluster-validate-clusterSize-2",
|
||||
Operation: admissionv1beta1.Create,
|
||||
Object: func(t *testing.T, uid string) []byte {
|
||||
t.Helper()
|
||||
cluster := mkRedisCluster(uid)
|
||||
cluster.Spec.Size = ptr.To(int32(2))
|
||||
return marshal(t, cluster)
|
||||
},
|
||||
Check: webhook.ValidationWebhookFailed("Redis cluster must have at least 3 shards"),
|
||||
},
|
||||
}
|
||||
|
||||
gvk := metav1.GroupVersionKind{
|
||||
Group: "redis.redis.opstreelabs.in",
|
||||
Version: "v1beta2",
|
||||
Kind: "RedisCluster",
|
||||
}
|
||||
|
||||
cluster := &v1beta2.RedisCluster{}
|
||||
webhook.RunValidationWebhookTests(t, gvk, cluster, cases...)
|
||||
}
|
||||
|
||||
func mkRedisCluster(uid string) *v1beta2.RedisCluster {
|
||||
return &v1beta2.RedisCluster{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("test-%s", uid),
|
||||
UID: types.UID(fmt.Sprintf("test-%s", uid)),
|
||||
},
|
||||
Spec: v1beta2.RedisClusterSpec{},
|
||||
}
|
||||
}
|
||||
|
||||
func marshal(t *testing.T, obj interface{}) []byte {
|
||||
t.Helper()
|
||||
bytes, err := json.Marshal(obj)
|
||||
require.NoError(t, err)
|
||||
return bytes
|
||||
}
|
|
@ -23,7 +23,7 @@ package v1beta2
|
|||
import (
|
||||
commonv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
|
||||
"k8s.io/api/core/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
|
|
|
@ -1564,6 +1564,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
@ -6085,6 +6106,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
@ -14779,6 +14821,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
@ -20277,6 +20340,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
apiVersion: v2
|
||||
name: redis-replication
|
||||
description: Provides easy redis setup definitions for Kubernetes services, and deployment.
|
||||
version: 0.16.7
|
||||
appVersion: "0.16.7"
|
||||
version: 0.16.8
|
||||
appVersion: "0.16.8"
|
||||
type: application
|
||||
engine: gotpl
|
||||
maintainers:
|
||||
|
|
|
@ -65,6 +65,9 @@ helm delete <my-release> --namespace <namespace>
|
|||
| initContainer.resources | object | `{}` | |
|
||||
| labels | object | `{}` | |
|
||||
| nodeSelector | object | `{}` | |
|
||||
| pdb.enabled | bool | `false` | |
|
||||
| pdb.maxUnavailable | string | `nil` | |
|
||||
| pdb.minAvailable | int | `1` | |
|
||||
| podSecurityContext.fsGroup | int | `1000` | |
|
||||
| podSecurityContext.runAsUser | int | `1000` | |
|
||||
| priorityClassName | string | `""` | |
|
||||
|
|
|
@ -95,4 +95,10 @@ spec:
|
|||
{{- if .Values.env }}
|
||||
env: {{ toYaml .Values.env | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.pdb.enabled }}
|
||||
pdb:
|
||||
enabled: {{ .Values.pdb.enabled }}
|
||||
minAvailable: {{ .Values.pdb.minAvailable }}
|
||||
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
|
||||
{{- end }}
|
||||
|
||||
|
|
|
@ -156,3 +156,8 @@ acl:
|
|||
env: []
|
||||
# - name: VAR_NAME
|
||||
# value: "value1"
|
||||
|
||||
pdb:
|
||||
enabled: false
|
||||
minAvailable: 1
|
||||
maxUnavailable: null
|
|
@ -1565,6 +1565,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
|
|
@ -715,6 +715,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
|
|
@ -1574,6 +1574,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
|
|
@ -1500,6 +1500,27 @@ spec:
|
|||
minReadySeconds:
|
||||
format: int32
|
||||
type: integer
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
description: |-
|
||||
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
|
||||
created from the StatefulSet VolumeClaimTemplates.
|
||||
properties:
|
||||
whenDeleted:
|
||||
description: |-
|
||||
WhenDeleted specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is deleted. The default policy
|
||||
of `Retain` causes PVCs to not be affected by StatefulSet deletion. The
|
||||
`Delete` policy causes those PVCs to be deleted.
|
||||
type: string
|
||||
whenScaled:
|
||||
description: |-
|
||||
WhenScaled specifies what happens to PVCs created from StatefulSet
|
||||
VolumeClaimTemplates when the StatefulSet is scaled down. The default
|
||||
policy of `Retain` causes PVCs to not be affected by a scaledown. The
|
||||
`Delete` policy causes the associated PVCs for any excess pods above
|
||||
the replica count to be deleted.
|
||||
type: string
|
||||
type: object
|
||||
redisSecret:
|
||||
description: ExistingPasswordSecret is the struct to access the
|
||||
existing secret
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: MutatingWebhookConfiguration
|
||||
kind: ValidatingWebhookConfiguration
|
||||
metadata:
|
||||
name: mutating-webhook-configuration
|
||||
name: validating-webhook-configuration
|
||||
webhooks:
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
|
@ -10,25 +10,20 @@ webhooks:
|
|||
service:
|
||||
name: webhook-service
|
||||
namespace: system
|
||||
path: /mutate-core-v1-pod
|
||||
path: /validate-redis-redis-opstreelabs-in-v1beta2-rediscluster
|
||||
failurePolicy: Fail
|
||||
name: ot-mutate-pod.opstree.com
|
||||
name: validate-rediscluster.redis.opstreelabs.in
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
- redis.redis.opstreelabs.in
|
||||
apiVersions:
|
||||
- v1
|
||||
- v1beta2
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- pods
|
||||
- redisclusters
|
||||
sideEffects: None
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingWebhookConfiguration
|
||||
metadata:
|
||||
name: validating-webhook-configuration
|
||||
webhooks:
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
|
|
|
@ -0,0 +1,637 @@
|
|||
---
|
||||
title: "API Reference Documentation"
|
||||
linkTitle: "API Docs"
|
||||
weight: 10
|
||||
date: 2025-01-27
|
||||
description: >
|
||||
Complete API reference documentation for Redis Operator CRDs
|
||||
---
|
||||
|
||||
# API Reference
|
||||
|
||||
## Packages
|
||||
- [redis.redis.opstreelabs.in/v1beta2](#redisredisopstreelabsinv1beta2)
|
||||
|
||||
|
||||
## redis.redis.opstreelabs.in/v1beta2
|
||||
|
||||
Package v1beta2 contains common types used by Redis Operator APIs.
|
||||
These types are shared across different Redis resource types.
|
||||
|
||||
|
||||
### Resource Types
|
||||
- [Redis](#redis)
|
||||
- [RedisCluster](#rediscluster)
|
||||
- [RedisReplication](#redisreplication)
|
||||
- [RedisSentinel](#redissentinel)
|
||||
|
||||
|
||||
|
||||
#### ACLConfig
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `secret` _[SecretVolumeSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#secretvolumesource-v1-core)_ | | | |
|
||||
|
||||
|
||||
#### AdditionalVolume
|
||||
|
||||
|
||||
|
||||
Additional Volume is provided by user that is mounted on the pods
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [ClusterStorage](#clusterstorage)
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
- [Storage](#storage)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `volume` _[Volume](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#volume-v1-core) array_ | | | |
|
||||
| `mountPath` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#volumemount-v1-core) array_ | | | |
|
||||
|
||||
|
||||
#### ClusterStorage
|
||||
|
||||
|
||||
|
||||
Node-conf needs to be added only in redis cluster
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `nodeConfVolume` _boolean_ | | false | |
|
||||
| `nodeConfVolumeClaimTemplate` _[PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#persistentvolumeclaim-v1-core)_ | | | |
|
||||
| `keepAfterDelete` _boolean_ | | | |
|
||||
| `volumeClaimTemplate` _[PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#persistentvolumeclaim-v1-core)_ | | | |
|
||||
| `volumeMount` _[AdditionalVolume](#additionalvolume)_ | | | |
|
||||
|
||||
|
||||
#### ExistingPasswordSecret
|
||||
|
||||
|
||||
|
||||
ExistingPasswordSecret is the struct to access the existing secret
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [KubernetesConfig](#kubernetesconfig)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `name` _string_ | | | |
|
||||
| `key` _string_ | | | |
|
||||
|
||||
|
||||
#### InitContainer
|
||||
|
||||
|
||||
|
||||
InitContainer for each Redis pods
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `enabled` _boolean_ | | | |
|
||||
| `image` _string_ | | | |
|
||||
| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#pullpolicy-v1-core)_ | | | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcerequirements-v1-core)_ | | | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
|
||||
| `command` _string array_ | | | |
|
||||
| `args` _string array_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
|
||||
|
||||
#### KubernetesConfig
|
||||
|
||||
|
||||
|
||||
KubernetesConfig will be the JSON struct for Basic Redis Config
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `image` _string_ | | | |
|
||||
| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#pullpolicy-v1-core)_ | | | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcerequirements-v1-core)_ | | | |
|
||||
| `redisSecret` _[ExistingPasswordSecret](#existingpasswordsecret)_ | | | |
|
||||
| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#localobjectreference-v1-core)_ | | | |
|
||||
| `updateStrategy` _[StatefulSetUpdateStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#statefulsetupdatestrategy-v1-apps)_ | | | |
|
||||
| `persistentVolumeClaimRetentionPolicy` _[StatefulSetPersistentVolumeClaimRetentionPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#statefulsetpersistentvolumeclaimretentionpolicy-v1-apps)_ | | | |
|
||||
| `service` _[ServiceConfig](#serviceconfig)_ | | | |
|
||||
| `ignoreAnnotations` _string array_ | | | |
|
||||
| `minReadySeconds` _integer_ | | | |
|
||||
|
||||
|
||||
#### Redis
|
||||
|
||||
|
||||
|
||||
Redis is the Schema for the redis API
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2` | | |
|
||||
| `kind` _string_ | `Redis` | | |
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
|
||||
| `spec` _[RedisSpec](#redisspec)_ | | | |
|
||||
|
||||
|
||||
#### RedisCluster
|
||||
|
||||
|
||||
|
||||
RedisCluster is the Schema for the redisclusters API
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2` | | |
|
||||
| `kind` _string_ | `RedisCluster` | | |
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
|
||||
| `spec` _[RedisClusterSpec](#redisclusterspec)_ | | | |
|
||||
|
||||
|
||||
#### RedisClusterSpec
|
||||
|
||||
|
||||
|
||||
RedisClusterSpec defines the desired state of RedisCluster
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisCluster](#rediscluster)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `clusterSize` _integer_ | | | |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | | | |
|
||||
| `hostNetwork` _boolean_ | | | |
|
||||
| `port` _integer_ | | 6379 | |
|
||||
| `clusterVersion` _string_ | | v7 | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | | | |
|
||||
| `redisLeader` _[RedisLeader](#redisleader)_ | | | |
|
||||
| `redisFollower` _[RedisFollower](#redisfollower)_ | | | |
|
||||
| `redisExporter` _[RedisExporter](#redisexporter)_ | | | |
|
||||
| `storage` _[ClusterStorage](#clusterstorage)_ | | | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#podsecuritycontext-v1-core)_ | | | |
|
||||
| `priorityClassName` _string_ | | | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcerequirements-v1-core)_ | | | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | | | |
|
||||
| `acl` _[ACLConfig](#aclconfig)_ | | | |
|
||||
| `initContainer` _[InitContainer](#initcontainer)_ | | | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | | | |
|
||||
| `serviceAccountName` _string_ | | | |
|
||||
| `persistenceEnabled` _boolean_ | | | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
|
||||
| `hostPort` _integer_ | | | |
|
||||
|
||||
|
||||
|
||||
|
||||
#### RedisConfig
|
||||
|
||||
|
||||
|
||||
RedisConfig defines the external configuration of Redis
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisFollower](#redisfollower)
|
||||
- [RedisFollower](#redisfollower)
|
||||
- [RedisLeader](#redisleader)
|
||||
- [RedisLeader](#redisleader)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `maxMemoryPercentOfLimit` _integer_ | MaxMemoryPercentOfLimit is the percentage of redis container memory limit to be used as maxmemory. | | Maximum: 100 <br />Minimum: 1 <br /> |
|
||||
| `dynamicConfig` _string array_ | | | |
|
||||
| `additionalRedisConfig` _string_ | | | |
|
||||
|
||||
|
||||
#### RedisExporter
|
||||
|
||||
|
||||
|
||||
RedisExporter interface will have the information for redis exporter related stuff
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `enabled` _boolean_ | | | |
|
||||
| `port` _integer_ | | 9121 | |
|
||||
| `image` _string_ | | | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcerequirements-v1-core)_ | | | |
|
||||
| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#pullpolicy-v1-core)_ | | | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
|
||||
|
||||
#### RedisFollower
|
||||
|
||||
|
||||
|
||||
RedisFollower interface will have the redis follower configuration
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `replicas` _integer_ | | | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | | | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#affinity-v1-core)_ | | | |
|
||||
| `pdb` _[RedisPodDisruptionBudget](#redispoddisruptionbudget)_ | | | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#toleration-v1-core)_ | | | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | | | |
|
||||
| `topologySpreadConstraints` _[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#topologyspreadconstraint-v1-core) array_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
| `terminationGracePeriodSeconds` _integer_ | | | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcerequirements-v1-core)_ | | | |
|
||||
|
||||
|
||||
#### RedisLeader
|
||||
|
||||
|
||||
|
||||
RedisLeader interface will have the redis leader configuration
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `replicas` _integer_ | | | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | | | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#affinity-v1-core)_ | | | |
|
||||
| `pdb` _[RedisPodDisruptionBudget](#redispoddisruptionbudget)_ | | | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#toleration-v1-core)_ | | | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | | | |
|
||||
| `topologySpreadConstraints` _[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#topologyspreadconstraint-v1-core) array_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
| `terminationGracePeriodSeconds` _integer_ | | | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcerequirements-v1-core)_ | | | |
|
||||
|
||||
|
||||
#### RedisPodDisruptionBudget
|
||||
|
||||
|
||||
|
||||
RedisPodDisruptionBudget configure a PodDisruptionBudget on the resource (leader/follower)
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisFollower](#redisfollower)
|
||||
- [RedisFollower](#redisfollower)
|
||||
- [RedisLeader](#redisleader)
|
||||
- [RedisLeader](#redisleader)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `enabled` _boolean_ | | | |
|
||||
| `minAvailable` _integer_ | | | |
|
||||
| `maxUnavailable` _integer_ | | | |
|
||||
|
||||
|
||||
#### RedisReplication
|
||||
|
||||
|
||||
|
||||
Redis is the Schema for the redis API
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2` | | |
|
||||
| `kind` _string_ | `RedisReplication` | | |
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
|
||||
| `spec` _[RedisReplicationSpec](#redisreplicationspec)_ | | | |
|
||||
|
||||
|
||||
#### RedisReplicationSpec
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisReplication](#redisreplication)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `clusterSize` _integer_ | | | |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | | | |
|
||||
| `redisExporter` _[RedisExporter](#redisexporter)_ | | | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | | | |
|
||||
| `storage` _[Storage](#storage)_ | | | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | | | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#podsecuritycontext-v1-core)_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
| `priorityClassName` _string_ | | | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#affinity-v1-core)_ | | | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#toleration-v1-core)_ | | | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | | | |
|
||||
| `pdb` _[RedisPodDisruptionBudget](#redispoddisruptionbudget)_ | | | |
|
||||
| `acl` _[ACLConfig](#aclconfig)_ | | | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `initContainer` _[InitContainer](#initcontainer)_ | | | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | | | |
|
||||
| `serviceAccountName` _string_ | | | |
|
||||
| `terminationGracePeriodSeconds` _integer_ | | | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
|
||||
| `topologySpreadConstraints` _[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#topologyspreadconstraint-v1-core) array_ | | | |
|
||||
| `hostPort` _integer_ | | | |
|
||||
|
||||
|
||||
#### RedisSentinel
|
||||
|
||||
|
||||
|
||||
Redis is the Schema for the redis API
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2` | | |
|
||||
| `kind` _string_ | `RedisSentinel` | | |
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
|
||||
| `spec` _[RedisSentinelSpec](#redissentinelspec)_ | | | |
|
||||
|
||||
|
||||
#### RedisSentinelConfig
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `additionalSentinelConfig` _string_ | | | |
|
||||
| `redisReplicationName` _string_ | | | |
|
||||
| `redisReplicationPassword` _[EnvVarSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvarsource-v1-core)_ | | | |
|
||||
| `masterGroupName` _string_ | | myMaster | |
|
||||
| `redisPort` _string_ | | 6379 | |
|
||||
| `quorum` _string_ | | 2 | |
|
||||
| `parallelSyncs` _string_ | | 1 | |
|
||||
| `failoverTimeout` _string_ | | 180000 | |
|
||||
| `downAfterMilliseconds` _string_ | | 30000 | |
|
||||
| `resolveHostnames` _string_ | | no | |
|
||||
| `announceHostnames` _string_ | | no | |
|
||||
|
||||
|
||||
#### RedisSentinelSpec
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisSentinel](#redissentinel)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `clusterSize` _integer_ | | 3 | Minimum: 1 <br /> |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | | | |
|
||||
| `redisExporter` _[RedisExporter](#redisexporter)_ | | | |
|
||||
| `redisSentinelConfig` _[RedisSentinelConfig](#redissentinelconfig)_ | | | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | | | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#podsecuritycontext-v1-core)_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
| `priorityClassName` _string_ | | | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#affinity-v1-core)_ | | | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#toleration-v1-core)_ | | | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | | | |
|
||||
| `pdb` _[RedisPodDisruptionBudget](#redispoddisruptionbudget)_ | | | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `initContainer` _[InitContainer](#initcontainer)_ | | | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | | | |
|
||||
| `serviceAccountName` _string_ | | | |
|
||||
| `terminationGracePeriodSeconds` _integer_ | | | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
|
||||
| `volumeMount` _[AdditionalVolume](#additionalvolume)_ | | | |
|
||||
| `topologySpreadConstraints` _[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#topologyspreadconstraint-v1-core) array_ | | | |
|
||||
| `hostPort` _integer_ | | | |
|
||||
|
||||
|
||||
#### RedisSpec
|
||||
|
||||
|
||||
|
||||
RedisSpec defines the desired state of Redis
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [Redis](#redis)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | | | |
|
||||
| `redisExporter` _[RedisExporter](#redisexporter)_ | | | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | | | |
|
||||
| `storage` _[Storage](#storage)_ | | | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | | | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#podsecuritycontext-v1-core)_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
| `priorityClassName` _string_ | | | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#affinity-v1-core)_ | | | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#toleration-v1-core)_ | | | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | | | |
|
||||
| `acl` _[ACLConfig](#aclconfig)_ | | | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core)_ | | | |
|
||||
| `initContainer` _[InitContainer](#initcontainer)_ | | | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | | | |
|
||||
| `serviceAccountName` _string_ | | | |
|
||||
| `terminationGracePeriodSeconds` _integer_ | | | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
|
||||
| `hostPort` _integer_ | | | |
|
||||
|
||||
|
||||
#### Service
|
||||
|
||||
|
||||
|
||||
Service is the struct to define the service type and its annotations
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [ServiceConfig](#serviceconfig)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `type` _string_ | | ClusterIP | Enum: [LoadBalancer NodePort ClusterIP] <br /> |
|
||||
| `additionalAnnotations` _object (keys:string, values:string)_ | | | |
|
||||
| `includeBusPort` _boolean_ | IncludeBusPort when set to true, it will add bus port to the service, such as 16379.<br />This field is only used for Redis cluster mode. | | |
|
||||
| `enabled` _boolean_ | | true | |
|
||||
|
||||
|
||||
#### ServiceConfig
|
||||
|
||||
|
||||
|
||||
ServiceConfig define the type of service to be created and its annotations
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [KubernetesConfig](#kubernetesconfig)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `serviceType` _string_ | | | Enum: [LoadBalancer NodePort ClusterIP] <br /> |
|
||||
| `annotations` _object (keys:string, values:string)_ | | | |
|
||||
| `includeBusPort` _boolean_ | IncludeBusPort when set to true, it will add bus port to the service, such as 16379.<br />This field is only used for Redis cluster mode. | | |
|
||||
| `headless` _[Service](#service)_ | Headless config for which suffix is -headless service | | |
|
||||
| `additional` _[Service](#service)_ | Additional config for which suffix is -additional service | | |
|
||||
|
||||
|
||||
#### Sidecar
|
||||
|
||||
|
||||
|
||||
Sidecar for each Redis pods
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `name` _string_ | | | |
|
||||
| `image` _string_ | | | |
|
||||
| `imagePullPolicy` _[PullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#pullpolicy-v1-core)_ | | | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#resourcerequirements-v1-core)_ | | | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#envvar-v1-core)_ | | | |
|
||||
| `mountPath` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#volumemount-v1-core)_ | | | |
|
||||
| `command` _string array_ | | | |
|
||||
| `ports` _[ContainerPort](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#containerport-v1-core)_ | | | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#securitycontext-v1-core)_ | | | |
|
||||
|
||||
|
||||
#### Storage
|
||||
|
||||
|
||||
|
||||
Storage is the inteface to add pvc and pv support in redis
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [ClusterStorage](#clusterstorage)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `keepAfterDelete` _boolean_ | | | |
|
||||
| `volumeClaimTemplate` _[PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#persistentvolumeclaim-v1-core)_ | | | |
|
||||
| `volumeMount` _[AdditionalVolume](#additionalvolume)_ | | | |
|
||||
|
||||
|
||||
#### TLSConfig
|
||||
|
||||
|
||||
|
||||
TLS Configuration for redis instances
|
||||
|
||||
|
||||
|
||||
_Appears in:_
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
| `ca` _string_ | | | |
|
||||
| `cert` _string_ | | | |
|
||||
| `key` _string_ | | | |
|
||||
| `secret` _[SecretVolumeSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#secretvolumesource-v1-core)_ | Reference to secret which contains the certificates | | |
|
||||
|
||||
|
|
@ -1,399 +0,0 @@
|
|||
---
|
||||
title: "Custom Resource Object API"
|
||||
linkTitle: "Custom Resource Object API"
|
||||
weight: 10
|
||||
date: 2022-11-02T00:19:19Z
|
||||
description: >
|
||||
CRD Schema details for Redis and Redis Cluster Reference API
|
||||
---
|
||||
|
||||
# Redis API Reference
|
||||
|
||||
This page documents the Redis API Schema definitions for the redis API group.
|
||||
|
||||
## Packages
|
||||
|
||||
- [redis.redis.opstreelabs.in/v1beta2](#redisredisopstreelabsinv1beta2)
|
||||
|
||||
## redis.redis.opstreelabs.in/v1beta2
|
||||
|
||||
Package v1beta2 contains API Schema definitions for the redis v1beta2 API group
|
||||
|
||||
### Annotations
|
||||
|
||||
Redis Operator supports the following annotations that can be added to Redis, RedisCluster, RedisReplication, and RedisSentinel resources:
|
||||
|
||||
| Annotation | Description | Default | Values |
|
||||
| --- | --- | --- | --- |
|
||||
| `redis.opstreelabs.in/recreate-statefulset` | Controls whether the StatefulSet should be recreated when changed | `false` | `"true"`, `"false"` |
|
||||
| `redis.opstreelabs.in/recreate-statefulset-strategy` | Controls how dependent resources are handled when the StatefulSet is recreated | `foreground` | `"foreground"`, `"background"`, `"orphan"` |
|
||||
|
||||
#### Deletion Propagation Strategies
|
||||
|
||||
When `redis.opstreelabs.in/recreate-statefulset` is set to `"true"`, you can control the deletion behavior using the `redis.opstreelabs.in/recreate-statefulset-strategy` annotation:
|
||||
|
||||
- **foreground**: The StatefulSet and its dependent objects (like Pods) are deleted synchronously
|
||||
- **background**: The StatefulSet is deleted immediately, and dependent objects are deleted asynchronously
|
||||
- **orphan**: The StatefulSet is deleted but its dependent objects (Pods) are kept running
|
||||
|
||||
### Resource Types
|
||||
|
||||
- [Redis](#redis)
|
||||
- [RedisCluster](#rediscluster)
|
||||
- [RedisReplication](#redisreplication)
|
||||
- [RedisSentinel](#redissentinel)
|
||||
|
||||
#### ExistingPasswordSecret
|
||||
|
||||
ExistingPasswordSecret is the struct to access the existing secret
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [KubernetesConfig](#kubernetesconfig)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `name` _string_ | |
|
||||
| `key` _string_ | |
|
||||
|
||||
#### KubernetesConfig
|
||||
|
||||
KubernetesConfig will be the JSON struct for Basic Redis Config
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinel](#redissentinelspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `image` _string_ | |
|
||||
| `imagePullPolicy` _[ImagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy)_ | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | |
|
||||
| `redisSecret` _[ExistingPasswordSecret](#existingpasswordsecret)_ | |
|
||||
| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#localobjectreference-v1-core)_ | |
|
||||
| `updateStrategy` _[StatefulSetUpdateStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetupdatestrategy-v1-apps)_ | |
|
||||
|
||||
#### VolumeMount
|
||||
|
||||
Mount External Volumes
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisSentinel](#redissentinelspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `volume` _[Volume Array](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volume-v1-core)_ | |
|
||||
| `mountPath` _[VolumeMount Array](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volumemount-v1-core)_ | |
|
||||
|
||||
#### Redis
|
||||
|
||||
Redis is the Schema for the redis API
|
||||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2` | | |
|
||||
| `kind` _string_ | `Redis`
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
|
||||
| `spec` _[RedisSpec](#redisspec)_ | |
|
||||
|
||||
#### RedisCluster
|
||||
|
||||
RedisCluster is the Schema for the redisclusters API
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2`
|
||||
| `kind` _string_ | `RedisCluster`
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
|
||||
| `spec` _[RedisClusterSpec](#redisclusterspec)_ | |
|
||||
|
||||
#### RedisReplication
|
||||
|
||||
RedisReplication is the Schema for the redisreplication API
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2`
|
||||
| `kind` _string_ | `RedisReplication`
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
|
||||
| `spec` _[RedisReplicationSpec](#redisreplicationspec)_ | |
|
||||
|
||||
#### RedisSentinel
|
||||
|
||||
RedisSentinel is the Schema for the redissentinel API
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `apiVersion` _string_ | `redis.redis.opstreelabs.in/v1beta2`
|
||||
| `kind` _string_ | `RedisSentinel`
|
||||
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
|
||||
| `spec` _[RedisSentinelSpec](#redissentinelspec)_ | |
|
||||
|
||||
#### RedisClusterSpec
|
||||
|
||||
RedisClusterSpec defines the desired state of RedisCluster
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisCluster](#rediscluster)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `clusterSize` _integer_ | |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | |
|
||||
| `clusterVersion` _string_ | |
|
||||
| `redisLeader` _[RedisLeader](#redisleader)_ | |
|
||||
| `redisFollower` _[RedisFollower](#redisfollower)_ | |
|
||||
| `redisExporter` _[RedisExporter](#redisexporter)_ | |
|
||||
| `storage` _[Storage](#storage)_ | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#podsecuritycontext-v1-core)_ | |
|
||||
| `priorityClassName` _string_ | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#toleration-v1-core)_ | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | |
|
||||
| `serviceAccountName` _string_ | |
|
||||
| `persistenceEnabled` _boolean_ | |
|
||||
|
||||
#### RedisSpec
|
||||
|
||||
RedisSpec defines the desired state of Redis
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [Redis](#redis)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | |
|
||||
| `redisExporter` _[RedisExporter](#redisexporter)_ | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | |
|
||||
| `storage` _[Storage](#storage)_ | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#securitycontext-v1-core)_ | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#podsecuritycontext-v1-core)_ | |
|
||||
| `priorityClassName` _string_ | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#affinity-v1-core)_ | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#toleration-v1-core)_ | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | |
|
||||
| `serviceAccountName` _string_ | |
|
||||
|
||||
#### RedisReplicationSpec
|
||||
|
||||
RedisReplicationSpec defines the desired state of RedisReplication
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisReplication](#redisreplication)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `clusterSize` _integer_ | |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | |
|
||||
| `redisExporter` _[RedisExporter](#redisexporter)_ | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | |
|
||||
| `storage` _[Storage](#storage)_ | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#securitycontext-v1-core)_ | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#podsecuritycontext-v1-core)_ | |
|
||||
| `priorityClassName` _string_ | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#affinity-v1-core)_ | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#toleration-v1-core)_ | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | |
|
||||
| `serviceAccountName` _string_ | |
|
||||
|
||||
#### RedisSentinelSpec
|
||||
|
||||
RedisSentinelSpec defines the desired state of RedisSentinel
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisSentinel](#redissentinel)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `clusterSize` _integer_ | |
|
||||
| `kubernetesConfig` _[KubernetesConfig](#kubernetesconfig)_ | |
|
||||
| `redisSentinelConfig` _[RedisSentinelConfig](#redissentinelconfig)_ | |
|
||||
| `nodeSelector` _object (keys:string, values:string)_ | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#securitycontext-v1-core)_ | |
|
||||
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#podsecuritycontext-v1-core)_ | |
|
||||
| `priorityClassName` _string_ | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#affinity-v1-core)_ | |
|
||||
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#toleration-v1-core)_ | |
|
||||
| `TLS` _[TLSConfig](#tlsconfig)_ | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `sidecars` _[Sidecar](#sidecar)_ | |
|
||||
| `serviceAccountName` _string_ | |
|
||||
| `volumeMount` _[VolumeMount](#volumemount)_ | |
|
||||
|
||||
#### RedisConfig
|
||||
|
||||
RedisConfig defines the external configuration of Redis
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisFollower](#redisfollower)
|
||||
- [RedisLeader](#redisleader)
|
||||
- [RedisSpec](#redisspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `additionalRedisConfig` _string_ | |
|
||||
|
||||
#### RedisSentinelConfig
|
||||
|
||||
RedisSentinelConfig defines the external configuration of RedisSentinel
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisSentinelSpec](#redissentinelspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `additionalRedisConfig` _string_ | |
|
||||
| `masterGroupName` _string_ | |
|
||||
| `redisPort` _string_ | |
|
||||
| `quorum` _string_ | |
|
||||
| `parallelSyncs` _string_ | |
|
||||
| `failoverTimeout` _string_ | |
|
||||
| `downAfterMilliseconds` _string_ | |
|
||||
| `resolveHostnames` _string_ | |
|
||||
| `announceHostnames` _string_ | |
|
||||
|
||||
#### RedisExporter
|
||||
|
||||
RedisExporter interface will have the information for redis exporter related stuff
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `enabled` _boolean_ | |
|
||||
| `image` _string_ | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | |
|
||||
| `imagePullPolicy` _[ImagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy)_ | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core)_ | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#securitycontext-v1-core)_ | |
|
||||
|
||||
#### RedisFollower
|
||||
|
||||
RedisFollower interface will have the redis follower configuration
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `replicas` _integer_ | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#affinity-v1-core)_ | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#securitycontext-v1-core)_ | |
|
||||
| `pdb` _[RedisPodDisruptionBudget](#redispoddisruptionbudget)_ | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
|
||||
#### RedisLeader
|
||||
|
||||
RedisLeader interface will have the redis leader configuration
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `replicas` _integer_ | |
|
||||
| `redisConfig` _[RedisConfig](#redisconfig)_ | |
|
||||
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#affinity-v1-core)_ | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#securitycontext-v1-core)_ | |
|
||||
| `pdb` _[RedisPodDisruptionBudget](#redispoddisruptionbudget)_ | |
|
||||
| `readinessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
| `livenessProbe` _[Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#probe-v1-core)_ | |
|
||||
|
||||
#### RedisPodDisruptionBudget
|
||||
|
||||
RedisPodDisruptionBudget configure a PodDisruptionBudget on the resource (leader/follower)
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisFollower](#redisfollower)
|
||||
- [RedisLeader](#redisleader)
|
||||
- [RedisReplication](#redisreplicationspec)
|
||||
- [RedisSentinel](#redissentinelspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `enabled` _boolean_ | |
|
||||
| `minAvailable` _integer_ | |
|
||||
| `maxUnavailable` _integer_ | |
|
||||
|
||||
#### Sidecar
|
||||
|
||||
Sidecar for each Redis pods
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinel](#redissentinelspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `name` _string_ | |
|
||||
| `image` _string_ | |
|
||||
| `imagePullPolicy` _[ImagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy)_ | |
|
||||
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | |
|
||||
| `env` _[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core)_ | |
|
||||
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#securitycontext-v1-core)_ | |
|
||||
|
||||
#### Storage
|
||||
|
||||
Storage is the inteface to add pvc and pv support in redis
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `volumeClaimTemplate` _[PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#persistentvolumeclaim-v1-core)_ | |
|
||||
|
||||
#### TLSConfig
|
||||
|
||||
TLS Configuration for redis instances
|
||||
|
||||
_Appears in:_
|
||||
|
||||
- [RedisClusterSpec](#redisclusterspec)
|
||||
- [RedisSpec](#redisspec)
|
||||
- [RedisReplicationSpec](#redisreplicationspec)
|
||||
- [RedisSentinel](#redissentinelspec)
|
||||
|
||||
| Field | Description |
|
||||
| --- | --- |
|
||||
| `ca` _string_ | |
|
||||
| `cert` _string_ | |
|
||||
| `key` _string_ | |
|
||||
| `secret` _[SecretVolumeSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretvolumesource-v1-core)_ | Reference to secret which contains the certificates |
|
|
@ -7,6 +7,8 @@ description: >
|
|||
Instructions for setting up Redis Replication
|
||||
---
|
||||
|
||||
> **Note:** It is recommended to use [Sentinel](../Sentinel) to monitor the Replication cluster for enhanced high availability and reliability. By implementing Redis Sentinel, you can ensure that your Redis Replication remains operational even if one or more nodes fail, thereby improving the resilience and reliability of your application.
|
||||
|
||||
## Architecture
|
||||
|
||||
Redis is an in-memory key-value store that can be used as a database, cache, and message broker. Redis replication is the process of synchronizing data from a Redis leader node to one or more Redis follower nodes.
|
||||
|
@ -21,8 +23,6 @@ Redis replication is a powerful feature that enhances the durability and scalabi
|
|||
<img src="../../../images/replication-redis.png">
|
||||
</div>
|
||||
|
||||
> **Note:** By using Redis Sentinel, you can ensure that your Redis Replication remains available even if one or more nodes go down, improving the resilience and reliability of your application.
|
||||
|
||||
## Helm Installation
|
||||
|
||||
For redis replication setup we can use `helm` command with the reference of replication helm chart and additional properties:
|
||||
|
@ -78,7 +78,7 @@ metadata:
|
|||
name: redis-replication
|
||||
spec:
|
||||
clusterSize: 3
|
||||
securityContext:
|
||||
podSecurityContext:
|
||||
runAsUser: 1000
|
||||
fsGroup: 1000
|
||||
kubernetesConfig:
|
||||
|
|
|
@ -78,7 +78,7 @@ spec:
|
|||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
securityContext:
|
||||
podSecurityContext:
|
||||
runAsUser: 1000
|
||||
fsGroup: 1000
|
||||
```
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
title: "Overview"
|
||||
linkTitle: "Overview"
|
||||
weight: 1
|
||||
date: 2022-11-02T00:19:19Z
|
||||
date: 2025-07-25T00:00:00Z
|
||||
description: >
|
||||
Redis Operator is a software to set up and manage Redis on [Kubernetes](https://kubernetes.io).
|
||||
---
|
||||
|
||||
A Golang based redis operator that will make/oversee Redis standalone/cluster/replication/sentinel mode setup on top of the Kubernetes. It can create a redis cluster setup with best practices on Cloud as well as the Bare-metal environment. Also, it provides an in-built monitoring capability using redis-exporter.
|
||||
|
||||
Documentation is available here:- https://ot-container-kit.github.io/redis-operator/
|
||||
Documentation is available here:- https://redis-operator.opstree.dev/docs/
|
||||
|
||||
The type of Redis setup which is currently supported:-
|
||||
|
||||
|
|
|
@ -2,10 +2,325 @@
|
|||
title: "Release History"
|
||||
linkTitle: "Release History"
|
||||
weight: 10
|
||||
date: 2022-11-02T00:19:19Z
|
||||
date: 2025-07-25T00:00:00Z
|
||||
description: >
|
||||
Release versions and their description about Redis Operator
|
||||
---
|
||||
The most up to date release notes can be found on [GitHub](https://github.com/OT-CONTAINER-KIT/redis-operator/releases)
|
||||
|
||||
### v0.21.0
|
||||
#### June 2025
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Round robin where to transfer cluster shards when scaling in a Redis Cluster [#1412](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1412)
|
||||
- Add auto max memory configuration for Redis instances [#1411](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1411)
|
||||
- Add bus port configuration for Redis cluster services [#1406](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1406)
|
||||
- Add automatic Redis pod role label synchronization for rediscluster [#1404](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1404)
|
||||
- RedisCluster observability [#1392](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1392)
|
||||
- Add liveness/readiness probes to values.yaml and templates [#1378](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1378)
|
||||
- Reduce unnecessary requeue when skip reconcile annotation exists [#1374](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1374)
|
||||
- RedisReplication observability, skip reconcile or not [#1369](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1369)
|
||||
- Add Redis Sentinel validation webhook for clusterSize [#1361](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1361)
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Resolve StatefulSet selector immutability issues [#1382](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1382)
|
||||
- Avoid sentinel restart after replication failover [#1381](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1381)
|
||||
- Define named probe port outside webhook block [#1354](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1354)
|
||||
|
||||
**🎉 Refactors**
|
||||
|
||||
- Reorganize manager agent cmd package [#1383](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1383)
|
||||
- Reorganize API structure and update paths [#1363](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1363)
|
||||
- Remove useless structure and refactor package [#1362](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1362)
|
||||
- Reorganize command structure for Redis operator [#1351](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1351)
|
||||
|
||||
### v0.20.2
|
||||
#### May 12, 2024
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Handle panic when retrieving StatefulSet in GetRedisNodesByRole [#1330](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1330)
|
||||
- VCT resize detection logic; add support for scaling out with new VCT size [#1342](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1342)
|
||||
- Service updated before Statefulset during Reconciliation [#1348](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1348)
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Add data assertion generation and enhance Redis configuration commands [#1331](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1331)
|
||||
- Add feature gates support for Redis Operator [#1333](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1333)
|
||||
- Migrate kubebuilder go.kubebuilder.io/v3 to go.kubebuilder.io/v4 [#1340](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1340)
|
||||
|
||||
**🎉 Refactors**
|
||||
|
||||
- Define container port for http probes in operator chart [#1326](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1326)
|
||||
- Enhance environment variable management and CI workflow [#1315](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1315)
|
||||
|
||||
### v0.20.1
|
||||
#### April 27, 2024
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Move VCT logic before diff calculation for stateful set [#1322](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1322)
|
||||
|
||||
### v0.20.0
|
||||
#### April 1, 2024
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Sentinel - support hostname resolve and announce [#1247](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1247)
|
||||
- Add redis agent with bootstrap configuration generation [#1254](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1254)
|
||||
- Implement comprehensive Redis configuration generation for agent bootstrap [#1260](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1260)
|
||||
- Added support for hostport to allow direct connection to the pod [#1263](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1263)
|
||||
- Add preStop hook for Redis Cluster failover [#1264](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1264)
|
||||
- Sentinel - announce-ip when resolve & announce are set [#1271](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1271)
|
||||
- Fix PVC resizing issue and refactor PVC resizing logic [#1268](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1268)
|
||||
- Add redisreplication observability [#1274](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1274)
|
||||
- Add recreate-stateful-strategy, orphan, background, foreground(default) [#1286](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1286)
|
||||
- Update Dockerfile and Makefile for unified operator binary [#1294](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1294)
|
||||
- Add support for anti affinity configuration in helm charts [#1296](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1296)
|
||||
- Guarantee to avoid bad master ip on Sentinel [#1289](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1289)
|
||||
- Add feature gates for sentinel configuration generation in init container [#1300](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1300)
|
||||
- Support redis configuration generation in init container [#1303](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1303)
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Replace hardcoded Redis port 6379 with configurable port from cr.Spec.Port [#1261](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1261)
|
||||
- Update references from master to main in docs and workflow files [#1288](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1288)
|
||||
- Svc finalizer removed [#1297](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1297)
|
||||
- Race condition resulting in permanently broken Redis cluster [#1298](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1298)
|
||||
|
||||
### v0.19.1
|
||||
#### February 19, 2024
|
||||
|
||||
**⚠️ Deprecation Notice**
|
||||
|
||||
The v1beta1 API version will be removed in next release. Users are strongly encouraged to migrate to v1beta2, which offers enhanced features and improved stability.
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Add data-assert tool for Redis data management [#1204](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1204)
|
||||
- Check data consistent by external tool [#1205](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1205)
|
||||
- Added actions to publish charts to github container registry [#1201](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1201)
|
||||
- Add headless service configuration support [#1219](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1219)
|
||||
- Update redis-operator cert manager configuration [#1220](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1220)
|
||||
- Add additional service configuration with optional enable flag [#1228](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1228)
|
||||
- Enhance Redis HA and node scheduling strategy [#1237](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1237)
|
||||
- Add securityContext config in chart for redis-exporter [#1238](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1238)
|
||||
- Add dynamic Redis configuration support for Redis Cluster [#1241](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1241)
|
||||
- Configurable operator maxConcurrentReconciles [#1242](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1242)
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Skip-reconcile annotation still skipping reconcile even the value is false [#1202](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1202)
|
||||
- Make recreate statefulset only trigger when value true [#1240](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1240)
|
||||
- Improve pod label patching with error handling and retry mechanism [#1231](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1231)
|
||||
- Changed certificate serverName to pod+namespace [#1221](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1221)
|
||||
- Add missing topologySpreadConstraint on RedisCluster follower [#1218](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1218)
|
||||
|
||||
### v0.19.0
|
||||
#### January 12, 2024
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Add PDB and probes, drop unspecified acl in sentinel helm [#1123](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1123)
|
||||
- Add master/replica service to redis replication [#1124](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1124)
|
||||
- Add recreateStatefulSetOnUpdateInvalid helm chart value [#1127](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1127)
|
||||
- Enhance RedisReplication controller and CRD with additional status [#1154](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1154)
|
||||
- Support PDB in redisreplication [#1166](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1166)
|
||||
- Enhance RedisSentinel reconciliation logic and update workflow [#1176](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1176)
|
||||
- Support redis-cluster topologySpreadConstraints [#1177](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1177)
|
||||
- Add event recording functionality for RedisCluster controller [#1182](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1182)
|
||||
- Support topologySpreadConstraints in replication & sentinel [#1184](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1184)
|
||||
- Redis-cluster add podAntiAffinity [#1180](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1180)
|
||||
- Separate resources section for leader and follower [#1188](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1188)
|
||||
- Enhance RedisCluster resource management by introducing separate resource handling for leader and follower [#1199](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1199)
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- PDB value mapping in redis-sentinel [#1136](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1136)
|
||||
- Chart render error when enable initcontainer [#1146](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1146)
|
||||
- InitContainer enabled properties not define in template [#1152](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1152)
|
||||
- Redis-cluster unexpected downscaling [#1173](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1173)
|
||||
- Reduce the impact of Redis cluster intermediate states [#1178](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1178)
|
||||
- Label selector mapping on redisreplication pdb [#1191](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1191)
|
||||
|
||||
### v0.18.1
|
||||
#### November 7, 2024
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Support setting minReadySeconds on the stateful sets [#1023](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1023)
|
||||
- Add tolerations to operator chart [#1051](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1051)
|
||||
- Add image pull secret for redis operator [#1053](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1053)
|
||||
- Add service monitor to redis sentinel chart [#1071](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1071)
|
||||
- Add readiness/liveness probe to redis operator chart [#1072](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1072)
|
||||
- Upgrade redis/sentinel image to 7.0.15 [#1099](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1099)
|
||||
- Reconcile redissentinel only on master changed [#1122](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1122)
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Fix indentation error when enable additional config [#1031](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1031)
|
||||
- Fix field validate error when enable additional config for sentinel [#1033](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1033)
|
||||
- Fix unknown field error when upgrade chart [#1034](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1034)
|
||||
- Fix bad indentation on redis standalone additional configs [#1040](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1040)
|
||||
- Fix attempt to repair disconnected/failed master nodes before failing over [#1105](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1105)
|
||||
- Fix set controller probe endpoint handler [#1121](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1121)
|
||||
|
||||
### v0.18.0
|
||||
#### July 11, 2024
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Added redisReplicationPassword values to connect secured replication [#1021](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1021)
|
||||
- Added redis/redisreplication/redissentinel/rediscluster chart [#1007](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/1007)
|
||||
- Added support for extra volume mounts for redis sentinel [#994](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/994)
|
||||
- Added automountServiceAccountToken values for deployment and serviceaccount [#991](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/991)
|
||||
- Added securityContext for exporter, initcontainers and sidecars [#987](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/987)
|
||||
- Added security context values in operator chart [#973](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/973)
|
||||
- Added rolling update sequence from leader to follower [#966](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/966)
|
||||
- Added support for configurable probe handlers [#934](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/934)
|
||||
- Added redis operator helm chart and release workflow [#941](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/941)
|
||||
- Added support for other container engines [#947](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/947)
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Added default port to enable `SENTINEL_PORT` environment [#999](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/999)
|
||||
- ReadyReplicas need to be checked in `IsStatefulSetReady` [#993](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/993)
|
||||
- watchNamespace value does not take effect in chart [#990](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/990)
|
||||
- Sentinel should not reconcile until replication cluster ready [#964](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/964)
|
||||
- Return ASAP after handling finalizer [#940](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/940)
|
||||
- Check redis replication after handling finalizer [#936](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/936)
|
||||
|
||||
### v0.17.0
|
||||
#### May 14, 2024
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- WATCH_NAMESPACE support multi namespace [#919](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/919)
|
||||
- Add workflow to publish image to ghcr [#914](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/914)
|
||||
- Probe use built-in, discarded healthcheck.sh [#907](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/907)
|
||||
- Implement redis cluster ready state [#867](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/867)
|
||||
- Add redisreplication status masterNode [#849](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/849)
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Runtime panic when delete rediscluster which disable persistent [#922](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/922)
|
||||
- Runtime panic when storage param is empty [#887](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/887)
|
||||
- Exporter can not connect to redis when enable tls [#902](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/902)
|
||||
- Update status if not equal [#900](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/900)
|
||||
- Should get the really leader count when scale in [#885](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/885)
|
||||
- ClusterSlaves result should be cut [#884](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/884)
|
||||
- Redis cluster update as scale out [#882](https://github.com/OT-CONTAINER-KIT/redis-operator/issues/882)
|
||||
- Add common AddFinalizer for all api [#858](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/858)
|
||||
|
||||
### v0.16.0
|
||||
#### March 27, 2024
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Added support for multiple CRDs and enhanced functionality
|
||||
- Improved test coverage and CI/CD pipeline
|
||||
- Enhanced Redis cluster management and scaling capabilities
|
||||
- Added support for custom Redis configurations
|
||||
- Implemented advanced security features
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Fixed various StatefulSet and service management issues
|
||||
- Resolved Redis cluster scaling problems
|
||||
- Fixed authentication and TLS connectivity issues
|
||||
- Improved error handling and logging
|
||||
|
||||
### v0.15.1
|
||||
#### September 24, 2023
|
||||
|
||||
**🪲 Bug Fixes**
|
||||
|
||||
- Added Custom EnvVars support [#631](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/631)
|
||||
- Fix the backup and restore script and manifest [#624](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/624)
|
||||
- e2e test for Redis Cluster [#623](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/623)
|
||||
- Nil pointer de-reference in conversion webhook [#615](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/615)
|
||||
- Fixes Restore script [#609](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/609)
|
||||
- Close redis client to avoid resource leak [#572](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/572)
|
||||
- fix:resize cluster’s pvc with wrong label [#562](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/562)
|
||||
- Hardcoded 1Mi size of node-conf PVC in RedisCluster [#552](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/552)
|
||||
- Cluster leader failover loop if there is only a single leader [#542](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/542)
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- e2e test for Redis Cluster [#623](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/623)
|
||||
- Support ENABLE_WEBHOOKS env which cloud disable webhook server locally [#617](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/617)
|
||||
- Status Field to Redis Cluster [#612](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/612)
|
||||
- Support recreate statefulset of redissentinel [#607](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/607)
|
||||
- Add support for multiple versions [#592](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/592)
|
||||
|
||||
**🎉 Refactors**
|
||||
|
||||
- Track examples/docs refactoring v1beta2 [#633](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/633)
|
||||
- Refactor the backup and restore script and manifest [#624](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/624)
|
||||
- Optional Volume split [#603](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/603) ( Breaking Change )
|
||||
- kustomize install not working [#602](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/602)
|
||||
- Support apply crds by kubectl apply --server-side [#601](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/601)
|
||||
- Fix image path [#591](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/591)
|
||||
- Add RBAC for redisreplications and redissentinels. [#590](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/590)
|
||||
- Write the docs for the restore and backup [#588](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/588)
|
||||
- Support redis sentinel pdb [#589](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/589)
|
||||
- Migrate the Pipeline from Azure to Github actions [#571](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/571)
|
||||
- Fix log pollution [#585](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/585)
|
||||
|
||||
### v0.15.0
|
||||
##### July 17, 2023
|
||||
|
||||
**🐞 Bug Fixes**
|
||||
|
||||
- Fix Linter Issue #479
|
||||
- Fix exporter ports enabled even when exporters disabled [#484](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/484)
|
||||
- Corrected scenario "go-get-tool" in makefile [#499](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/499)
|
||||
- Operator Crash when persistence is false/Disabled [#519](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/519) -- Breaking Change
|
||||
- call of func checkAttachedSlave for 1 Master Replication [#523](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/523)
|
||||
- Only created /node-conf VolumeMount for clusters [#532](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/532)
|
||||
- Redis Sentinel Exporter ports in Env Vars [#533](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/533)
|
||||
- Init Container tried to mount invalid volume name [#538](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/538)
|
||||
- Cluster leader failover loop if there is only a single leader [#542](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/542)
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Add RedisExporter for sentinel [#440](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/440)
|
||||
- Add InitContainer Field [#458](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/458)
|
||||
- ACL redis via secret [#486](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/486)
|
||||
- Adding Custom TerminationGracePeriodSeconds and additional fields for Sidecar [#487](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/487)
|
||||
- Enable Support for Backup and Restore via script [#489](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/489)
|
||||
- Support Scaling for Redis Cluster [#531](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/531) -- Breaking Change
|
||||
|
||||
**🎉 Refactors**
|
||||
|
||||
- Fixed StatefulSet(sentinel) Label for Service(Selector) [#442](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/442)
|
||||
- Declare Module Correctly On sentinel [#478](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/478)
|
||||
- Manage (Pod and Container) security Context explicitly [#518](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/518)
|
||||
- Add watchnamespace function as per operator hub [#520](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/520)
|
||||
- Remove sentinel default validation not effect [#535](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/535)
|
||||
- Remove sentinel cluster size validation no effect [#536](https://github.com/OT-CONTAINER-KIT/redis-operator/pull/536)
|
||||
|
||||
### v0.14.0
|
||||
##### Feburary 13, 2023
|
||||
|
||||
**🐞 Bug Fixes**
|
||||
|
||||
- Added check for persistent volume nil condition
|
||||
- Fix crash with go panic
|
||||
- Fix memory address bug and nil pointer
|
||||
- CR annotations fixes w.r.t. to stateful set
|
||||
- Fix issues with ARM64 support
|
||||
|
||||
**🎉 Features**
|
||||
|
||||
- Added serviceType functionality for redis standalone and cluster
|
||||
- Added feature for additional volume mounts
|
||||
- Added nodeSelectory and tolerations for redis cluster
|
||||
- Added recreation logic for redis stateful sets
|
||||
- Added replication mode support for the redis cluster
|
||||
- Added sentinel support for replication failover
|
||||
|
||||
### v0.13.0
|
||||
##### November 10, 2022
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
apiVersion: redis.redis.opstreelabs.in/v1beta2
|
||||
kind: RedisCluster
|
||||
metadata:
|
||||
name: redis-cluster
|
||||
spec:
|
||||
clusterSize: 3
|
||||
clusterVersion: v7
|
||||
podSecurityContext:
|
||||
runAsUser: 1000
|
||||
fsGroup: 1000
|
||||
persistenceEnabled: true
|
||||
kubernetesConfig:
|
||||
image: quay.io/opstree/redis:v7.0.12
|
||||
imagePullPolicy: IfNotPresent
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenScaled: Delete
|
||||
whenDeleted: Delete
|
||||
redisExporter:
|
||||
enabled: false
|
||||
image: quay.io/opstree/redis-exporter:v1.44.0
|
||||
storage:
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
# storageClassName: standard
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
nodeConfVolumeClaimTemplate:
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
apiVersion: redis.redis.opstreelabs.in/v1beta2
|
||||
kind: RedisReplication
|
||||
metadata:
|
||||
name: redis-replication
|
||||
spec:
|
||||
clusterSize: 3
|
||||
kubernetesConfig:
|
||||
image: quay.io/opstree/redis:v7.0.12
|
||||
imagePullPolicy: IfNotPresent
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenScaled: Delete
|
||||
whenDeleted: Delete
|
||||
podSecurityContext:
|
||||
runAsUser: 1000
|
||||
fsGroup: 1000
|
||||
storage:
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
# storageClassName: standard
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
redisExporter:
|
||||
enabled: false
|
||||
image: quay.io/opstree/redis-exporter:v1.44.0
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
apiVersion: redis.redis.opstreelabs.in/v1beta2
|
||||
kind: Redis
|
||||
metadata:
|
||||
name: redis-standalone
|
||||
spec:
|
||||
kubernetesConfig:
|
||||
image: quay.io/opstree/redis:v7.0.12
|
||||
imagePullPolicy: IfNotPresent
|
||||
persistentVolumeClaimRetentionPolicy:
|
||||
whenScaled: Delete
|
||||
whenDeleted: Delete
|
||||
podSecurityContext:
|
||||
runAsUser: 1000
|
||||
fsGroup: 1000
|
||||
storage:
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
# storageClassName: standard
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
redisExporter:
|
||||
enabled: false
|
||||
image: quay.io/opstree/redis-exporter:v1.44.0
|
2
go.mod
2
go.mod
|
@ -68,7 +68,7 @@ require (
|
|||
go.uber.org/zap v1.26.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
|
||||
golang.org/x/net v0.38.0 // indirect
|
||||
golang.org/x/oauth2 v0.24.0 // indirect
|
||||
golang.org/x/oauth2 v0.27.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/term v0.30.0 // indirect
|
||||
golang.org/x/text v0.23.0 // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -233,8 +233,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
|
|||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
|
||||
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
|
||||
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
||||
CRD_REF_DOCS_VERSION="v0.0.12"
|
||||
|
||||
echo "Starting API documentation generation..."
|
||||
|
||||
# Install crd-ref-docs if not present
|
||||
echo "Installing crd-ref-docs ${CRD_REF_DOCS_VERSION}..."
|
||||
go install github.com/elastic/crd-ref-docs@${CRD_REF_DOCS_VERSION}
|
||||
|
||||
# Use full path to crd-ref-docs
|
||||
GOPATH=$(go env GOPATH)
|
||||
if [ -z "$GOPATH" ]; then
|
||||
GOPATH="$HOME/go"
|
||||
fi
|
||||
CRD_REF_DOCS="${GOPATH}/bin/crd-ref-docs"
|
||||
|
||||
if [ ! -f "${CRD_REF_DOCS}" ]; then
|
||||
echo "Error: crd-ref-docs not found at ${CRD_REF_DOCS}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create output directory
|
||||
OUTPUT_DIR="${REPO_ROOT}/docs/content/en/docs/CRD Reference/API Reference"
|
||||
mkdir -p "${OUTPUT_DIR}"
|
||||
|
||||
echo "Generating API documentation..."
|
||||
echo "Source path: ${REPO_ROOT}/api"
|
||||
echo "Config file: ${SCRIPT_DIR}/config.yaml"
|
||||
echo "Templates: ${SCRIPT_DIR}/templates"
|
||||
echo "Output: ${OUTPUT_DIR}/_index.md"
|
||||
|
||||
# Generate the documentation using custom templates
|
||||
"${CRD_REF_DOCS}" \
|
||||
--source-path="${REPO_ROOT}/api" \
|
||||
--config="${SCRIPT_DIR}/config.yaml" \
|
||||
--templates-dir="${SCRIPT_DIR}/templates/markdown" \
|
||||
--renderer=markdown \
|
||||
--output-path="${OUTPUT_DIR}/_index.md"
|
||||
|
||||
echo "API documentation generated successfully at: ${OUTPUT_DIR}/_index.md"
|
|
@ -0,0 +1,10 @@
|
|||
processor:
|
||||
ignoreTypes:
|
||||
- ".*List$"
|
||||
- ".*Status$"
|
||||
ignoreFields:
|
||||
- "TypeMeta"
|
||||
- "ObjectMeta"
|
||||
render:
|
||||
kubernetesVersion: "1.31"
|
||||
renderer: "markdown"
|
|
@ -0,0 +1,19 @@
|
|||
{{- define "gvDetails" -}}
|
||||
{{- $gv := . -}}
|
||||
|
||||
## {{ $gv.GroupVersionString }}
|
||||
|
||||
{{ $gv.Doc }}
|
||||
|
||||
{{- if $gv.Kinds }}
|
||||
### Resource Types
|
||||
{{- range $gv.SortedKinds }}
|
||||
- {{ $gv.TypeForKind . | markdownRenderTypeLink }}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
|
||||
{{ range $gv.SortedTypes }}
|
||||
{{ template "type" . }}
|
||||
{{ end }}
|
||||
|
||||
{{- end -}}
|
|
@ -0,0 +1,23 @@
|
|||
{{- define "gvList" -}}
|
||||
{{- $groupVersions := . -}}
|
||||
---
|
||||
title: "API Reference Documentation"
|
||||
linkTitle: "API Docs"
|
||||
weight: 10
|
||||
date: 2025-01-27
|
||||
description: >
|
||||
Complete API reference documentation for Redis Operator CRDs
|
||||
---
|
||||
|
||||
# API Reference
|
||||
|
||||
## Packages
|
||||
{{- range $groupVersions }}
|
||||
- {{ markdownRenderGVLink . }}
|
||||
{{- end }}
|
||||
|
||||
{{ range $groupVersions }}
|
||||
{{ template "gvDetails" . }}
|
||||
{{ end }}
|
||||
|
||||
{{- end -}}
|
|
@ -0,0 +1,43 @@
|
|||
{{- define "type" -}}
|
||||
{{- $type := . -}}
|
||||
{{- if markdownShouldRenderType $type -}}
|
||||
|
||||
#### {{ $type.Name }}
|
||||
|
||||
{{ if $type.IsAlias }}_Underlying type:_ _{{ markdownRenderTypeLink $type.UnderlyingType }}_{{ end }}
|
||||
|
||||
{{ $type.Doc }}
|
||||
|
||||
{{ if $type.Validation -}}
|
||||
_Validation:_
|
||||
{{- range $type.Validation }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ if $type.References -}}
|
||||
_Appears in:_
|
||||
{{- range $type.SortedReferences }}
|
||||
- {{ markdownRenderTypeLink . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ if $type.Members -}}
|
||||
| Field | Description | Default | Validation |
|
||||
| --- | --- | --- | --- |
|
||||
{{ if $type.GVK -}}
|
||||
| `apiVersion` _string_ | `{{ $type.GVK.Group }}/{{ $type.GVK.Version }}` | | |
|
||||
| `kind` _string_ | `{{ $type.GVK.Kind }}` | | |
|
||||
{{ end -}}
|
||||
|
||||
{{ range $type.Members -}}
|
||||
| `{{ .Name }}` _{{ markdownRenderType .Type }}_ | {{ template "type_members" . }} | {{ markdownRenderDefault .Default }} | {{ range .Validation -}} {{ markdownRenderFieldDoc . }} <br />{{ end }} |
|
||||
{{ end -}}
|
||||
|
||||
{{ end -}}
|
||||
|
||||
{{/* EnumValues feature removed for compatibility */}}
|
||||
|
||||
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,8 @@
|
|||
{{- define "type_members" -}}
|
||||
{{- $field := . -}}
|
||||
{{- if eq $field.Name "metadata" -}}
|
||||
Refer to Kubernetes API documentation for fields of `metadata`.
|
||||
{{- else -}}
|
||||
{{ markdownRenderFieldDoc $field.Doc }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -2,6 +2,9 @@ package redisreplication
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
rrvb2 "github.com/OT-CONTAINER-KIT/redis-operator/api/redisreplication/v1beta2"
|
||||
|
@ -10,7 +13,10 @@ import (
|
|||
intctrlutil "github.com/OT-CONTAINER-KIT/redis-operator/internal/controllerutil"
|
||||
"github.com/OT-CONTAINER-KIT/redis-operator/internal/k8sutils"
|
||||
"github.com/OT-CONTAINER-KIT/redis-operator/internal/monitoring"
|
||||
goredis "github.com/redis/go-redis/v9"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
@ -136,36 +142,156 @@ func (r *Reconciler) reconcileService(ctx context.Context, instance *rrvb2.Redis
|
|||
return intctrlutil.Reconciled()
|
||||
}
|
||||
|
||||
func (r *Reconciler) reconcileRedis(ctx context.Context, instance *rrvb2.RedisReplication) (ctrl.Result, error) {
|
||||
func (r *Reconciler) reconcileRedis(
|
||||
ctx context.Context,
|
||||
instance *rrvb2.RedisReplication,
|
||||
) (ctrl.Result, error) {
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
var realMaster string
|
||||
masterNodes := k8sutils.GetRedisNodesByRole(ctx, r.K8sClient, instance, "master")
|
||||
slaveNodes := k8sutils.GetRedisNodesByRole(ctx, r.K8sClient, instance, "slave")
|
||||
if len(masterNodes) > 1 {
|
||||
log.FromContext(ctx).Info("Creating redis replication by executing replication creation commands")
|
||||
//----------------------------------------------------------------------
|
||||
// 0. Resolve Redis password from Secret (pointer-safe)
|
||||
//----------------------------------------------------------------------
|
||||
secretRef := instance.Spec.KubernetesConfig.ExistingPasswordSecret
|
||||
if secretRef == nil ||
|
||||
secretRef.Name == nil || secretRef.Key == nil ||
|
||||
*secretRef.Name == "" || *secretRef.Key == "" {
|
||||
|
||||
realMaster = k8sutils.GetRedisReplicationRealMaster(ctx, r.K8sClient, instance, masterNodes)
|
||||
if len(slaveNodes) == 0 {
|
||||
realMaster = masterNodes[0]
|
||||
}
|
||||
if err := k8sutils.CreateMasterSlaveReplication(ctx, r.K8sClient, instance, masterNodes, realMaster); err != nil {
|
||||
return intctrlutil.RequeueAfter(ctx, time.Second*60, "")
|
||||
}
|
||||
log.FromContext(ctx).Info("existingPasswordSecret name/key not set")
|
||||
return intctrlutil.RequeueAfter(ctx, 10*time.Second, "password ref missing")
|
||||
}
|
||||
|
||||
monitoring.RedisReplicationReplicasSizeMismatch.WithLabelValues(instance.Namespace, instance.Name).Set(0)
|
||||
if instance.Spec.Size != nil && int(*instance.Spec.Size) != (len(masterNodes)+len(slaveNodes)) {
|
||||
monitoring.RedisReplicationReplicasSizeMismatch.WithLabelValues(instance.Namespace, instance.Name).Set(1)
|
||||
secret, err := r.K8sClient.CoreV1().
|
||||
Secrets(instance.Namespace).
|
||||
Get(ctx, *secretRef.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
log.FromContext(ctx).Error(err, "unable to read redis password secret")
|
||||
return intctrlutil.RequeueAfter(ctx, 10*time.Second, "secret not ready")
|
||||
}
|
||||
|
||||
monitoring.RedisReplicationReplicasSizeCurrent.WithLabelValues(instance.Namespace, instance.Name).Set(float64(len(masterNodes) + len(slaveNodes)))
|
||||
monitoring.RedisReplicationReplicasSizeDesired.WithLabelValues(instance.Namespace, instance.Name).Set(float64(*instance.Spec.Size))
|
||||
rawPwd, ok := secret.Data[*secretRef.Key]
|
||||
if !ok {
|
||||
log.FromContext(ctx).Info("password key not present in secret", "key", *secretRef.Key)
|
||||
return intctrlutil.RequeueAfter(ctx, 10*time.Second, "key missing in secret")
|
||||
}
|
||||
password := string(rawPwd)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 1. List all Redis pods for this instance
|
||||
//----------------------------------------------------------------------
|
||||
pods, err := r.K8sClient.CoreV1().
|
||||
Pods(instance.Namespace).
|
||||
List(ctx, metav1.ListOptions{
|
||||
LabelSelector: fmt.Sprintf("app.kubernetes.io/name=%s", instance.Name),
|
||||
})
|
||||
if err != nil {
|
||||
return intctrlutil.RequeueE(ctx, err, "list pods")
|
||||
}
|
||||
if len(pods.Items) == 0 {
|
||||
return intctrlutil.RequeueAfter(ctx, 10*time.Second, "no pods yet")
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 2. Healthy topology shortcut
|
||||
//----------------------------------------------------------------------
|
||||
masters := k8sutils.GetRedisNodesByRole(ctx, r.K8sClient, instance, "master")
|
||||
slaves := k8sutils.GetRedisNodesByRole(ctx, r.K8sClient, instance, "slave")
|
||||
if len(masters) == 1 && len(slaves) > 0 {
|
||||
return intctrlutil.Reconciled()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 3. Pick best pod by master_repl_offset
|
||||
//----------------------------------------------------------------------
|
||||
var (
|
||||
bestPod *corev1.Pod
|
||||
bestOffset int64 = -1
|
||||
)
|
||||
|
||||
for i := range pods.Items {
|
||||
p := &pods.Items[i]
|
||||
if p.Status.PodIP == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
rdb := goredis.NewClient(&goredis.Options{
|
||||
Addr: fmt.Sprintf("%s:6379", p.Status.PodIP),
|
||||
Password: password,
|
||||
})
|
||||
info, err := rdb.Info(ctx, "replication").Result()
|
||||
rdb.Close()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, line := range strings.Split(info, "\r\n") {
|
||||
if strings.HasPrefix(line, "master_repl_offset:") {
|
||||
val := strings.TrimSpace(strings.TrimPrefix(line, "master_repl_offset:"))
|
||||
if off, err := strconv.ParseInt(val, 10, 64); err == nil && off > bestOffset {
|
||||
bestOffset = off
|
||||
bestPod = p
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if bestPod == nil || bestPod.Status.PodIP == "" {
|
||||
return intctrlutil.RequeueAfter(ctx, 10*time.Second, "no reachable redis pods")
|
||||
}
|
||||
masterIP := bestPod.Status.PodIP
|
||||
|
||||
log.FromContext(ctx).Info("Reconfiguring replication",
|
||||
"newMaster", bestPod.Name, "offset", bestOffset)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 4. Re-attach others as replicas
|
||||
//----------------------------------------------------------------------
|
||||
for _, p := range pods.Items {
|
||||
if p.Name == bestPod.Name || p.Status.PodIP == "" {
|
||||
continue
|
||||
}
|
||||
rdb := goredis.NewClient(&goredis.Options{
|
||||
Addr: fmt.Sprintf("%s:6379", p.Status.PodIP),
|
||||
Password: password,
|
||||
})
|
||||
if err := rdb.SlaveOf(ctx, masterIP, "6379").Err(); err != nil {
|
||||
log.FromContext(ctx).Error(err, "SLAVEOF failed", "pod", p.Name)
|
||||
}
|
||||
rdb.Close()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// 4b. Immediately correct pod labels so we don't have 2 masters
|
||||
// ------------------------------------------------------------------
|
||||
labels := common.GetRedisLabels(
|
||||
instance.GetName(),
|
||||
common.SetupTypeReplication,
|
||||
"replication",
|
||||
instance.GetLabels(),
|
||||
)
|
||||
|
||||
if err := r.Healer.UpdateRedisRoleLabel(
|
||||
ctx,
|
||||
instance.Namespace,
|
||||
labels,
|
||||
instance.Spec.KubernetesConfig.ExistingPasswordSecret,
|
||||
); err != nil {
|
||||
|
||||
log.FromContext(ctx).Error(err, "failed to update redis-role labels")
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 5. Update CR status
|
||||
//----------------------------------------------------------------------
|
||||
if err := r.UpdateRedisReplicationMaster(ctx, instance, bestPod.Name); err != nil {
|
||||
return intctrlutil.RequeueE(ctx, err, "update master status")
|
||||
}
|
||||
|
||||
return intctrlutil.RequeueAfter(ctx, 30*time.Second, "verify replication")
|
||||
}
|
||||
|
||||
// reconcileStatus update status and label.
|
||||
func (r *Reconciler) reconcileStatus(ctx context.Context, instance *rrvb2.RedisReplication) (ctrl.Result, error) {
|
||||
var err error
|
||||
|
@ -173,6 +299,58 @@ func (r *Reconciler) reconcileStatus(ctx context.Context, instance *rrvb2.RedisR
|
|||
|
||||
masterNodes := k8sutils.GetRedisNodesByRole(ctx, r.K8sClient, instance, "master")
|
||||
realMaster = k8sutils.GetRedisReplicationRealMaster(ctx, r.K8sClient, instance, masterNodes)
|
||||
if realMaster != "" && len(masterNodes) == 1 {
|
||||
// ------------------------------------------------------------------
|
||||
// Inline: fetch master_repl_offset for the sole master pod.
|
||||
// If it is 0 (empty dataset), treat as “no valid master”.
|
||||
// ------------------------------------------------------------------
|
||||
var offset int64 = -1
|
||||
|
||||
// 1. Pull password from Secret (pointer-safe)
|
||||
if ref := instance.Spec.KubernetesConfig.ExistingPasswordSecret; ref != nil &&
|
||||
ref.Name != nil && ref.Key != nil &&
|
||||
*ref.Name != "" && *ref.Key != "" {
|
||||
|
||||
if sec, err := r.K8sClient.CoreV1().
|
||||
Secrets(instance.Namespace).
|
||||
Get(ctx, *ref.Name, metav1.GetOptions{}); err == nil {
|
||||
|
||||
if pwd, ok := sec.Data[*ref.Key]; ok {
|
||||
password := string(pwd)
|
||||
|
||||
// 2. Get the master pod’s IP
|
||||
if pod, err := r.K8sClient.CoreV1().
|
||||
Pods(instance.Namespace).
|
||||
Get(ctx, realMaster, metav1.GetOptions{}); err == nil &&
|
||||
pod.Status.PodIP != "" {
|
||||
|
||||
// 3. Query INFO replication and parse master_repl_offset
|
||||
rdb := goredis.NewClient(&goredis.Options{
|
||||
Addr: fmt.Sprintf("%s:6379", pod.Status.PodIP),
|
||||
Password: password,
|
||||
})
|
||||
if info, err := rdb.Info(ctx, "replication").Result(); err == nil {
|
||||
for _, line := range strings.Split(info, "\r\n") {
|
||||
if strings.HasPrefix(line, "master_repl_offset:") {
|
||||
v := strings.TrimSpace(strings.TrimPrefix(line, "master_repl_offset:"))
|
||||
if o, err := strconv.ParseInt(v, 10, 64); err == nil {
|
||||
offset = o
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
rdb.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Empty dataset? -> act as if no master exists
|
||||
if offset == 0 {
|
||||
realMaster = ""
|
||||
}
|
||||
}
|
||||
if err = r.UpdateRedisReplicationMaster(ctx, instance, realMaster); err != nil {
|
||||
return intctrlutil.RequeueE(ctx, err, "")
|
||||
}
|
||||
|
|
|
@ -91,16 +91,30 @@ func (r *RedisSentinelReconciler) reconcileFinalizer(ctx context.Context, instan
|
|||
}
|
||||
|
||||
func (r *RedisSentinelReconciler) reconcileReplication(ctx context.Context, instance *rsvb2.RedisSentinel) (ctrl.Result, error) {
|
||||
if instance.Spec.RedisSentinelConfig != nil && !k8sutils.IsRedisReplicationReady(ctx, r.K8sClient, r.Client, instance) {
|
||||
return intctrlutil.RequeueAfter(ctx, time.Second*10, "Redis Replication is specified but not ready")
|
||||
// -------------------------------------------------------------------
|
||||
// Wait until RedisReplication reports a *real* master and readiness.
|
||||
// This prevents Sentinel from accepting an empty self-promoted master
|
||||
// immediately after a pod restart.
|
||||
// -------------------------------------------------------------------
|
||||
if instance.Spec.RedisSentinelConfig != nil {
|
||||
rr := &rrvb2.RedisReplication{}
|
||||
if err := r.Client.Get(ctx, types.NamespacedName{
|
||||
Namespace: instance.Namespace,
|
||||
Name: instance.Spec.RedisSentinelConfig.RedisReplicationName,
|
||||
}, rr); err != nil {
|
||||
return intctrlutil.RequeueE(ctx, err, "fetch RedisReplication")
|
||||
}
|
||||
|
||||
if instance.Spec.RedisSentinelConfig != nil {
|
||||
if rr.Status.MasterNode == "" || !k8sutils.IsRedisReplicationReady(ctx, r.K8sClient, r.Client, instance) {
|
||||
return intctrlutil.RequeueAfter(ctx, 20*time.Second, "RedisReplication not yet stabilised")
|
||||
}
|
||||
|
||||
// Start/refresh the watcher once we’re sure Redis is stable.
|
||||
r.ReplicationWatcher.Watch(
|
||||
ctx,
|
||||
types.NamespacedName{
|
||||
Namespace: instance.Namespace,
|
||||
Name: instance.Spec.RedisSentinelConfig.RedisReplicationName,
|
||||
Name: rr.Name,
|
||||
},
|
||||
types.NamespacedName{
|
||||
Namespace: instance.Namespace,
|
||||
|
@ -128,6 +142,10 @@ func (r *RedisSentinelReconciler) reconcileSentinel(ctx context.Context, instanc
|
|||
return intctrlutil.RequeueE(ctx, err, "")
|
||||
}
|
||||
|
||||
if rr.Status.MasterNode == "" {
|
||||
return intctrlutil.RequeueAfter(ctx, 20*time.Second, "Redis master not chosen yet")
|
||||
}
|
||||
|
||||
var monitorAddr string
|
||||
if master, err := r.Checker.GetMasterFromReplication(ctx, rr); err != nil {
|
||||
return intctrlutil.RequeueE(ctx, err, "")
|
||||
|
|
|
@ -54,6 +54,7 @@ func generateRedisClusterParams(ctx context.Context, cr *rcvb2.RedisCluster, rep
|
|||
Tolerations: params.Tolerations,
|
||||
ServiceAccountName: cr.Spec.ServiceAccountName,
|
||||
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
|
||||
PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
|
||||
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
|
||||
HostNetwork: cr.Spec.HostNetwork,
|
||||
MinReadySeconds: minreadyseconds,
|
||||
|
|
|
@ -105,6 +105,7 @@ func generateRedisReplicationParams(cr *rrvb2.RedisReplication) statefulSetParam
|
|||
TopologySpreadConstraints: cr.Spec.TopologySpreadConstrains,
|
||||
TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds,
|
||||
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
|
||||
PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
|
||||
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
|
||||
MinReadySeconds: minreadyseconds,
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ func generateRedisSentinelParams(ctx context.Context, cr *rsvb2.RedisSentinel, r
|
|||
TopologySpreadConstraints: cr.Spec.TopologySpreadConstrains,
|
||||
ServiceAccountName: cr.Spec.ServiceAccountName,
|
||||
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
|
||||
PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
|
||||
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
|
||||
MinReadySeconds: minreadyseconds,
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ func generateRedisStandaloneParams(cr *rvb2.Redis) statefulSetParameters {
|
|||
TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds,
|
||||
Tolerations: cr.Spec.Tolerations,
|
||||
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
|
||||
PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
|
||||
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
|
||||
MinReadySeconds: minreadyseconds,
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ type statefulSetParameters struct {
|
|||
ExternalConfig *string
|
||||
ServiceAccountName *string
|
||||
UpdateStrategy appsv1.StatefulSetUpdateStrategy
|
||||
PersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy
|
||||
RecreateStatefulSet bool
|
||||
RecreateStatefulsetStrategy *metav1.DeletionPropagation
|
||||
TerminationGracePeriodSeconds *int64
|
||||
|
@ -281,6 +282,7 @@ func generateStatefulSetsDef(stsMeta metav1.ObjectMeta, params statefulSetParame
|
|||
ServiceName: fmt.Sprintf("%s-headless", stsMeta.Name),
|
||||
Replicas: params.Replicas,
|
||||
UpdateStrategy: params.UpdateStrategy,
|
||||
PersistentVolumeClaimRetentionPolicy: params.PersistentVolumeClaimRetentionPolicy,
|
||||
MinReadySeconds: params.MinReadySeconds,
|
||||
Template: corev1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
Loading…
Reference in New Issue