Compare commits

..

11 Commits

Author SHA1 Message Date
Stephen Greenham 0b22e8d4e0
Merge 7d97824d97 into a2f7243c7f 2025-07-29 13:03:42 +08:00
yangw a2f7243c7f
feat: Add PDB values in redis replication (#1461)
* feat: Add PDB values in redis replication

Signed-off-by: yangw <wuyangmuc@gmail.com>

* add docs

Signed-off-by: yangw <wuyangmuc@gmail.com>

* fix lint

Signed-off-by: yangw <wuyangmuc@gmail.com>

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-28 11:25:41 +08:00
yangw 6d294f5cbe
fix: missing generate common types in api reference (#1460)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-27 21:15:42 +08:00
yangw ed95c2c660
feat: Add API doc generation tools and update Makefile (#1459)
- Introduced a new Makefile target `generate-api-docs` to automate API documentation generation using the `crd-ref-docs` tool.
- Added a new script `build.sh` for generating API documentation, including configuration for the documentation process.
- Created new documentation files for API reference, detailing the Redis API groups and resource types.
- Removed the obsolete Redis API documentation index file to streamline the documentation structure.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-27 20:23:42 +08:00
yangw fefd300cb9
feat: Implement RedisCluster clusterSize validation webhook (#1458)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-27 17:09:56 +08:00
Michel Zehnder cc0c9b0f92
docs: Fix obsolete links (#1457)
* Fix obsolete links

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>

* Remove obsolete paragraph

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>

---------

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>
2025-07-27 15:55:27 +08:00
Michel Zehnder 6d2ec60c8e
docs: Update release history (#1453)
* Update Release History

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>

* Update Release History v0.15.1

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>

* Update Release History

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>

* Update Release History

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>

---------

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>
2025-07-25 16:03:14 +08:00
Michel Zehnder aa8d2d9cf1
docs: Update CHANGELOG.md with latest information (#1454)
Update CHANGELOG.md with latest information

Signed-off-by: Michel Zehnder <MichelZ@users.noreply.github.com>
2025-07-25 16:00:11 +08:00
yangw a8ab85d4fa
docs: Sentinel recommendations and update security context fields (#1450)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-24 19:54:56 +08:00
Dee Kryvenko d17ea8b4bf
feat: Add PersistentVolumeClaimRetentionPolicy support (#1448)
Signed-off-by: Dee Kryvenko <dee@homecloud.zone>
2025-07-24 18:04:47 +08:00
dependabot[bot] 4a41f558dc
chore(deps): bump golang.org/x/oauth2 from 0.24.0 to 0.27.0 (#1447)
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.24.0 to 0.27.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.24.0...v0.27.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-version: 0.27.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-22 14:50:41 +08:00
42 changed files with 1894 additions and 533 deletions

View File

@ -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 ### v0.15.0
##### July 17, 2023 Latest ##### July 17, 2023
#### :beetle: Bug Fixes #### :beetle: Bug Fixes

View File

@ -41,6 +41,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION) GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
KUTTL = $(LOCALBIN)/kuttl-$(KUTTL_VERSION) KUTTL = $(LOCALBIN)/kuttl-$(KUTTL_VERSION)
KIND = $(LOCALBIN)/kind-$(KIND_VERSION) KIND = $(LOCALBIN)/kind-$(KIND_VERSION)
CRD_REF_DOCS = $(LOCALBIN)/crd-ref-docs-$(CRD_REF_DOCS_VERSION)
# Tool Versions # Tool Versions
KUSTOMIZE_VERSION ?= v5.6.0 KUSTOMIZE_VERSION ?= v5.6.0
@ -49,6 +50,7 @@ ENVTEST_VERSION ?= release-0.17
GOLANGCI_LINT_VERSION ?= v2.2.2 GOLANGCI_LINT_VERSION ?= v2.2.2
KUTTL_VERSION ?= 0.15.0 KUTTL_VERSION ?= 0.15.0
KIND_VERSION ?= v0.24.0 KIND_VERSION ?= v0.24.0
CRD_REF_DOCS_VERSION ?= v0.0.12
# Options for 'bundle-build' # Options for 'bundle-build'
ifneq ($(origin CHANNELS), undefined) ifneq ($(origin CHANNELS), undefined)
@ -134,6 +136,11 @@ vet:
generate: controller-gen generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." $(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 # Create a new builder instance for Docker Buildx with the specified platforms and set it as the current builder
.PHONY: docker-create .PHONY: docker-create
docker-create: docker-create:
@ -169,7 +176,7 @@ bundle-build:
# Rebuild all generated code # Rebuild all generated code
.PHONY: codegen .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. # Verify that codegen is up to date.
.PHONY: verify-codegen .PHONY: verify-codegen

View File

@ -3,8 +3,8 @@
</p> </p>
<p align="center"> <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"> <a href="https://github.com/OT-CONTAINER-KIT/redis-operator/actions/workflows/ci.yaml">
<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"> <img src="https://github.com/OT-CONTAINER-KIT/redis-operator/actions/workflows/ci.yaml/badge.svg" alt="CI Pipeline">
</a> </a>
<a href="https://goreportcard.com/report/github.com/OT-CONTAINER-KIT/redis-operator"> <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"> <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. 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) 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 - Ipv4 and Ipv6 support for redis setup
- Detailed monitoring grafana dashboard - 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 ## 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. 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.

View File

@ -1,4 +1,4 @@
package api package v1beta2
import ( import (
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
@ -8,15 +8,16 @@ import (
// KubernetesConfig will be the JSON struct for Basic Redis Config // KubernetesConfig will be the JSON struct for Basic Redis Config
// +k8s:deepcopy-gen=true // +k8s:deepcopy-gen=true
type KubernetesConfig struct { type KubernetesConfig struct {
Image string `json:"image"` Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"` Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
ExistingPasswordSecret *ExistingPasswordSecret `json:"redisSecret,omitempty"` ExistingPasswordSecret *ExistingPasswordSecret `json:"redisSecret,omitempty"`
ImagePullSecrets *[]corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"` ImagePullSecrets *[]corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
UpdateStrategy appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"` UpdateStrategy appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`
Service *ServiceConfig `json:"service,omitempty"` PersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"` Service *ServiceConfig `json:"service,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
} }
func (in *KubernetesConfig) GetServiceType() string { func (in *KubernetesConfig) GetServiceType() string {

View File

@ -1,4 +1,4 @@
package api package v1beta2
import ( import (
"testing" "testing"

21
api/common/v1beta2/doc.go Normal file
View File

@ -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

View File

@ -18,9 +18,10 @@ limitations under the License.
// Code generated by controller-gen. DO NOT EDIT. // Code generated by controller-gen. DO NOT EDIT.
package api package v1beta2
import ( import (
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
) )
@ -172,6 +173,11 @@ func (in *KubernetesConfig) DeepCopyInto(out *KubernetesConfig) {
} }
} }
in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy) 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 { if in.Service != nil {
in, out := &in.Service, &out.Service in, out := &in.Service, &out.Service
*out = new(ServiceConfig) *out = new(ServiceConfig)

View File

@ -17,15 +17,84 @@ limitations under the License.
package v1beta2 package v1beta2
import ( 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" 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 { func (r *RedisCluster) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr). return ctrl.NewWebhookManagedBy(mgr).
For(r). For(r).
Complete() 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
}

View File

@ -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
}

View File

@ -23,7 +23,7 @@ package v1beta2
import ( import (
commonv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2" commonv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
"k8s.io/api/core/v1" "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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

View File

@ -1564,6 +1564,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret
@ -6085,6 +6106,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret
@ -14779,6 +14821,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret
@ -20277,6 +20340,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret

View File

@ -1,8 +1,8 @@
apiVersion: v2 apiVersion: v2
name: redis-replication name: redis-replication
description: Provides easy redis setup definitions for Kubernetes services, and deployment. description: Provides easy redis setup definitions for Kubernetes services, and deployment.
version: 0.16.7 version: 0.16.8
appVersion: "0.16.7" appVersion: "0.16.8"
type: application type: application
engine: gotpl engine: gotpl
maintainers: maintainers:

View File

@ -65,6 +65,9 @@ helm delete <my-release> --namespace <namespace>
| initContainer.resources | object | `{}` | | | initContainer.resources | object | `{}` | |
| labels | object | `{}` | | | labels | object | `{}` | |
| nodeSelector | object | `{}` | | | nodeSelector | object | `{}` | |
| pdb.enabled | bool | `false` | |
| pdb.maxUnavailable | string | `nil` | |
| pdb.minAvailable | int | `1` | |
| podSecurityContext.fsGroup | int | `1000` | | | podSecurityContext.fsGroup | int | `1000` | |
| podSecurityContext.runAsUser | int | `1000` | | | podSecurityContext.runAsUser | int | `1000` | |
| priorityClassName | string | `""` | | | priorityClassName | string | `""` | |

View File

@ -95,4 +95,10 @@ spec:
{{- if .Values.env }} {{- if .Values.env }}
env: {{ toYaml .Values.env | nindent 4 }} env: {{ toYaml .Values.env | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.pdb.enabled }}
pdb:
enabled: {{ .Values.pdb.enabled }}
minAvailable: {{ .Values.pdb.minAvailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }}

View File

@ -156,3 +156,8 @@ acl:
env: [] env: []
# - name: VAR_NAME # - name: VAR_NAME
# value: "value1" # value: "value1"
pdb:
enabled: false
minAvailable: 1
maxUnavailable: null

View File

@ -1565,6 +1565,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret

View File

@ -715,6 +715,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret

View File

@ -1574,6 +1574,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret

View File

@ -1500,6 +1500,27 @@ spec:
minReadySeconds: minReadySeconds:
format: int32 format: int32
type: integer 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: redisSecret:
description: ExistingPasswordSecret is the struct to access the description: ExistingPasswordSecret is the struct to access the
existing secret existing secret

View File

@ -1,8 +1,8 @@
--- ---
apiVersion: admissionregistration.k8s.io/v1 apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration kind: ValidatingWebhookConfiguration
metadata: metadata:
name: mutating-webhook-configuration name: validating-webhook-configuration
webhooks: webhooks:
- admissionReviewVersions: - admissionReviewVersions:
- v1 - v1
@ -10,25 +10,20 @@ webhooks:
service: service:
name: webhook-service name: webhook-service
namespace: system namespace: system
path: /mutate-core-v1-pod path: /validate-redis-redis-opstreelabs-in-v1beta2-rediscluster
failurePolicy: Fail failurePolicy: Fail
name: ot-mutate-pod.opstree.com name: validate-rediscluster.redis.opstreelabs.in
rules: rules:
- apiGroups: - apiGroups:
- "" - redis.redis.opstreelabs.in
apiVersions: apiVersions:
- v1 - v1beta2
operations: operations:
- CREATE - CREATE
- UPDATE
resources: resources:
- pods - redisclusters
sideEffects: None sideEffects: None
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: validating-webhook-configuration
webhooks:
- admissionReviewVersions: - admissionReviewVersions:
- v1 - v1
clientConfig: clientConfig:

View File

@ -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 | | |

View File

@ -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 |

View File

@ -7,6 +7,8 @@ description: >
Instructions for setting up Redis Replication 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 ## 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. 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"> <img src="../../../images/replication-redis.png">
</div> </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 ## Helm Installation
For redis replication setup we can use `helm` command with the reference of replication helm chart and additional properties: 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 name: redis-replication
spec: spec:
clusterSize: 3 clusterSize: 3
securityContext: podSecurityContext:
runAsUser: 1000 runAsUser: 1000
fsGroup: 1000 fsGroup: 1000
kubernetesConfig: kubernetesConfig:

View File

@ -78,7 +78,7 @@ spec:
resources: resources:
requests: requests:
storage: 1Gi storage: 1Gi
securityContext: podSecurityContext:
runAsUser: 1000 runAsUser: 1000
fsGroup: 1000 fsGroup: 1000
``` ```

View File

@ -2,14 +2,14 @@
title: "Overview" title: "Overview"
linkTitle: "Overview" linkTitle: "Overview"
weight: 1 weight: 1
date: 2022-11-02T00:19:19Z date: 2025-07-25T00:00:00Z
description: > description: >
Redis Operator is a software to set up and manage Redis on [Kubernetes](https://kubernetes.io). 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. 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:- The type of Redis setup which is currently supported:-

View File

@ -2,10 +2,325 @@
title: "Release History" title: "Release History"
linkTitle: "Release History" linkTitle: "Release History"
weight: 10 weight: 10
date: 2022-11-02T00:19:19Z date: 2025-07-25T00:00:00Z
description: > description: >
Release versions and their description about Redis Operator 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 clusters 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 ### v0.13.0
##### November 10, 2022 ##### November 10, 2022

View File

@ -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

View File

@ -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

View File

@ -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
View File

@ -68,7 +68,7 @@ require (
go.uber.org/zap v1.26.0 // indirect go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.38.0 // 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/sys v0.32.0 // indirect
golang.org/x/term v0.30.0 // indirect golang.org/x/term v0.30.0 // indirect
golang.org/x/text v0.23.0 // indirect golang.org/x/text v0.23.0 // indirect

4
go.sum
View File

@ -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 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= 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.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.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= 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-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-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

44
hack/api-docs/build.sh Executable file
View File

@ -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"

10
hack/api-docs/config.yaml Normal file
View File

@ -0,0 +1,10 @@
processor:
ignoreTypes:
- ".*List$"
- ".*Status$"
ignoreFields:
- "TypeMeta"
- "ObjectMeta"
render:
kubernetesVersion: "1.31"
renderer: "markdown"

View File

@ -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 -}}

View File

@ -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 -}}

View File

@ -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 -}}

View File

@ -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 -}}

View File

@ -42,21 +42,22 @@ func generateRedisClusterParams(ctx context.Context, cr *rcvb2.RedisCluster, rep
minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds
} }
res := statefulSetParameters{ res := statefulSetParameters{
Replicas: &replicas, Replicas: &replicas,
ClusterMode: true, ClusterMode: true,
ClusterVersion: cr.Spec.ClusterVersion, ClusterVersion: cr.Spec.ClusterVersion,
NodeSelector: params.NodeSelector, NodeSelector: params.NodeSelector,
TopologySpreadConstraints: params.TopologySpreadConstraints, TopologySpreadConstraints: params.TopologySpreadConstraints,
PodSecurityContext: cr.Spec.PodSecurityContext, PodSecurityContext: cr.Spec.PodSecurityContext,
PriorityClassName: cr.Spec.PriorityClassName, PriorityClassName: cr.Spec.PriorityClassName,
Affinity: params.Affinity, Affinity: params.Affinity,
TerminationGracePeriodSeconds: params.TerminationGracePeriodSeconds, TerminationGracePeriodSeconds: params.TerminationGracePeriodSeconds,
Tolerations: params.Tolerations, Tolerations: params.Tolerations,
ServiceAccountName: cr.Spec.ServiceAccountName, ServiceAccountName: cr.Spec.ServiceAccountName,
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy, UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations, PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
HostNetwork: cr.Spec.HostNetwork, IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
MinReadySeconds: minreadyseconds, HostNetwork: cr.Spec.HostNetwork,
MinReadySeconds: minreadyseconds,
} }
if cr.Spec.RedisExporter != nil { if cr.Spec.RedisExporter != nil {
res.EnableMetrics = cr.Spec.RedisExporter.Enabled res.EnableMetrics = cr.Spec.RedisExporter.Enabled

View File

@ -94,19 +94,20 @@ func generateRedisReplicationParams(cr *rrvb2.RedisReplication) statefulSetParam
minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds
} }
res := statefulSetParameters{ res := statefulSetParameters{
Replicas: &replicas, Replicas: &replicas,
ClusterMode: false, ClusterMode: false,
NodeConfVolume: false, NodeConfVolume: false,
NodeSelector: cr.Spec.NodeSelector, NodeSelector: cr.Spec.NodeSelector,
PodSecurityContext: cr.Spec.PodSecurityContext, PodSecurityContext: cr.Spec.PodSecurityContext,
PriorityClassName: cr.Spec.PriorityClassName, PriorityClassName: cr.Spec.PriorityClassName,
Affinity: cr.Spec.Affinity, Affinity: cr.Spec.Affinity,
Tolerations: cr.Spec.Tolerations, Tolerations: cr.Spec.Tolerations,
TopologySpreadConstraints: cr.Spec.TopologySpreadConstrains, TopologySpreadConstraints: cr.Spec.TopologySpreadConstrains,
TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds, TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds,
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy, UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations, PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
MinReadySeconds: minreadyseconds, IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
MinReadySeconds: minreadyseconds,
} }
if cr.Spec.KubernetesConfig.ImagePullSecrets != nil { if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {
res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets

View File

@ -92,20 +92,21 @@ func generateRedisSentinelParams(ctx context.Context, cr *rsvb2.RedisSentinel, r
minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds
} }
res := statefulSetParameters{ res := statefulSetParameters{
Replicas: &replicas, Replicas: &replicas,
ClusterMode: false, ClusterMode: false,
NodeConfVolume: false, NodeConfVolume: false,
NodeSelector: cr.Spec.NodeSelector, NodeSelector: cr.Spec.NodeSelector,
PodSecurityContext: cr.Spec.PodSecurityContext, PodSecurityContext: cr.Spec.PodSecurityContext,
PriorityClassName: cr.Spec.PriorityClassName, PriorityClassName: cr.Spec.PriorityClassName,
Affinity: affinity, Affinity: affinity,
TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds, TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds,
Tolerations: cr.Spec.Tolerations, Tolerations: cr.Spec.Tolerations,
TopologySpreadConstraints: cr.Spec.TopologySpreadConstrains, TopologySpreadConstraints: cr.Spec.TopologySpreadConstrains,
ServiceAccountName: cr.Spec.ServiceAccountName, ServiceAccountName: cr.Spec.ServiceAccountName,
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy, UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations, PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
MinReadySeconds: minreadyseconds, IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
MinReadySeconds: minreadyseconds,
} }
if cr.Spec.KubernetesConfig.ImagePullSecrets != nil { if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {

View File

@ -102,18 +102,19 @@ func generateRedisStandaloneParams(cr *rvb2.Redis) statefulSetParameters {
minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds minreadyseconds = *cr.Spec.KubernetesConfig.MinReadySeconds
} }
res := statefulSetParameters{ res := statefulSetParameters{
Replicas: &replicas, Replicas: &replicas,
ClusterMode: false, ClusterMode: false,
NodeConfVolume: false, NodeConfVolume: false,
NodeSelector: cr.Spec.NodeSelector, NodeSelector: cr.Spec.NodeSelector,
PodSecurityContext: cr.Spec.PodSecurityContext, PodSecurityContext: cr.Spec.PodSecurityContext,
PriorityClassName: cr.Spec.PriorityClassName, PriorityClassName: cr.Spec.PriorityClassName,
Affinity: cr.Spec.Affinity, Affinity: cr.Spec.Affinity,
TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds, TerminationGracePeriodSeconds: cr.Spec.TerminationGracePeriodSeconds,
Tolerations: cr.Spec.Tolerations, Tolerations: cr.Spec.Tolerations,
UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy, UpdateStrategy: cr.Spec.KubernetesConfig.UpdateStrategy,
IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations, PersistentVolumeClaimRetentionPolicy: cr.Spec.KubernetesConfig.PersistentVolumeClaimRetentionPolicy,
MinReadySeconds: minreadyseconds, IgnoreAnnotations: cr.Spec.KubernetesConfig.IgnoreAnnotations,
MinReadySeconds: minreadyseconds,
} }
if cr.Spec.KubernetesConfig.ImagePullSecrets != nil { if cr.Spec.KubernetesConfig.ImagePullSecrets != nil {
res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets res.ImagePullSecrets = cr.Spec.KubernetesConfig.ImagePullSecrets

View File

@ -97,29 +97,30 @@ const (
// statefulSetParameters will define statefulsets input params // statefulSetParameters will define statefulsets input params
type statefulSetParameters struct { type statefulSetParameters struct {
Replicas *int32 Replicas *int32
ClusterMode bool ClusterMode bool
ClusterVersion *string ClusterVersion *string
NodeConfVolume bool NodeConfVolume bool
NodeSelector map[string]string NodeSelector map[string]string
TopologySpreadConstraints []corev1.TopologySpreadConstraint TopologySpreadConstraints []corev1.TopologySpreadConstraint
PodSecurityContext *corev1.PodSecurityContext PodSecurityContext *corev1.PodSecurityContext
PriorityClassName string PriorityClassName string
Affinity *corev1.Affinity Affinity *corev1.Affinity
Tolerations *[]corev1.Toleration Tolerations *[]corev1.Toleration
EnableMetrics bool EnableMetrics bool
PersistentVolumeClaim corev1.PersistentVolumeClaim PersistentVolumeClaim corev1.PersistentVolumeClaim
NodeConfPersistentVolumeClaim corev1.PersistentVolumeClaim NodeConfPersistentVolumeClaim corev1.PersistentVolumeClaim
ImagePullSecrets *[]corev1.LocalObjectReference ImagePullSecrets *[]corev1.LocalObjectReference
ExternalConfig *string ExternalConfig *string
ServiceAccountName *string ServiceAccountName *string
UpdateStrategy appsv1.StatefulSetUpdateStrategy UpdateStrategy appsv1.StatefulSetUpdateStrategy
RecreateStatefulSet bool PersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy
RecreateStatefulsetStrategy *metav1.DeletionPropagation RecreateStatefulSet bool
TerminationGracePeriodSeconds *int64 RecreateStatefulsetStrategy *metav1.DeletionPropagation
IgnoreAnnotations []string TerminationGracePeriodSeconds *int64
HostNetwork bool IgnoreAnnotations []string
MinReadySeconds int32 HostNetwork bool
MinReadySeconds int32
} }
// containerParameters will define container input params // containerParameters will define container input params
@ -277,11 +278,12 @@ func generateStatefulSetsDef(stsMeta metav1.ObjectMeta, params statefulSetParame
TypeMeta: generateMetaInformation("StatefulSet", "apps/v1"), TypeMeta: generateMetaInformation("StatefulSet", "apps/v1"),
ObjectMeta: stsMeta, ObjectMeta: stsMeta,
Spec: appsv1.StatefulSetSpec{ Spec: appsv1.StatefulSetSpec{
Selector: LabelSelectors(selectorLabels), Selector: LabelSelectors(selectorLabels),
ServiceName: fmt.Sprintf("%s-headless", stsMeta.Name), ServiceName: fmt.Sprintf("%s-headless", stsMeta.Name),
Replicas: params.Replicas, Replicas: params.Replicas,
UpdateStrategy: params.UpdateStrategy, UpdateStrategy: params.UpdateStrategy,
MinReadySeconds: params.MinReadySeconds, PersistentVolumeClaimRetentionPolicy: params.PersistentVolumeClaimRetentionPolicy,
MinReadySeconds: params.MinReadySeconds,
Template: corev1.PodTemplateSpec{ Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: stsMeta.GetLabels(), Labels: stsMeta.GetLabels(),