Compare commits

...

419 Commits

Author SHA1 Message Date
yangw 9280c02f22
fix: improve kubeClientQPS type consistency in operator chart (#1485)
* fix: improve kubeClientQPS type consistency in operator chart

  - Use explicit float comparison (0.0) in deployment template
  - Update values.yaml kubeClientQPS default from 0 to 0.0 for type consistency
  - Ensures proper float64 type handling in Helm template condition

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

* update docs

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

* remove condition

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

* update test config

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

* fix lint

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-08-29 16:46:57 +08:00
Daniel Goldman 0fa816c684
fix: do not remove default config volume when providing additional config (#1480)
fix: do not remove default config volume when providing external config

closes #1479

Signed-off-by: Daniel Goldman <danielgoldman4@gmail.com>
2025-08-21 21:15:30 +08:00
Tian 891b85590c
fix: Fix the issue where Sentinel fails to monitor one replica replication (#1481)
* fix: Solve the issue where Sentinel fails to work when starting 1 Master Replication

Signed-off-by: tcxdgit <tiancuixia92@163.com>

* fix: Fix failure to get monitorAddr in reconcileSentinel for single instance

Signed-off-by: tcxdgit <tiancuixia92@163.com>

---------

Signed-off-by: tcxdgit <tiancuixia92@163.com>
2025-08-21 20:37:05 +08:00
Jeffrey Boehm 3d52fdb0b7
feat: Add SecurityContext to init-config when behind GenerateConfigInInitContainer feature flag
feat: Add SecurityContext to Redis init containers in tests and configurations when behind GenerateConfigInInitContainer feature flag

Signed-off-by: Jeffrey Böhm <hello@jeffrey-boehm.de>
2025-08-14 16:35:10 +08:00
yangw 88d688acc5
docs: Rename Size to ClusterSize in RedisClusterSpec and update related comments (#1475)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-08-07 19:43:43 +08:00
dcaputo-harmoni e4faaeb5b7
fix: Recover redisreplication from master pod deletion without sentinel(#1449)
* Recover from orphaned master

Signed-off-by: David Caputo <dcaputo@harmoni.io>

* Fix linting error

Signed-off-by: David Caputo <dcaputo@harmoni.io>

* fix lint

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

---------

Signed-off-by: David Caputo <dcaputo@harmoni.io>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-08-07 14:45:28 +08:00
yangw 809d48e57e
feat: Add kubeClientQPS and kubeClientTimeout configuration options (#1473)
* feat: Add kubeClientQPS and kubeClientTimeout configuration options

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

* fix no flags in viper

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-08-06 22:25:09 +08:00
dependabot[bot] e1004c0352
chore(deps): bump sigstore/cosign-installer from 3.9.1 to 3.9.2 (#1465)
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.9.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-06 15:32:48 +08:00
yangw afd663611c
fix: tls connection broken in replication with sentinel (#1472)
* feat: support tls in replication with sentinel

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

* fix lint

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

* fix lint

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

* fix monitor

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

* tls flag

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-08-06 11:40:18 +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
dependabot[bot] 321cc1d498
chore(deps): bump golangci/golangci-lint-action from 6 to 8 (#1311)
* chore(deps): bump golangci/golangci-lint-action from 6 to 7

Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* update golangci lint

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

* update version

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

* upgrade yaml

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

* remove useless

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

* fix lint

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

* fix lint

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

* fixlint

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

* fix test

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

* fix lint

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-07-18 17:04:25 +08:00
yangw 55eaf4499e
docs: Update Redis Operator README and Sentinel documentation (#1439)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-08 15:42:08 +08:00
Fatih Sarhan 1414470dcd
docs: Add controller metrics guide and Grafana dashboard for Redis Operator (#1438)
* feat(monitoring): expose existing controller metrics via operator pod and add docs/dashboard

Signed-off-by: Fatih Sarhan <f9n@protonmail.com>

* docs(metrics): add spacing for improved readability in auto-generated metrics docs

Signed-off-by: Fatih Sarhan <f9n@protonmail.com>

* custom port

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

* upgrade

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

---------

Signed-off-by: Fatih Sarhan <f9n@protonmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-07-07 22:04:30 +08:00
Fatih Sarhan 2f214a99c6
docs: Update slack channel link and improve sharding section clarity (#1437)
fix(docs): Update slack channel link and improve sharding section clarity

Signed-off-by: Fatih Sarhan <f9n@protonmail.com>
2025-07-07 10:36:44 +08:00
yangw 97662c17fa
docs: update Redis API documentation for security context fields (#1435)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-06 19:16:36 +08:00
Stephen Greenham 558a12c2b1
fix: sentinel controller should reconcile on statefulset updated (#1432)
* feat: enable periodic reconciliation for Redis Sentinel to handle pod restarts and lost endpoints

* reconcile on event

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-07-05 22:32:05 +08:00
Fatih Sarhan 87f28cabda
docs: Update edit URL path (#1434)
fix(docs): Update edit URL path

Signed-off-by: Fatih Sarhan <f9n@protonmail.com>
2025-07-05 21:06:16 +08:00
yangw 5e53f08ac0
feat: add pprof configuration for performance profiling (#1431)
This update allows users to enable and configure pprof for better performance monitoring of the redis-operator.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-05 20:56:31 +08:00
Dimitar Pavlov 9d15e21011
feat: RedisCluster controller: attempt to repair disconnected nodes whenever detected (#1426)
* repair nodes whenever any has failed

Signed-off-by: dimitar <dimpavloff@gmail.com>

* lint

Signed-off-by: dimitar <dimpavloff@gmail.com>

---------

Signed-off-by: dimitar <dimpavloff@gmail.com>
2025-07-03 15:45:21 +08:00
yangw d1ab41c185
refactor: introduce common constants and finalizer utilities for Redis controllers (#1428)
* refactor: introduce common constants and finalizer utilities for Redis controllers

- Added a new `constants.go` file to define common constants used across Redis controllers, including annotation keys and port numbers.
- Introduced `finalizer.go` to implement finalizer management functions for graceful deletion of Redis resources.
- Updated various Redis controller files to utilize the new common constants and finalizer functions, enhancing code consistency and maintainability.

This update improves the organization of shared constants and finalizer logic, streamlining the development of Redis controllers.

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

* fix for lint

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-03 11:46:48 +08:00
dependabot[bot] 9b52e0eaa3
chore(deps): bump github.com/redis/go-redis/v9 from 9.9.0 to 9.11.0 (#1423)
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.9.0 to 9.11.0.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.9.0...v9.11.0)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-version: 9.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 22:10:47 +08:00
dependabot[bot] baa2866f74
chore(deps): bump sigstore/cosign-installer from 3.8.2 to 3.9.1 (#1419)
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.8.2 to 3.9.1.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.8.2...v3.9.1)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.9.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-01 22:10:16 +08:00
yangw 07103da639
refactor: remove dynamic client usage and streamline Kubernetes client interactions (#1420)
* refactor: remove dynamic client usage and streamline Kubernetes client interactions

- Eliminated the dynamic Kubernetes client from the codebase, simplifying client creation and usage across controllers and utility functions.
- Updated relevant functions and method signatures to use the standard Kubernetes client interface, enhancing code clarity and maintainability.
- Adjusted controller logic to ensure proper handling of Redis cluster and sentinel operations without the dynamic client.

This refactor improves the overall architecture and reduces complexity in client management.

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-01 22:08:25 +08:00
yangw 2389f9c38a
fix: add webhook condition to service template (#1418)
- Updated the redis-operator version in Chart.yaml to 0.21.1.
- Added a conditional statement in service.yaml to include webhook configuration based on user-defined values.

fix #1440

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-07-01 14:28:02 +08:00
yangw ae4bef14e2
chore: add sync-crds target to Makefile (#1417)
- Introduced a new `sync-crds` target in the Makefile to sync CRDs to the chart directory.
- Added `charts/redis-operator/crds/crds.yaml` to define the Redis CRD.
- Removed outdated CRD YAML files for Redis resources to streamline the codebase.

This update enhances the management of CRDs within the Redis operator, ensuring they are properly synced and organized.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-06-30 21:48:37 +08:00
yangw beb30bef46
chore: update operator to version 0.21.0 and adjust CRD annotations (#1416)
* add github user in release note

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

* chore: update operator to version 0.21.0 and adjust CRD annotations

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-06-30 17:59:03 +08:00
yangw 8499c3fdaf Update version
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-06-30 17:12:54 +08:00
Dimitar Pavlov 4d200a3ea0
feat: Round robin where to transfer cluster shards when scaling in a Redis Cluster (#1412)
* round robin where to move shards when scaling in

Signed-off-by: dimitar <dimpavloff@gmail.com>

* rename slot to slots

Signed-off-by: dimitar <dimpavloff@gmail.com>

* rename target to transfer variables for consistency

Signed-off-by: dimitar <dimpavloff@gmail.com>

* swap function parameters for better cohesion

Signed-off-by: dimitar <dimpavloff@gmail.com>

* fail fast and log

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

* try log

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

---------

Signed-off-by: dimitar <dimpavloff@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-06-20 20:19:48 +08:00
yangw 261dc1d9bb
feat: add auto max memory configuration for Redis instances (#1411)
* feat: add auto max memory configuration for Redis instances

- Introduced MaxMemoryPercentOfLimit field in RedisConfig to specify the percentage of container memory limit to be used as maxmemory.
- Updated CRD definitions to include validation for MaxMemoryPercentOfLimit with minimum and maximum constraints.
- Enhanced container parameter generation to utilize MaxMemoryPercentOfLimit for Redis cluster, replication, and standalone configurations.
- Added e2e tests to verify maxmemory settings for Redis instances.

This feature improves memory management for Redis deployments, allowing for better resource utilization.

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

* fix test

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

* fix lint

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

* fix lint

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

* fix command

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-06-18 16:51:04 +08:00
yangw 00f44f85d9
feat: add bus port configuration for Redis cluster services (#1406)
* feat: add bus port configuration for Redis cluster services

- Introduced new methods in KubernetesConfig to determine if the bus port should be included for headless and additional services.
- Updated ServiceConfig and Service structs to include an optional IncludeBusPort field.
- Enhanced service creation logic to conditionally add the bus port based on the new configuration.
- Updated CRD definitions to reflect the new IncludeBusPort field and its description.
- Modified e2e tests to validate the inclusion of the bus port in service configurations.

This enhancement allows for better customization of Redis service configurations, particularly for Redis cluster mode.

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

* fix test

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-06-17 15:47:00 +08:00
yangw 4cccf2ef32
feat: add automatic Redis pod role label synchronization for rediscluster (#1404)
* feat: enhance Redis healing capabilities with role label updates

- Introduced UpdateRedisRoleLabel method in the Healer interface to update pod role labels based on their master/slave status.
- Updated RedisReplication and RedisSentinel controllers to utilize the new role label updating functionality.
- Refactored the setup of controllers to use a single instance of Healer for consistency.

This enhancement improves the management of Redis pod roles within the cluster, ensuring accurate labeling and better operational reliability.

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

* fix update not label

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

* feat: enhance Redis cluster role management with common label updates

- Added a new common package to define Redis setup types and label management functions.
- Integrated role label updates in the RedisCluster and RedisReplication controllers to ensure accurate pod role labeling during failover scenarios.
- Updated the RedisCluster service creation to include a common cluster label for better identification.
- Enhanced e2e tests to validate the new role update functionality and service configurations.

This update improves the operational reliability and observability of Redis clusters by ensuring consistent labeling across components.

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

* fix lint

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

* add sleep

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

* remove useless

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

* refactor

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-06-13 16:19:17 +08:00
Husni Alhamdani 47aad6570d
feat: rediscluster observability (#1392)
* feat: rediscluster observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: rediscluster observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-06-04 20:36:36 +08:00
dependabot[bot] 116153f1e6
chore(deps): bump github.com/redis/go-redis/v9 from 9.7.3 to 9.9.0 (#1386)
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.7.3 to 9.9.0.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.7.3...v9.9.0)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-version: 9.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-02 09:51:40 +00:00
dependabot[bot] 0b6fdd6fb5
chore(deps): bump github.com/go-logr/logr from 1.4.2 to 1.4.3 (#1388)
Bumps [github.com/go-logr/logr](https://github.com/go-logr/logr) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/go-logr/logr/releases)
- [Changelog](https://github.com/go-logr/logr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-logr/logr/compare/v1.4.2...v1.4.3)

---
updated-dependencies:
- dependency-name: github.com/go-logr/logr
  dependency-version: 1.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-02 17:18:28 +08:00
yangw 5b0641f686
refactor: reorganiz manager agent cmd package (#1383)
- Introduced a new configuration generation system for Redis and Sentinel, encapsulated in the `bootstrap` package.
- Added `Task` struct to manage configuration generation based on the selected mode (Redis or Sentinel).
- Implemented `GenerateConfig` functions for both Redis and Sentinel, allowing for dynamic configuration based on environment variables.
- Updated command structure to use `CMD()` methods for agent and manager commands, enhancing command organization.
- Removed deprecated `generate_config.go` file to streamline the codebase.

This update enhances the flexibility and configurability of the Redis operator, allowing for better integration with Kubernetes environments.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-06-01 08:17:52 +08:00
yangw a0466fc09d
fix: resolve StatefulSet selector immutability issues (#1382)
* fix: resolve StatefulSet selector immutability issues with Helm deployments

- Add extractStatefulSetSelectorLabels() to filter stable labels for StatefulSet selectors
- Modify generateStatefulSetsDef() to use filtered selector labels while preserving all labels in metadata/templates
- Revert Service selector changes as Service selectors are mutable and don't require filtering
- Add comprehensive tests for StatefulSet selector label filtering
- Fixes #546 and #488: StatefulSet forbidden errors during Helm chart upgrades

This change ensures StatefulSet selectors only contain stable labels (app, redis_setup_type, role)
while allowing mutable Helm-managed labels (helm.sh/chart, app.kubernetes.io/version) in metadata.

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

* fix test

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

* simple test

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

* fix syntax

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-31 18:00:44 +08:00
yangw 14684ccc92
feat: avoid sentinel restart after replication failover (#1381)
* feat: implement Redis health check and healing mechanisms

- Added Checker and Healer interfaces to manage Redis replication and sentinel health.
- Introduced methods for checking master status and resetting sentinels.
- Updated RedisSentinelReconciler to utilize the new health check and healing functionalities.

This enhancement improves the reliability and self-healing capabilities of the Redis operator.

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

* fix Lint

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

* fix lint

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

* fix nil

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

* fix name

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

* fix client closed

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

* fix test

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-30 18:01:39 +08:00
yangw 903520db59
feat: add liveness/readiness probes to values.yaml and templates (#1378)
- Updated Chart.yaml to version 0.17.0.
- Added livenessProbe and readinessProbe configurations to values.yaml for both leader and follower.
- Updated _helpers.tpl to include livenessProbe and readinessProbe in the rendered templates.

This update enhances the Redis cluster's health monitoring capabilities.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-28 15:48:30 +08:00
yangw 45ba5259a5
feat: reduce uncessary requeue when skip reconcile annotation exists (#1374)
* fix: reduce uncessary requeue when skip reconcile annotation exists

- Added a new package `common` with a function `IsSkipReconcile` to check for skip-reconcile annotations on Redis, RedisCluster, RedisReplication, and RedisSentinel resources.
- Updated Redis, RedisCluster, RedisReplication, and RedisSentinel controllers to utilize the skip-reconcile logic.
- Introduced unit tests to validate the skip-reconcile behavior for each resource type.

This enhancement allows for more flexible reconciliation management in the Redis operator.

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

* fix

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-28 14:41:43 +08:00
yangw d3138c6a1b
docs: add important notes on redisReplicationName parameter in Sentinel documentation (#1375)
- Added a note emphasizing that the `redisReplicationName` parameter must reference an existing RedisReplication resource.
- Included a reminder to deploy a RedisReplication resource before installing Sentinel to ensure proper functionality.

This update clarifies the prerequisites for using Redis Sentinel effectively.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-28 11:48:31 +08:00
yangw 70b4c3f27b
docs: update release version to 0.20.2 in config.toml (#1372)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-27 15:09:00 +08:00
yangw 66fe81c58c
docs: update weight for Feature Gates documentation (#1370) (#1371)
- Increased the weight of the Feature Gates section from 30 to 40 to adjust its prominence in the documentation hierarchy.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-26 21:54:32 +08:00
Husni Alhamdani 587fecd1d5
feat: redisreplication observability, skip reconcile or not (#1369)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-05-23 14:16:51 +08:00
yangw 35bee34d11
chore: add GitHub Actions workflow for automatic release creation on tag push (#1364)
- Introduced a new workflow that triggers on tag pushes matching 'v*'.
- Configured steps to check for existing releases, generate release notes, and create a new GitHub release if none exists.
- This automation streamlines the release process for the Redis operator.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-21 11:38:17 +08:00
yangw 00165cb4ac
refactor: reorganize API structure and update paths (#1363)
* refactor: reorganize Redis API structure and update paths

- Updated the paths for Redis, RedisCluster, RedisReplication, and RedisSentinel APIs to reflect the new directory structure.
- Added new group version files for Redis, RedisCluster, RedisReplication, and RedisSentinel.
- Implemented conversion and webhook functionalities for the new API versions.
- Removed deprecated v1beta2 API files to streamline the codebase.

This refactor enhances the organization and maintainability of the Redis operator's API structure.

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

* fix

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-19 17:53:37 +08:00
yangw 3377056d8e
refactor: remove useless structure and refactor package (#1362)
- Added new KubernetesConfig and ServiceConfig types to define Redis configurations.
- Implemented methods for service type and annotations retrieval.
- Created unit tests for ShouldCreateAdditionalService logic in KubernetesConfig.
- Removed deprecated v1beta2/common_types.go file and migrated relevant code to the new structure.

This update enhances the configuration management for Redis in the operator.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-19 11:05:47 +08:00
yangw 66abbb6f4f
feat: add Redis Sentinel validation webhook for clusterSize (#1361)
* feat: add Redis Sentinel validation webhook for clusterSize

- Implemented a validation webhook for Redis Sentinel to ensure the cluster size is an odd number for proper leader election.
- Added test cases for the validation webhook to verify successful and failed creation scenarios.
- Updated webhook configuration in manifests to include the new validation rules.

This enhances the reliability of Redis Sentinel configurations in the operator.

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

* fix

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

* fix

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-18 21:30:41 +08:00
yangw 069e6b913d
chore: bump version to 0.20.3 in operator Chart.yaml (#1355)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-14 14:24:57 +08:00
Belly-Buster f9f28e9889
fix: define named probe port outside webhook block (#1353) (#1354)
Signed-off-by: Belly Buster
Signed-off-by: Belly Buster <60049331+Belly-Buster@users.noreply.github.com>
2025-05-14 14:21:52 +08:00
yangw 59fa0e6ce3
refactor: reorganize command structure for Redis operator (#1351)
* refactor: reorganize command structure for Redis operator

- Moved command definitions for agent and manager into separate files for better organization.
- Introduced new bootstrap command for initializing Redis and Sentinel configurations.
- Updated main command to utilize the new command structure.

This refactor enhances the maintainability and clarity of the command handling in the Redis operator.

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

* fix

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-12 22:56:54 +08:00
yangw 08d13a516f
chore: bump version to 0.20.2 (#1349)
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-05-12 17:24:48 +08:00
BoShuai Li 0270861930
docs: fix Redis Cluster YAML Manifest Example (#1345) (#1346)
Co-authored-by: yangw <yang.wu@daocloud.io>
2025-05-12 16:12:20 +08:00
John Paul K J 16ebe4a2fc
fix: Service updated before Statefulset during Reconcilation #1347 (#1348)
fix: Service updated before Statefulset during Reconcilation(#1347)

Signed-off-by: John Paul K J <polestar2john@gmail.com>
2025-05-12 15:42:29 +08:00
Dimitar Pavlov f8ed8f7ad9
fix: VCT resize detection logic; add support for scaling out with new VCT size (#1342)
* Fix VCT resize detection logic; support for scaling out with new VCT size

Signed-off-by: dimitar <dimpavloff@gmail.com>

* fix lint

Signed-off-by: dimitar <dimpavloff@gmail.com>

* format

Signed-off-by: dimitar <dimpavloff@gmail.com>

* add test case

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

---------

Signed-off-by: dimitar <dimpavloff@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-05-12 14:52:51 +08:00
Maxence Boutet 5435979283
docs: fix redis sentinel example (#1343)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2025-05-07 15:05:11 +00:00
PRANSHU RAJ d5206c14b4
chore: migrate kubebuilder go.kubebuilder.io/v3 to go.kubebuilder.io/v4 (#1340)
* chore: migrate kubebuilder go.kubebuilder.io/v3 to go.kubebuilder.io/v4

Signed-off-by: pranshu-raj <pranshuraj828@gmail.com>

* Update CRDs and manager image version

- Updated controller-gen version in Redis CRDs from v0.14.0 to v0.17.2.
- Adjusted kustomization files to use 'resources' instead of 'bases'.

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* refactor: rename pkg to internal and rename controllers to controller

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* refactor: remove pkg directory from Dockerfile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: pranshu-raj <pranshuraj828@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2025-05-03 13:23:50 +05:30
dependabot[bot] 4e5c951fe9
chore(deps): bump github.com/prometheus/client_golang from 1.19.0 to 1.22.0 (#1337)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-03 13:06:47 +05:30
dependabot[bot] 7a1a167a31
chore(deps): bump sigstore/cosign-installer from 3.8.1 to 3.8.2 (#1335)
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.8.1 to 3.8.2.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.8.1...v3.8.2)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-02 14:36:39 +05:30
dependabot[bot] ef7372d9c2
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.22.2 to 2.23.4 (#1338)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.22.2 to 2.23.4.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.22.2...v2.23.4)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-version: 2.23.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-02 14:36:01 +05:30
dependabot[bot] cf0b8dac0d
chore(deps): bump github.com/onsi/gomega from 1.36.2 to 1.37.0 (#1336)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.36.2 to 1.37.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.36.2...v1.37.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-version: 1.37.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-02 14:11:11 +08:00
yangw 0654e13b30
feat: add feature gates support for Redis Operator (#1333)
* feat: add feature gates support for Redis Operator

- Introduced feature gates in values.yaml to enable alpha/experimental features.
- Updated operator-deployment.yaml to include FEATURE_GATES environment variable based on the configured feature gates.
- Added documentation for feature gates, including configuration and lifecycle details.

These changes enhance the configurability of the Redis Operator by allowing users to enable experimental features.

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

* docs

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-04-29 22:09:37 +08:00
yangw 828c187442
feat: add data assertion generation and enhance Redis configuration commands (#1331)
* feat: add data assertion generation and enhance Redis configuration commands

- Updated Makefile to include new targets for generating data assertions and metrics documentation.
- Enhanced main.go in data-assert to support a new flag for Redis sentinel password.
- Added new test cases for Redis high availability setup, including master IP consistency checks and data assertions.

These changes improve the testing capabilities and configuration management for Redis deployments.

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

* fix

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

* fix

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

* fix

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

* fix

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

* debug

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

* fix

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

* fix

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

* fix

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

* fix

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

* fix

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

* remove debug

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-04-29 17:13:48 +08:00
dependabot[bot] f42a87760c
chore(deps): bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.3 in /tests/data-assert (#1292)
chore(deps): bump github.com/onsi/gomega from 1.36.2 to 1.36.3

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 12:20:42 +08:00
Shubham Gupta 2c2db51c48
fix: handle panic when retrieving StatefulSet in GetRedisNodesByRole (#1330)
* fix: handle panic when retrieving StatefulSet in GetRedisNodesByRole

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* feat: add integration tests target to Makefile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2025-04-28 22:53:52 +08:00
dependabot[bot] 81ab3a2b8e
chore(deps): bump golang.org/x/net from 0.36.0 to 0.38.0 (#1324)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
- [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.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-04-28 16:38:00 +08:00
yangw ee120db849
feat: enhance environment variable management (#1315)
* feat: enhance environment variable management and CI workflow

- Introduced internal package for managing environment variables related to operator configuration.
- Updated main.go to utilize the new internal package for retrieving max concurrent reconciles, watch namespaces, and feature gates.
- Enhanced CI workflow by setting environment variables for the Redis operator deployment.
- Added unit tests for the new environment variable functions to ensure correctness.

These changes improve the configurability and maintainability of the Redis operator.

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

* sleep

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

* no parallel

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

* debug

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

* debug

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

* debug

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

* debug

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

* debug

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

* debug

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

* debug

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

* fix

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

* fix

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

* remove debug

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

---------

Signed-off-by: yourname <youremail@example.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-04-28 10:20:52 +08:00
Maxence Boutet b39b901c1b
chore: define container port for http probes in operator chart (#1326)
* Define container port for http probes

Signed-off-by: Maxence Boutet <mboutet@drw.com>

* fix

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

---------

Signed-off-by: Maxence Boutet <mboutet@drw.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-04-27 17:47:00 +08:00
Gary Burgmann 688e671128
docs: example for authenticated RedisSentinel (#1319)
* issues/1318 - example for authenticated RedisSentinel

* fix

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-04-27 17:30:36 +08:00
yangw 716ad0fd59
chore: bump version to 0.20.1 (#1329)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-04-27 16:40:57 +08:00
Mikolaj Pawlikowski db08dcd32a
fix: move VCT logic before diff calculation for stateful set (#1322)
fixes #1321

Signed-off-by: Mikolaj Pawlikowski <mikolaj@pawlikowski.pl>
2025-04-18 11:29:59 +08:00
yangw 5ea1410f20
chore: update version to 0.20.0 and enhance CI workflow (#1306)
- Bumped operator version to 0.20.0 in Makefile and Chart.yaml.
- Simplified GitHub Actions workflow by renaming jobs and removing unnecessary comments.
- Added hostPort field to CRDs for Redis resources to support additional configuration.
- Deleted unused sidecar.go file to clean up the codebase.

These changes improve versioning clarity and streamline the CI/CD process.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-04-01 14:37:40 +08:00
yangw 45b33df580
feat: support redis configuration generation in init container (#1303)
- Added IMG argument to Dockerfile for dynamic image handling.
- Updated LDFLAGS in Dockerfile to set operator image during build.
- Modified Makefile to pass IMG as a build argument in Docker commands.
- Introduced internal package for operator image retrieval.
- Removed hardcoded operator image reference from const.go.

These changes improve the flexibility and maintainability of the operator image configuration.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-03-31 21:27:51 +08:00
yangw 7ee2c0ed6c
feat: add feature gates for sentinel configuration generation in init container (#1300)
* feat: add feature gates for Redis configuration generation in init container

- Introduced a new feature gate to enable generating Redis configuration using an init container.
- Updated the main.go to parse feature gates from command-line flags.
- Enhanced statefulset definition to conditionally include init containers based on feature gate status.
- Added necessary volume and volume mount definitions for configuration management.

This change improves flexibility in Redis operator deployment configurations.

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

* fix

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

* fix

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

* fix

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-03-31 12:53:45 +08:00
Mikolaj Pawlikowski 939339508a
fix: race condition resulting in permanently broken Redis cluster (#1298)
fix: refuse to set up replication with empty master pod IP

Signed-off-by: Mikolaj Pawlikowski <mikolaj@pawlikowski.pl>
2025-03-27 14:03:42 +08:00
Husni Alhamdani 2527568343
feat: guarantee to avoid bad master ip on Sentinel (#1289)
* feat: guarantee to avoid bad master ip on Sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: guarantee to avoid bad master ip on Sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: guarantee to avoid bad master ip on Sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: guarantee to avoid bad master ip on Sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: guarantee to avoid bad master ip on Sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* fix ut

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

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <yang.wu@daocloud.io>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-03-26 18:18:13 +08:00
Leslie__Joe 0b6681563a
fix: svc finalizer removed. (#1297)
Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
Co-authored-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
2025-03-26 11:37:09 +08:00
Andrea Dolfi 317fc37b05
feat: Add support for anti affinity configuration in helm charts (#1296)
* Add support for setting role-anti-affinity annotation + make issuer creation optional to use cert-amanger

Signed-off-by: Andrea Dolfi <andrea.dolfi.e@thalesdigital.io>

* Update Readme files.

Signed-off-by: Andrea Dolfi <andrea.dolfi.e@thalesdigital.io>

* Fix charts readme.

Signed-off-by: Andrea Dolfi <andrea.dolfi.e@thalesdigital.io>

---------

Signed-off-by: Andrea Dolfi <andrea.dolfi.e@thalesdigital.io>
Co-authored-by: Andrea Dolfi <andrea.dolfi.e@thalesdigital.io>
2025-03-25 16:27:50 +08:00
yangw 1e1006690a
feat: update Dockerfile and Makefile for unified operator binary (#1294)
* feat: update Dockerfile and Makefile for unified operator binary

- Removed the BUILD_TARGET argument from Dockerfile to simplify the build process.
- Updated Dockerfile to build a single binary named 'operator' instead of separate manager and agent binaries.
- Modified Makefile to remove references to BUILD_TARGET, streamlining Docker image build commands.
- Adjusted entry point in deployment YAML to use the new operator binary.

This change enhances the build process and aligns with the new command structure in the main.go file.

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

* fix

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

* fix e2e

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

* fix version

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

* change version

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

* fix

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

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
2025-03-24 10:15:01 +08:00
Husni Alhamdani 0977eca676
feat: add recreate-stateful-strategy, orphan, background, foreground(default) (#1286)
* feat: add recreate-stateful-strategy, orphan, background, foreground(default)

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: add recreate-stateful-strategy, orphan, background, foreground(default)

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* typo

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

* common function

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

* docs

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

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-03-21 15:34:33 +08:00
dependabot[bot] 4af5f1d37f
chore(deps): bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.3 (#1291)
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.7.0 to 9.7.3.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.7.0...v9.7.3)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-21 13:51:53 +08:00
Shubham Gupta a5b61706b8
fix: update references from master to main in docs and workflow files (#1288)
* fix: update references from master to main in configuration and workflow files

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: update Trivy action references from main to master in workflow file

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: update Gosec action reference from main to master in CI workflow

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2025-03-19 16:02:09 +05:30
Shubham Gupta 317861bfae
Revert "chore(deps): bump sigs.k8s.io/controller-runtime from 0.17.2 to 0.20.3" (#1287)
Revert "chore(deps): bump sigs.k8s.io/controller-runtime from 0.17.2 to 0.20.…"

This reverts commit 6aa2b875c4.
2025-03-19 11:09:13 +05:30
dependabot[bot] 6aa2b875c4
chore(deps): bump sigs.k8s.io/controller-runtime from 0.17.2 to 0.20.3 (#1282)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.17.2 to 0.20.3.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.17.2...v0.20.3)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-19 10:43:59 +08:00
Shubham Gupta 0e9d19de6d
Revert "chore(deps): bump k8s.io/client-go from 0.29.3 to 0.32.3" (#1285)
Revert "chore(deps): bump k8s.io/client-go from 0.29.3 to 0.32.3 (#1284)"

This reverts commit b95d0dcdbc.
2025-03-18 18:21:48 +05:30
dependabot[bot] b95d0dcdbc
chore(deps): bump k8s.io/client-go from 0.29.3 to 0.32.3 (#1284)
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.29.3 to 0.32.3.
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.29.3...v0.32.3)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-18 18:19:04 +05:30
Abhishek Dubey 89bdbd5328
Create ROADMAP.md 2025-03-18 15:44:36 +05:30
yangw 9002a3070d
refactor: update Dockerfile and Makefile for agent support (#1277)
* refactor: update Dockerfile and Makefile for agent support

- Modified Dockerfile to support building both manager and agent binaries using a build argument.
- Updated Makefile to include targets for building, pushing, and loading agent Docker images.
- Removed the agent-specific Dockerfile as its functionality is now integrated into the main Dockerfile.

This change enhances the flexibility of the build process by allowing the selection of the build target.

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

* keep target clean

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

* fix syntax

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

* Update Makefile

Co-authored-by: Shubham Gupta <69793468+shubham-cmyk@users.noreply.github.com>

---------

Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: Shubham Gupta <69793468+shubham-cmyk@users.noreply.github.com>
2025-03-17 16:29:31 +05:30
dependabot[bot] 6e15c65ae2
chore(deps): bump golang.org/x/net from 0.33.0 to 0.36.0 (#1276)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-13 10:29:26 +08:00
Husni Alhamdani 6963517436
feat: add redisreplication observability (#1274)
* feat(operator-observability): add redisreplication observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat(operator-observability): add redisreplication observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat(operator-observability): add redisreplication observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: add docs of operator metrics/observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: add docs of operator metrics/observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: add docs of operator metrics/observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: add docs of operator metrics/observability

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-03-12 21:42:28 +05:30
Leslie__Joe 28179a44a9
feat: Fix PVC resizing issue and refactor PVC resizing logic (#1268)
* feat: Fix PVC resizing issue and refactor PVC resizing logic

- Fixed label error: updated PVC selection label from "redis" to "middleware".
- Corrected PVC expansion when node-conf persistence is enabled by avoiding hardcoded use of VolumeClaimTemplates[0].
- PVC resizing now filters out the "node-conf" template and targets the correct PVC for Redis RDB data.
- Enhanced error handling and added per-PVC update logging for better traceability.

Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>

* feat: Fix PVC resizing issue and refactor PVC resizing logic

- todo: Handle scale-out scenario

Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>

* add e2e test

Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>

* fix pvc storage in e2e test

Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>

* chore(utils):  Update Makefile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix intendation to tabs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* feat: Add storage class for PVC resizing and update test steps

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* feat: Add YAML front matter to storage class configuration

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Update pkg/k8sutils/pvc.go

* remove e2e test and fix comment.

Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>

---------

Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
Co-authored-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: yangw <yang.wu@daocloud.io>
2025-03-12 15:16:19 +08:00
yangw b68dd64e3e
Sentinel - announce-ip <hostname> when resolve & announce are set (#1271)
Relate to [95](https://github.com/OT-CONTAINER-KIT/redis/pull/95) in
image repository
2025-03-11 16:59:35 +08:00
Nicolas Girard 4b7ea5a350 Sentinel - announce-ip <hostname> when resolve & announce are set
Signed-off-by: Nicolas Girard <nicolas.girard@filigran.io>
2025-03-11 09:27:35 +01:00
Shubham Gupta 2aaae0b461
feat: Add docker-load target to Makefile for loading images into Docker (#1270)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2025-03-11 10:24:46 +08:00
Shubham Gupta b6a15018ba
chore(utils): Update Makefile (#1269)
* chore(utils):  Update Makefile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix intendation to tabs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* feat: Update Docker build command to load image into local Docker daemon

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2025-03-10 02:05:21 +05:30
Shubham Gupta 0b4a975a2e
refactor(utils): Genralize MergeMap function to support any key-value types (#1266)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2025-03-09 20:05:28 +05:30
Leslie__Joe 31dfe49806
feat: Add preStop failover hook for Redis Cluster(#1264)
- Implemented `generatePreStopCommand` to add a `preStop` hook for Redis Cluster mode.
- Added `generateAuthAndTLSArgs` to construct authentication and TLS parameters.
- Developed `generateClusterPreStop` to execute controlled failover before pod termination.
- Ensured that only `cluster` mode applies the `preStop` logic to avoid unnecessary rolling updates.
- Added unit tests for `generateAuthAndTLSArgs` and `generatePreStopCommand` to validate their correctness.

Ref: #1262

Signed-off-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
Co-authored-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
2025-03-06 17:56:41 +08:00
Qadora 555e637dd3
feat: Added support for hostport to allow direct connection to the pod (#1263)
* Added support for hostPort and updated helmcharts

* removed changed from helm chart

* feat: Add hostPort support to Redis CRDs and update deepcopy methods

* feat: sentinel support hostname resolve and annonce (#1247)

* feat: Sentinel - support hostname resolve and annonce master

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* Added support for hostPort and updated helmcharts

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#1256)

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump sigstore/cosign-installer from 3.7.0 to 3.8.1 (#1255)

Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.7.0 to 3.8.1.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.7.0...v3.8.1)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add redis agent with bootstrap configuration generation (#1254)

* move main

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

* feat: add redis agent with bootstrap configuration generation

- Introduced new agent package for Redis and Sentinel configuration management
- Added Cobra CLI support for agent bootstrap command
- Implemented configuration generation for Sentinel with environment-based customization
- Created Dockerfile for agent image
- Added utility functions for environment variable handling
- Prepared foundation for Redis and Sentinel configuration bootstrapping

Signed-off-by: Redis Operator Team
Signed-off-by: drivebyer <wuyangmuc@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Redis Operator Team
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Implement comprehensive Redis configuration generation for agent bootstrap (#1260)

* feat: Implement comprehensive Redis configuration generation for agent bootstrap

This commit adds a detailed implementation of Redis configuration generation with support for:
- Cluster and standalone modes
- TLS configuration
- ACL setup
- Persistence options
- Port and network configurations
- Dynamic IP and hostname resolution
- External configuration file inclusion

The implementation uses environment variables to customize Redis configuration dynamically and handles various deployment scenarios.

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* removed changed from helm chart

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Add hostPort support to Redis CRDs and update deepcopy methods

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add dynamic Redis configuration support for Redis Cluster (#1241)

* feat: add dynamic Redis configuration support for Redis Cluster

- Added `DynamicConfig` field to `RedisConfig` struct in common types
- Implemented `GetRedisDynamicConfig()` method in RedisCluster spec
- Created `SetRedisClusterDynamicConfig()` utility function to apply dynamic configuration
- Updated reconciliation process to set dynamic configuration when cluster is ready
- Added e2e test to verify dynamic configuration application

This feature allows users to dynamically configure Redis instances at runtime with top-level configuration parameters.

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

* fix lint

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

* fix

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

* fix

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: configurable operator maxConcurrentReconciles (#1242)

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* ci: add GitHub workflow for automatic PR rebase (#1243)

Add a GitHub Actions workflow to enable automatic rebasing of pull requests via comment commands `/rebase` and `/autosquash`

The workflow allows repository collaborators to trigger a rebase of a pull request by commenting `/rebase` or perform an autosquash rebase with `/autosquash`.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* Bump operator version

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* refactor: remove v1beta1 API version and migrate to v1beta2 (#1245)

* refactor: remove v1beta1 API version and migrate to v1beta2

This commit removes the v1beta1 API version across the entire project, including:
- Deleting v1beta1 API type definitions
- Removing v1beta1 CRD configurations
- Updating example manifests to use v1beta2
- Cleaning up test suite configurations
- Updating documentation references

The migration focuses on consolidating the project to use only the v1beta2 API version, simplifying the codebase and reducing maintenance overhead.

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

* fix

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

* fix

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: sentinel support hostname resolve and annonce (#1247)

* feat: Sentinel - support hostname resolve and annonce master

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* Added support for hostPort and updated helmcharts

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#1256)

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump sigstore/cosign-installer from 3.7.0 to 3.8.1 (#1255)

Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.7.0 to 3.8.1.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.7.0...v3.8.1)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add redis agent with bootstrap configuration generation (#1254)

* move main

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

* feat: add redis agent with bootstrap configuration generation

- Introduced new agent package for Redis and Sentinel configuration management
- Added Cobra CLI support for agent bootstrap command
- Implemented configuration generation for Sentinel with environment-based customization
- Created Dockerfile for agent image
- Added utility functions for environment variable handling
- Prepared foundation for Redis and Sentinel configuration bootstrapping

Signed-off-by: Redis Operator Team
Signed-off-by: drivebyer <wuyangmuc@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Redis Operator Team
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Implement comprehensive Redis configuration generation for agent bootstrap (#1260)

* feat: Implement comprehensive Redis configuration generation for agent bootstrap

This commit adds a detailed implementation of Redis configuration generation with support for:
- Cluster and standalone modes
- TLS configuration
- ACL setup
- Persistence options
- Port and network configurations
- Dynamic IP and hostname resolution
- External configuration file inclusion

The implementation uses environment variables to customize Redis configuration dynamically and handles various deployment scenarios.

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* removed changed from helm chart

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Add hostPort support to Redis CRDs and update deepcopy methods

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* Added support for hostPort and updated helmcharts

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* removed changed from helm chart

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Add hostPort support to Redis CRDs and update deepcopy methods

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* fix: replace hardcoded Redis port 6379 with configurable port from cr.Spec.Port (#1261)

- Updated RedisClusterStatusHealth function to use cr.Spec.Port instead of hardcoded 6379 port.

Co-authored-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* test: enhance testing with data assertion scripts (#1209)

* test: enhance Redis cluster testing with data assertion scripts

- Added new steps in the e2e test for Redis cluster to apply a data assertion tool, `data-assert`, for generating and validating data in the Redis cluster.
- Replaced the previous Redis GET/SET checks with a more comprehensive data generation and validation process using the `data-assert` tool.
- Introduced additional assertions to ensure data consistency after scaling operations.

This update improves the reliability of e2e tests by ensuring data integrity in Redis clusters.

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

* path

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

* password

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

* password

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

* password

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

* ha

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

* update

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add headless service configuration support (#1219)

* feat: add headless service configuration support

- Introduced a new `Headless` service configuration in `ServiceConfig` struct
- Added method `GetHeadlessServiceAnnotations()` to retrieve headless service annotations
- Updated CRD bases to include headless service configuration
- Modified service creation logic in Redis cluster and standalone services to support headless service annotations
- Added e2e test cases for standalone Redis with headless service configuration

This enhancement provides more flexibility in configuring headless services for Redis deployments.

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* fix: add missing topologySpreadConstraint on RedisCluster follower (#1218)

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: update redis-operator cert manager configuration. (#1220)

* fix: update redis-operator chart configuration and documentation.

- Removed Chart.lock file for cert-manager dependency
- Updated Chart.yaml to remove explicit cert-manager dependency
- Bumped chart version to 0.19.2
- Updated README.md to clarify cert-manager installation instructions
- Modified values.yaml to improve cert-manager and webhook configuration documentation
- Added configuration validation helper in _helpers.tpl
- Introduced NOTES.txt template for helm chart installation guidance

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

* docs

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore: dockerfile command style consistency (#1222)

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: update certificate serverName to support wildcard certs (#1221)

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add additional service configuration with optional enable flag (#1228)

- Introduced `Additional` service configuration in `ServiceConfig` struct
- Added `Enabled` field to `Service` struct with default value of true
- Implemented `ShouldCreateAdditionalService()` method to control additional service creation
- Updated CRD bases to include additional service configuration
- Modified service creation logic in Redis cluster and standalone services to respect additional service configuration
- Added unit test for `ShouldCreateAdditionalService()` method

This enhancement provides more flexibility in configuring additional services for Redis deployments.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump helm/chart-releaser-action from 1.6.0 to 1.7.0 (#1230)

Bumps [helm/chart-releaser-action](https://github.com/helm/chart-releaser-action) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/helm/chart-releaser-action/releases)
- [Commits](https://github.com/helm/chart-releaser-action/compare/v1.6.0...v1.7.0)

---
updated-dependencies:
- dependency-name: helm/chart-releaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump helm/chart-testing-action from 2.6.0 to 2.7.0 (#1229)

Bumps [helm/chart-testing-action](https://github.com/helm/chart-testing-action) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/helm/chart-testing-action/releases)
- [Commits](https://github.com/helm/chart-testing-action/compare/v2.6.0...v2.7.0)

---
updated-dependencies:
- dependency-name: helm/chart-testing-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump github.com/onsi/ginkgo/v2 from 2.22.1 to 2.22.2 (#1225)

Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.22.1 to 2.22.2.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.22.1...v2.22.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* fix: improve pod label patching with error handling and retry mechanism (#1231)

fix: improve pod label patching with error handling and retry mechanism

- Added JSON pointer escaping for label keys
- Implemented retry mechanism for label patching
- Enhanced error handling and logging
- Added validation for empty labels
- Created utility function for JSON pointer escaping in util package

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: enhance Redis HA and node scheduling strategy (#1237)

* feat: enhance Redis HA and node scheduling strategy

- Updated e2e test to simulate node shutdown instead of pod deletion
- Added pod anti-affinity configuration for Redis replication and sentinel nodes
- Removed unnecessary StatefulSet readiness check in Redis replication controller
- Improved node scheduling to distribute Redis pods across different worker nodes

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add securityContext config in chart for redis-exporter (#1238)

feat: add securityContext config for redis-exporter

Add ability to configure securityContext for redis-exporter in redis helm charts:
- redis
- redis-cluster
- redis-replication
- redis-sentinel

Supported in:
- v1beta1 & v1beta2: Redis, RedisCluster, RedisReplication Operator CRDs
- v1beta2 only: RedisSentinel Operator CRD

This aligns with existing redis operator CRD functionality.

Signed-off-by: Hexoplon <github@zackeus.no>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* fix: make recreate statefulset only trigger when value true (#1240)

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add dynamic Redis configuration support for Redis Cluster (#1241)

* feat: add dynamic Redis configuration support for Redis Cluster

- Added `DynamicConfig` field to `RedisConfig` struct in common types
- Implemented `GetRedisDynamicConfig()` method in RedisCluster spec
- Created `SetRedisClusterDynamicConfig()` utility function to apply dynamic configuration
- Updated reconciliation process to set dynamic configuration when cluster is ready
- Added e2e test to verify dynamic configuration application

This feature allows users to dynamically configure Redis instances at runtime with top-level configuration parameters.

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

* fix lint

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

* fix

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

* fix

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: configurable operator maxConcurrentReconciles (#1242)

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* ci: add GitHub workflow for automatic PR rebase (#1243)

Add a GitHub Actions workflow to enable automatic rebasing of pull requests via comment commands `/rebase` and `/autosquash`

The workflow allows repository collaborators to trigger a rebase of a pull request by commenting `/rebase` or perform an autosquash rebase with `/autosquash`.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* Bump operator version

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* refactor: remove v1beta1 API version and migrate to v1beta2 (#1245)

* refactor: remove v1beta1 API version and migrate to v1beta2

This commit removes the v1beta1 API version across the entire project, including:
- Deleting v1beta1 API type definitions
- Removing v1beta1 CRD configurations
- Updating example manifests to use v1beta2
- Cleaning up test suite configurations
- Updating documentation references

The migration focuses on consolidating the project to use only the v1beta2 API version, simplifying the codebase and reducing maintenance overhead.

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

* fix

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

* fix

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: sentinel support hostname resolve and annonce (#1247)

* feat: Sentinel - support hostname resolve and annonce master

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* Added support for hostPort and updated helmcharts

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#1256)

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump sigstore/cosign-installer from 3.7.0 to 3.8.1 (#1255)

Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.7.0 to 3.8.1.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.7.0...v3.8.1)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: add redis agent with bootstrap configuration generation (#1254)

* move main

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

* feat: add redis agent with bootstrap configuration generation

- Introduced new agent package for Redis and Sentinel configuration management
- Added Cobra CLI support for agent bootstrap command
- Implemented configuration generation for Sentinel with environment-based customization
- Created Dockerfile for agent image
- Added utility functions for environment variable handling
- Prepared foundation for Redis and Sentinel configuration bootstrapping

Signed-off-by: Redis Operator Team
Signed-off-by: drivebyer <wuyangmuc@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Redis Operator Team
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Implement comprehensive Redis configuration generation for agent bootstrap (#1260)

* feat: Implement comprehensive Redis configuration generation for agent bootstrap

This commit adds a detailed implementation of Redis configuration generation with support for:
- Cluster and standalone modes
- TLS configuration
- ACL setup
- Persistence options
- Port and network configurations
- Dynamic IP and hostname resolution
- External configuration file inclusion

The implementation uses environment variables to customize Redis configuration dynamically and handles various deployment scenarios.

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* removed changed from helm chart

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Add hostPort support to Redis CRDs and update deepcopy methods

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* Added support for hostPort and updated helmcharts

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#1256)

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add redis agent with bootstrap configuration generation (#1254)

* move main

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

* feat: add redis agent with bootstrap configuration generation

- Introduced new agent package for Redis and Sentinel configuration management
- Added Cobra CLI support for agent bootstrap command
- Implemented configuration generation for Sentinel with environment-based customization
- Created Dockerfile for agent image
- Added utility functions for environment variable handling
- Prepared foundation for Redis and Sentinel configuration bootstrapping

Signed-off-by: Redis Operator Team
Signed-off-by: drivebyer <wuyangmuc@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Redis Operator Team

* feat: Implement comprehensive Redis configuration generation for agent bootstrap (#1260)

* feat: Implement comprehensive Redis configuration generation for agent bootstrap

This commit adds a detailed implementation of Redis configuration generation with support for:
- Cluster and standalone modes
- TLS configuration
- ACL setup
- Persistence options
- Port and network configurations
- Dynamic IP and hostname resolution
- External configuration file inclusion

The implementation uses environment variables to customize Redis configuration dynamically and handles various deployment scenarios.

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* removed changed from helm chart

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* feat: Add hostPort support to Redis CRDs and update deepcopy methods

Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

* fix: replace hardcoded Redis port 6379 with configurable port from cr.Spec.Port (#1261)

- Updated RedisClusterStatusHealth function to use cr.Spec.Port instead of hardcoded 6379 port.

Co-authored-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>

---------

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Redis Operator Team
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
Signed-off-by: Hexoplon <github@zackeus.no>
Co-authored-by: Michael Kanchuker <michaelkanchuker@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: yangw <yang.wu@daocloud.io>
Co-authored-by: Husni Alhamdani <dhanielluis@gmail.com>
Co-authored-by: Leslie__Joe <58540165+fengyinqiao@users.noreply.github.com>
Co-authored-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
Co-authored-by: Zackeus Bengtsson <32719220+Hexoplon@users.noreply.github.com>
2025-03-06 16:38:22 +08:00
Leslie__Joe 9d1b9783a9
fix: replace hardcoded Redis port 6379 with configurable port from cr.Spec.Port (#1261)
- Updated RedisClusterStatusHealth function to use cr.Spec.Port instead of hardcoded 6379 port.

Co-authored-by: fengyinqiao <fengyinqiao@shizhuang-inc.com>
2025-03-05 10:15:18 +08:00
yangw 8d16e69794
feat: Implement comprehensive Redis configuration generation for agent bootstrap (#1260)
* feat: Implement comprehensive Redis configuration generation for agent bootstrap

This commit adds a detailed implementation of Redis configuration generation with support for:
- Cluster and standalone modes
- TLS configuration
- ACL setup
- Persistence options
- Port and network configurations
- Dynamic IP and hostname resolution
- External configuration file inclusion

The implementation uses environment variables to customize Redis configuration dynamically and handles various deployment scenarios.

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-03-04 18:11:39 +08:00
yangw 2677f0dfab
feat: add redis agent with bootstrap configuration generation (#1254)
* move main

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

* feat: add redis agent with bootstrap configuration generation

- Introduced new agent package for Redis and Sentinel configuration management
- Added Cobra CLI support for agent bootstrap command
- Implemented configuration generation for Sentinel with environment-based customization
- Created Dockerfile for agent image
- Added utility functions for environment variable handling
- Prepared foundation for Redis and Sentinel configuration bootstrapping

Signed-off-by: Redis Operator Team
Signed-off-by: drivebyer <wuyangmuc@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Redis Operator Team
2025-03-04 16:57:15 +08:00
dependabot[bot] c34d1eee14
chore(deps): bump sigstore/cosign-installer from 3.7.0 to 3.8.1 (#1255)
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.7.0 to 3.8.1.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.7.0...v3.8.1)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-04 14:07:19 +08:00
dependabot[bot] 0ab5c601d6
chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#1256)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-04 14:07:03 +08:00
Michael Kanchuker aafc66367b
feat: sentinel support hostname resolve and annonce (#1247)
* feat: Sentinel - support hostname resolve and annonce master

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>

* fix

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

* fix

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

---------

Signed-off-by: Michael Kanchuker <michaelkanchuker@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
Co-authored-by: yangw <wuyangmuc@gmail.com>
2025-02-28 11:40:14 +08:00
yangw 7c91822fb0
refactor: remove v1beta1 API version and migrate to v1beta2 (#1245)
* refactor: remove v1beta1 API version and migrate to v1beta2

This commit removes the v1beta1 API version across the entire project, including:
- Deleting v1beta1 API type definitions
- Removing v1beta1 CRD configurations
- Updating example manifests to use v1beta2
- Cleaning up test suite configurations
- Updating documentation references

The migration focuses on consolidating the project to use only the v1beta2 API version, simplifying the codebase and reducing maintenance overhead.

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

* fix

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

* fix

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-02-20 10:41:54 +08:00
drivebyer 9acbd41d2d Bump operator version
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-02-19 11:15:17 +08:00
yangw 84745ab315
ci: add GitHub workflow for automatic PR rebase (#1243)
Add a GitHub Actions workflow to enable automatic rebasing of pull requests via comment commands `/rebase` and `/autosquash`

The workflow allows repository collaborators to trigger a rebase of a pull request by commenting `/rebase` or perform an autosquash rebase with `/autosquash`.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-02-18 15:14:14 +08:00
Husni Alhamdani 6264dae409
feat: configurable operator maxConcurrentReconciles (#1242)
* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: configurable operator maxConcurrentReconciles

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-02-18 14:27:41 +08:00
yangw 230bb79ac7
feat: add dynamic Redis configuration support for Redis Cluster (#1241)
* feat: add dynamic Redis configuration support for Redis Cluster

- Added `DynamicConfig` field to `RedisConfig` struct in common types
- Implemented `GetRedisDynamicConfig()` method in RedisCluster spec
- Created `SetRedisClusterDynamicConfig()` utility function to apply dynamic configuration
- Updated reconciliation process to set dynamic configuration when cluster is ready
- Added e2e test to verify dynamic configuration application

This feature allows users to dynamically configure Redis instances at runtime with top-level configuration parameters.

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

* fix lint

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

* fix

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

* fix

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-02-18 13:42:57 +08:00
Husni Alhamdani 4256fd3ae6
fix: make recreate statefulset only trigger when value true (#1240)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-02-13 10:36:27 +08:00
Zackeus Bengtsson 9dbec5071f
feat: add securityContext config in chart for redis-exporter (#1238)
feat: add securityContext config for redis-exporter

Add ability to configure securityContext for redis-exporter in redis helm charts:
- redis
- redis-cluster
- redis-replication
- redis-sentinel

Supported in:
- v1beta1 & v1beta2: Redis, RedisCluster, RedisReplication Operator CRDs
- v1beta2 only: RedisSentinel Operator CRD

This aligns with existing redis operator CRD functionality.

Signed-off-by: Hexoplon <github@zackeus.no>
2025-02-11 16:32:33 +08:00
yangw f7e9204b2c
feat: enhance Redis HA and node scheduling strategy (#1237)
* feat: enhance Redis HA and node scheduling strategy

- Updated e2e test to simulate node shutdown instead of pod deletion
- Added pod anti-affinity configuration for Redis replication and sentinel nodes
- Removed unnecessary StatefulSet readiness check in Redis replication controller
- Improved node scheduling to distribute Redis pods across different worker nodes

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-02-07 22:10:47 +08:00
yangw 209931627e
fix: improve pod label patching with error handling and retry mechanism (#1231)
fix: improve pod label patching with error handling and retry mechanism

- Added JSON pointer escaping for label keys
- Implemented retry mechanism for label patching
- Enhanced error handling and logging
- Added validation for empty labels
- Created utility function for JSON pointer escaping in util package

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-02-02 22:25:05 +08:00
dependabot[bot] 5690dc0f65
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.22.1 to 2.22.2 (#1225)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.22.1 to 2.22.2.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.22.1...v2.22.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-01 23:37:55 +08:00
dependabot[bot] 834cbc499c
chore(deps): bump helm/chart-testing-action from 2.6.0 to 2.7.0 (#1229)
Bumps [helm/chart-testing-action](https://github.com/helm/chart-testing-action) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/helm/chart-testing-action/releases)
- [Commits](https://github.com/helm/chart-testing-action/compare/v2.6.0...v2.7.0)

---
updated-dependencies:
- dependency-name: helm/chart-testing-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-01 23:37:37 +08:00
dependabot[bot] b91f7f9406
chore(deps): bump helm/chart-releaser-action from 1.6.0 to 1.7.0 (#1230)
Bumps [helm/chart-releaser-action](https://github.com/helm/chart-releaser-action) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/helm/chart-releaser-action/releases)
- [Commits](https://github.com/helm/chart-releaser-action/compare/v1.6.0...v1.7.0)

---
updated-dependencies:
- dependency-name: helm/chart-releaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-01 23:37:06 +08:00
yangw 111583b9c5
feat: add additional service configuration with optional enable flag (#1228)
- Introduced `Additional` service configuration in `ServiceConfig` struct
- Added `Enabled` field to `Service` struct with default value of true
- Implemented `ShouldCreateAdditionalService()` method to control additional service creation
- Updated CRD bases to include additional service configuration
- Modified service creation logic in Redis cluster and standalone services to respect additional service configuration
- Added unit test for `ShouldCreateAdditionalService()` method

This enhancement provides more flexibility in configuring additional services for Redis deployments.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-02-01 22:30:36 +08:00
Qadora 8fbb4f7b87
feat: update certificate serverName to support wildcard certs (#1221)
Signed-off-by: Muhammad Qadora <memomq70@gmail.com>
2025-02-01 11:14:50 +08:00
Husni Alhamdani 0ad77e25b9
chore: dockerfile command style consistency (#1222)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-02-01 10:46:29 +08:00
yangw 546eaf28c4
feat: update redis-operator cert manager configuration. (#1220)
* fix: update redis-operator chart configuration and documentation.

- Removed Chart.lock file for cert-manager dependency
- Updated Chart.yaml to remove explicit cert-manager dependency
- Bumped chart version to 0.19.2
- Updated README.md to clarify cert-manager installation instructions
- Modified values.yaml to improve cert-manager and webhook configuration documentation
- Added configuration validation helper in _helpers.tpl
- Introduced NOTES.txt template for helm chart installation guidance

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

* docs

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-26 15:45:38 +08:00
Husni Alhamdani 5f98c439e5
fix: add missing topologySpreadConstraint on RedisCluster follower (#1218)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-01-26 13:39:37 +08:00
yangw 79ea018353
feat: add headless service configuration support (#1219)
* feat: add headless service configuration support

- Introduced a new `Headless` service configuration in `ServiceConfig` struct
- Added method `GetHeadlessServiceAnnotations()` to retrieve headless service annotations
- Updated CRD bases to include headless service configuration
- Modified service creation logic in Redis cluster and standalone services to support headless service annotations
- Added e2e test cases for standalone Redis with headless service configuration

This enhancement provides more flexibility in configuring headless services for Redis deployments.

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

* fix

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-26 13:10:28 +08:00
yangw 2979e2122c
test: enhance testing with data assertion scripts (#1209)
* test: enhance Redis cluster testing with data assertion scripts

- Added new steps in the e2e test for Redis cluster to apply a data assertion tool, `data-assert`, for generating and validating data in the Redis cluster.
- Replaced the previous Redis GET/SET checks with a more comprehensive data generation and validation process using the `data-assert` tool.
- Introduced additional assertions to ensure data consistency after scaling operations.

This update improves the reliability of e2e tests by ensuring data integrity in Redis clusters.

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

* path

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

* password

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

* password

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

* password

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

* ha

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

* update

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-16 21:24:39 +08:00
Allen Conlon bb4ed617ae
chore: added actions to publish charts to github container registry (#1201)
Added actions to publish charts to github container registry

Signed-off-by: Allen Conlon <software@conlon.dev>
2025-01-15 20:47:27 +08:00
Husni Alhamdani c32cd415a1
chore: move secret logging to v1 (#1211)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-01-15 13:51:34 +08:00
drivebyer fff5a89214 chore: bump redis-operator chart version to 0.19.1
Updated the version in Chart.yaml to reflect the new release of the redis-operator chart. This change ensures that users are aware of the latest updates and improvements in the chart.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-14 11:47:50 +08:00
Husni Alhamdani 850e121020
chore: update crds (#1208)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-01-14 11:46:31 +08:00
yangw 5850e81c2c
feat: check data consistent by external tool. (#1205)
* feat: check data consistent by external tool

- Added a new command-line tool `data-assert` for managing Redis data, including commands to generate data, check data consistency, and create resource YAML files.
- Introduced `go.mod` and `go.sum` for dependency management, incorporating Redis and Cobra libraries.
- Created a template for generating Kubernetes resources, including a ConfigMap and Pod specifications.
- Updated e2e tests to utilize the new data-assert functionality for data generation and validation.

This enhancement improves the management and verification of data in Redis clusters.

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

* generate

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

* ignore

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-13 21:02:27 +08:00
Husni Alhamdani b00f1df050
fix: skip-reconcile annotation still skipping reconcile even the value is false (#1202)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-01-13 10:38:13 +08:00
yangw e7e6688b3a
feat: add data-assert tool for Redis data management. (#1204)
* docs

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

* feat: add data-assert tool for Redis data management

- Introduced a new command-line tool `data-assert` to manage data in Redis.
- Implemented commands to generate data, check data consistency, and generate resource YAML files.
- Added `go.mod` and `go.sum` for dependency management, including Redis and Cobra libraries.
- Created a template for generating Kubernetes resources, including a ConfigMap and Pod specifications.
- Updated documentation to include information about the new data-assert functionality.

This addition enhances the ability to manage and verify data in Redis clusters effectively.

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-12 18:01:29 +08:00
drivebyer 1a5a97f9e6 Update version
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-12 14:01:54 +08:00
yangw 79d016e81d
feat: add serviceMonitor.extraLabels support (#1200)
- Updated version and appVersion for redis, redis-cluster, redis-replication, and redis-sentinel charts to 0.16.5, 0.16.7, and 0.16.9 respectively.
- Introduced `serviceMonitor.extraLabels` in values.yaml and README.md for all Redis charts, allowing users to add custom labels to the ServiceMonitor when enabled.
- Updated templates to utilize the new `extraLabels` configuration for ServiceMonitor.

This change enhances the flexibility of monitoring configurations for Redis deployments.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-05 20:50:55 +08:00
yangw 0d4ce9c5c9
feat(cluster): enhance resource management by adding separate resource handling for leader and follower (#1199).
* feat: enhance RedisCluster resource management by introducing separate resource handling for leader and follower

- Added methods to retrieve resources for Redis leader and follower, allowing for more granular resource management.
- Updated RedisClusterSpec to deprecate the unified resources field in favor of individual configurations for leader and follower.
- Adjusted related tests and YAML configurations to reflect these changes, ensuring consistency and correctness in resource allocation.

This update improves the flexibility and efficiency of resource management in RedisCluster deployments.

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

* fix verify-codegen

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

* fix codegen

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

* fix lint

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2025-01-05 19:10:06 +08:00
Husni Alhamdani 888e0edf06
feat: separate resources section for leader and follower (#1188)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2025-01-05 17:38:53 +08:00
dependabot[bot] 974a10844b
chore(deps): bump helm/kind-action from 1.5.0 to 1.12.0 (#1197)
Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.5.0 to 1.12.0.
- [Release notes](https://github.com/helm/kind-action/releases)
- [Commits](https://github.com/helm/kind-action/compare/v1.5.0...v1.12.0)

---
updated-dependencies:
- dependency-name: helm/kind-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-02 10:28:11 +08:00
dependabot[bot] f061869a58
chore(deps): bump github.com/onsi/gomega from 1.35.1 to 1.36.2 (#1194)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.35.1 to 1.36.2.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.35.1...v1.36.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-02 10:27:50 +08:00
drivebyer 7a55f6d50e Fix yaml lint
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-27 14:59:01 +08:00
Husni Alhamdani 5ccd226116
fix: label selector mapping on redisreplication pdb (#1191)
Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2024-12-27 14:48:06 +08:00
xiaozhuang bf1c79f722
feat: redis-cluster add podAntiAffinity(#1174 ) (#1180)
* feat: redis-cluster add podAntiAffinity

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: lint

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: webhook add annotation

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: lint

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: lint

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: redis-operator chart add MutatingWebhookConfiguration

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: revert kustomization for webhook

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: podAntiAffinity control by annotation

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: webhook add testing

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: lint

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: lint

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: MutatingWebhookConfiguration remove namespace filter

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* change key

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

* add example

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

---------

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Co-authored-by: xiaozhuang <xiaozhuang@minimaxi.com>
Co-authored-by: drivebyer <wuyangmuc@gmail.com>
2024-12-27 14:44:16 +08:00
Husni Alhamdani c02c7c9f7f
feat: support topologySpreadConstraints in replication & sentinel (#1184)
* feat: support topologySpreadConstraints in replication & sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: support topologySpreadConstraints in replication & sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: support topologySpreadConstraints in replication & sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: support topologySpreadConstraints in replication & sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

* feat: support topologySpreadConstraints in replication & sentinel

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>

---------

Signed-off-by: Husni Alhamdani <dhanielluis@gmail.com>
2024-12-24 17:09:55 +08:00
yangw 81296c7a50
feat: use client.Client instead of K8sClient in finalizer. (#1183)
* feat: use client.Client instead of K8sClient in finalizer

- Eliminated the K8sClient field from the Reconciler struct in Redis-related controller files, including redis_controller.go, redis_controller_suite_test.go, and redisreplication_controller.go, as it was not utilized.
- Updated finalizer handling functions to remove K8sClient parameters, simplifying the function signatures and improving code clarity.
- Adjusted related test cases to reflect these changes, ensuring consistency across the codebase.

This refactor enhances maintainability by streamlining the code and removing unnecessary dependencies.

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

* remove which can ensure by chainsaw test `setup`

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-22 17:39:01 +08:00
yangw 6ee6417b3b
feat(cluster): add event recording functionality for RedisCluster controller. (#1182)
* refactor: remove unused Scheme references in Redis controller files

- Removed the Scheme field from the Reconciler struct in rediscluster_controller.go, main.go, and rediscluster_controller_suite_test.go as it was not being utilized.
- This cleanup enhances code clarity and maintainability by eliminating unnecessary components.

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

* feat(cluster): add event recording functionality for RedisCluster controller

- Introduced a new events package to manage event recording, including a Recorder struct and methods for adding and retrieving events.
- Updated the RedisCluster controller to utilize the event recorder, allowing it to log downscale events.
- Enhanced the main function to initialize the event recorder for the RedisCluster controller.

This update improves observability capabilities for RedisCluster operations.

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

* update

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-22 14:22:09 +08:00
yangw c6df0b38c0
test: enhance Redis controllers' test cases with testdata and validation checks (#1181)
* test: enhance Redis controllers' test cases with testdata and validation checks

- Updated Redis, RedisCluster, RedisReplication, and RedisSentinel controller tests to utilize YAML testdata files for improved clarity and maintainability.
- Added validation checks for resource creation, owner references, and specifications in the respective test cases.
- Introduced new testdata files for Redis and RedisCluster to streamline test setup and ensure consistent testing across different configurations.
- Enhanced error handling and logging for better debugging during test execution.

This update improves the robustness and reliability of the Redis operator's testing framework.

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

* fix lint

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: yangw <wuyangmuc@gmail.com>
2024-12-21 23:40:52 +08:00
xiaozhuang 1db22aee59
fix(cluster): reduce the impact of Redis cluster intermediate states (#1178)
Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>
Co-authored-by: xiaozhuang <xiaozhuang@minimaxi.com>
2024-12-21 13:55:21 +08:00
xiaozhuang ea98aa7a93
feat(cluster): support redis-cluster topologySpreadConstraints(# 868) (#1177)
* feat: v1beta2 redis-cluster support TopologySpreadConstraints

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: topologySpreadConstraints example

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: lint

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

* chore: lint

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>

---------

Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>
Co-authored-by: xiaozhuang <xiaozhuang@minimaxi.com>
2024-12-21 13:31:22 +08:00
yangw 2c7022a578
feat(sentinel): enhance RedisSentinel reconciliation logic and update workflow. (#1176)
feat: enhance RedisSentinel reconciliation logic and update workflow.

- Added new reconciler functions for handling finalizers, annotations, replication, and sentinel management in the RedisSentinel controller.
- Improved error handling and logging for better debugging during reconciliation.
- Updated GitHub Actions workflow to include new job types: standalone, replication, sentinel, and cluster.

This update enhances the functionality and maintainability of the RedisSentinel operator.

Signed-off-by: yangw <wuyangmuc@gmail.com>
2024-12-19 23:23:59 +08:00
xiaozhuang d28caf1422
fix: redis-cluster unexpected downscaling (#1167) (#1173)
Signed-off-by: xiaozhuang <xiaozhuang@minimaxi.com>
Co-authored-by: xiaozhuang <xiaozhuang@minimaxi.com>
2024-12-16 21:29:16 +08:00
Husni Alhamdani cda99a4c01
feat: support PDB in redisreplication (#1166)
<!--
Please read
https://github.com/OT-CONTAINER-KIT/redis-operator/blob/master/CONTRIBUTING.md
before submitting
your pull request. Please fill in each section below to help us better
prioritize your pull request. Thanks!
-->

**Description**

<!-- Please provide a summary of the change here. -->

Support PDB in redisreplication

**Type of change**

<!-- Please delete options that are not relevant. -->

* Bug fix (non-breaking change which fixes an issue)
* New feature (non-breaking change which adds functionality)
* Breaking change (fix or feature that would cause existing
functionality to not work as expected)

**Checklist**

- [ ] Tests have been added/modified and all tests pass.
- [ ] Functionality/bugs have been confirmed to be unchanged or fixed.
- [x] I have performed a self-review of my own code.
- [ ] Documentation has been updated or added where necessary.

**Additional Context**

<!-- 
    Is there anything else you'd like reviewers to know? 
    For example, any other related issues or testing carried out.
-->
2024-12-16 14:09:31 +08:00
yangw b726082c10
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.20.1 to 2.22.0 (#1140)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from
2.20.1 to 2.22.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/onsi/ginkgo/releases">github.com/onsi/ginkgo/v2's
releases</a>.</em></p>
<blockquote>
<h2>v2.22.0</h2>
<h2>2.22.0</h2>
<h3>Features</h3>
<ul>
<li>Add label to serial nodes [0fcaa08]</li>
</ul>
<p>This allows serial tests to be filtered using the
<code>label-filter</code></p>
<h3>Maintenance</h3>
<p>Various doc fixes</p>
<h2>v2.21.0</h2>
<h2>2.21.0</h2>
<h3>Features</h3>
<ul>
<li>add support for GINKGO_TIME_FORMAT [a69eb39]</li>
<li>add GINKGO_NO_COLOR to disable colors via environment variables
[bcab9c8]</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>increase threshold in timeline matcher [e548367]</li>
<li>Fix the document by replacing <code>SpecsThatWillBeRun</code> with
<code>SpecsThatWillRun</code>
[c2c4d3c]</li>
</ul>
<h3>Maintenance</h3>
<ul>
<li>bump various dependencies [7e65a00]</li>
</ul>
<h2>v2.20.2</h2>
<h2>2.20.2</h2>
<p>Require Go 1.22+</p>
<h3>Maintenance</h3>
<ul>
<li>bump go to v1.22 [a671816]</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md">github.com/onsi/ginkgo/v2's
changelog</a>.</em></p>
<blockquote>
<h2>2.22.0</h2>
<h3>Features</h3>
<ul>
<li>Add label to serial nodes [0fcaa08]</li>
</ul>
<p>This allows serial tests to be filtered using the
<code>label-filter</code></p>
<h3>Maintenance</h3>
<p>Various doc fixes</p>
<h2>2.21.0</h2>
<h3>Features</h3>
<ul>
<li>add support for GINKGO_TIME_FORMAT [a69eb39]</li>
<li>add GINKGO_NO_COLOR to disable colors via environment variables
[bcab9c8]</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>increase threshold in timeline matcher [e548367]</li>
<li>Fix the document by replacing <code>SpecsThatWillBeRun</code> with
<code>SpecsThatWillRun</code>
[c2c4d3c]</li>
</ul>
<h3>Maintenance</h3>
<ul>
<li>bump various dependencies [7e65a00]</li>
</ul>
<h2>2.20.2</h2>
<p>Require Go 1.22+</p>
<h3>Maintenance</h3>
<ul>
<li>bump go to v1.22 [a671816]</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="9e2f337b10"><code>9e2f337</code></a>
v2.22.0</li>
<li><a
href="0fcaa0841d"><code>0fcaa08</code></a>
Add label to serial nodes</li>
<li><a
href="38febf2d66"><code>38febf2</code></a>
docs: remove extra erroneous backtick</li>
<li><a
href="7e753c4a3c"><code>7e753c4</code></a>
fix: minor doc fixes</li>
<li><a
href="21765a2752"><code>21765a2</code></a>
fix: missing commas</li>
<li><a
href="b101e0c573"><code>b101e0c</code></a>
Fix some typos in docs</li>
<li><a
href="75120215ca"><code>7512021</code></a>
fix: remove trailing comma</li>
<li><a
href="9d33507ba0"><code>9d33507</code></a>
fix: grammar</li>
<li><a
href="55f3de13e5"><code>55f3de1</code></a>
fix: typos</li>
<li><a
href="3d6e16d18f"><code>3d6e16d</code></a>
fix: missing comma</li>
<li>Additional commits viewable in <a
href="https://github.com/onsi/ginkgo/compare/v2.20.1...v2.22.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/onsi/ginkgo/v2&package-manager=go_modules&previous-version=2.20.1&new-version=2.22.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
2024-12-11 13:46:00 +08:00
yangw 683258976e chore: update dependabot configuration to change update schedule from daily to monthly for gomod and github-actions
Signed-off-by: yangw <wuyangmuc@gmail.com>
2024-12-11 09:59:44 +08:00
dependabot[bot] b0fe42cc53
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.20.1 to 2.22.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.20.1 to 2.22.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.20.1...v2.22.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-11 01:43:09 +00:00
yangw 7a037e398e
feat: enhance RedisReplication controller and CRD with additional status (#1154)
* feat: enhance RedisReplication controller and CRD with additional status columns and refactor reconciliation logic

- Added new printer columns "Master" and "Age" to the RedisReplication CRD for better visibility of the master node and resource age.
- Refactored the reconciliation logic in the RedisReplication controller to improve clarity and maintainability by introducing a reconciler struct for handling different reconciliation tasks.
- Updated the e2e tests to validate the HA setup of Redis Replication and Sentinel, ensuring consistency in master IP across different sources.
- Removed obsolete test files and replaced them with a new HA setup configuration.

This update improves the usability and reliability of the Redis replication feature.

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

* fix lint

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

* lint

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

* upgrade go

* add

* disable

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

* update

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

* disable

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

* update

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

* update

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-11 09:41:46 +08:00
drivebyer 60ef5a2241 update
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 23:22:03 +08:00
drivebyer a6454ab011 update
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 23:21:43 +08:00
drivebyer 371f057cd1 disable
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 22:38:41 +08:00
drivebyer 0a920ea407 update
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 22:31:27 +08:00
drivebyer 72d0e991c2 disable
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 22:25:42 +08:00
drivebyer f59817cb38 add 2024-12-10 21:58:57 +08:00
drivebyer 2d5e45c958 upgrade go 2024-12-10 21:54:15 +08:00
Abhishek Dubey 62995c50bc
Updated LICENSE today 2024-12-10 18:55:01 +05:30
drivebyer 79febd30d6 lint
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 17:45:04 +08:00
drivebyer a8092ef6fe fix lint
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 17:32:35 +08:00
drivebyer 25aab8a8b9 feat: enhance RedisReplication controller and CRD with additional status columns and refactor reconciliation logic
- Added new printer columns "Master" and "Age" to the RedisReplication CRD for better visibility of the master node and resource age.
- Refactored the reconciliation logic in the RedisReplication controller to improve clarity and maintainability by introducing a reconciler struct for handling different reconciliation tasks.
- Updated the e2e tests to validate the HA setup of Redis Replication and Sentinel, ensuring consistency in master IP across different sources.
- Removed obsolete test files and replaced them with a new HA setup configuration.

This update improves the usability and reliability of the Redis replication feature.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-10 17:05:16 +08:00
dependabot[bot] e9ec33f735
chore(deps): bump kyverno/action-install-chainsaw from 0.2.11 to 0.2.12 (#1151)
Bumps [kyverno/action-install-chainsaw](https://github.com/kyverno/action-install-chainsaw) from 0.2.11 to 0.2.12.
- [Release notes](https://github.com/kyverno/action-install-chainsaw/releases)
- [Commits](https://github.com/kyverno/action-install-chainsaw/compare/v0.2.11...v0.2.12)

---
updated-dependencies:
- dependency-name: kyverno/action-install-chainsaw
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-05 16:32:53 +08:00
yangw a5dd80ee4a
fix: initContainer enabled properties not define in template (#1152)
- Bumped version and appVersion for redis, redis-cluster, redis-replication, and redis-sentinel charts to 0.16.4, 0.16.4, 0.16.6, and 0.16.8 respectively.
- Enhanced initContainer properties in templates to include the 'enabled' field for better configuration management.

This update ensures consistency across the Redis charts and improves template rendering.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-05 16:19:50 +08:00
yangw b9034e8674
fix: chart render error when enable initcontainer (#1146)
fix: update initContainer and sidecar property references

- Updated version and appVersion for redis, redis-cluster, redis-replication, and redis-sentinel charts.
- Modified initContainer and sidecar property references in templates to include the current context.

This update ensures consistency across the Redis charts and improves template rendering.

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-12-02 17:36:01 +08:00
Dariusch Ochlast 53b95a0a20
fix: pdb value mapping in redis-sentinel (#1136)
Signed-off-by: Dariusch Ochlast <dariusch.ochlast@gmail.com>
2024-11-18 17:48:38 +08:00
dependabot[bot] 7953e5320e
chore(deps): bump github.com/redis/go-redis/v9 from 9.5.1 to 9.7.0 (#1131)
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.5.1 to 9.7.0.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.5.1...v9.7.0)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-17 13:41:58 +08:00
dependabot[bot] aa2e89567d
chore(deps): bump codecov/codecov-action from 4 to 5 (#1130)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-17 13:41:41 +08:00
yangw 3135e0f4eb
feat: add context param and get logger from it (#1132)
* rename

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add context param

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove logger

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove logger

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove logger

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* lint

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* update

* update

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-11-15 17:45:01 +08:00
dependabot[bot] f72628d89a
chore(deps): bump github.com/onsi/gomega from 1.33.1 to 1.35.1 (#1119)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.33.1 to 1.35.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.33.1...v1.35.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-15 11:13:57 +08:00
Taisuke Okamoto 38bc027757
doc: fix "Image Compatibility" (#1128)
Signed-off-by: b1gb4by <34154552+b1gb4by@users.noreply.github.com>
2024-11-14 16:17:09 +08:00
Shubham Gupta c6fcdb7f27
refactor(deps): bump go from 1.21 to 1.22 (#853)
* refactor(deps): bump go from 1.21 to 1.22

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: bump go version

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* update

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: drivebyer <wuyangmuc@gmail.com>
2024-11-14 15:25:57 +08:00
Nash Luffman 0eac383fe2
test: remove unnecessary waits from e2e tests (#1106)
* remove unnecessary waits from e2e tests

Signed-off-by: mluffman <mluffman@thoughtmachine.net>

* small refactor of platforms in Makefile

Signed-off-by: mluffman <mluffman@thoughtmachine.net>

* fix

* update

* fix

---------

Signed-off-by: mluffman <mluffman@thoughtmachine.net>
Co-authored-by: mluffman <mluffman@thoughtmachine.net>
Co-authored-by: drivebyer <wuyangmuc@gmail.com>
2024-11-13 17:19:16 +08:00
yangw 5a8a3452d7
feat: add recreateStatefulSetOnUpdateInvalid helm chart value (#1127)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-11-13 15:55:06 +08:00
yangw 147d7069f1
feat: add master/replica service to redis replication (#1124)
* refactor

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* feat: add master/replica service to redis replication

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix docs

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix docs

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-11-11 15:06:00 +08:00
Dariusch Ochlast efb96249a7
feat: add PDB and probes, drop unspecified acl in sentinel helm (#1123)
Signed-off-by: Dariusch Ochlast <dariusch.ochlast@gmail.com>
2024-11-08 10:46:25 +08:00
drivebyer d04332679c Update redis operator version 2024-11-07 21:34:56 +08:00
yangw c48c9c5b0d
feat: reconcile redis sentinel only on master changed (#1122)
* feat: redissentinel reconcile only on master changed

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix Lint

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* e2e cleanup

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-11-06 21:52:56 +08:00
yangw e6f354fe4a
fix: set controller probe endpoint handler (#1121)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-11-06 13:30:33 +08:00
yangw 9d37c6e4c7
test: remove some duplicated e2e case (#1114)
* cleanup: remove some duplicated e2e case

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* cleanup: remove some duplicated e2e case

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* cleanup: remove some duplicated e2e case

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* move

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* avoid context deadline exceeded

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove useless

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove useless

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove useless

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* rename

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add parallel

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

* fix gsed

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

* remove

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-11-05 12:46:59 +08:00
yangw 89b18fe96e
Update CODEOWNERS 2024-10-29 11:04:59 +08:00
dependabot[bot] a4658eda86
chore(deps): bump helm/chart-releaser-action from 1.5.0 to 1.6.0 (#1009)
Bumps [helm/chart-releaser-action](https://github.com/helm/chart-releaser-action) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/helm/chart-releaser-action/releases)
- [Commits](https://github.com/helm/chart-releaser-action/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: helm/chart-releaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 13:52:07 +08:00
dependabot[bot] 791c1d94fc
chore(deps): bump sigstore/cosign-installer from 3.6.0 to 3.7.0 (#1096)
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.6.0 to 3.7.0.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v3.6.0...v3.7.0)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 13:51:42 +08:00
dependabot[bot] 934896b777
chore(deps): bump kyverno/action-install-chainsaw from 0.2.9 to 0.2.11 (#1095)
Bumps [kyverno/action-install-chainsaw](https://github.com/kyverno/action-install-chainsaw) from 0.2.9 to 0.2.11.
- [Release notes](https://github.com/kyverno/action-install-chainsaw/releases)
- [Commits](https://github.com/kyverno/action-install-chainsaw/compare/v0.2.9...v0.2.11)

---
updated-dependencies:
- dependency-name: kyverno/action-install-chainsaw
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 13:51:14 +08:00
Nash Luffman de6b0661d3
fix: Attempt to repair disconnected/failed master nodes before failing over (#1105)
* add support for repairing leaders

Signed-off-by: mluffman <mluffman@thoughtmachine.net>

* add make lint directive

Signed-off-by: mluffman <mluffman@thoughtmachine.net>

* add test

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

* fix lint

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

* fix lint

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

* chainsaw

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

* update

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

* update

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

* no parallel

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

---------

Signed-off-by: mluffman <mluffman@thoughtmachine.net>
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Co-authored-by: mluffman <mluffman@thoughtmachine.net>
Co-authored-by: drivebyer <wuyangmuc@gmail.com>
2024-10-18 15:50:33 +08:00
Nash Luffman bee2bf738e
chore: update makefile and various tooling dependencies (#1102)
* update controller-gen to fix make manifests, update Makefile

Signed-off-by: Nash Luffman <nashluffman@gmail.com>

* update envtest version

Signed-off-by: Nash Luffman <nashluffman@gmail.com>

* fix path

Signed-off-by: Nash Luffman <nashluffman@gmail.com>

* add kind as dependency

Signed-off-by: Nash Luffman <nashluffman@gmail.com>

---------

Signed-off-by: Nash Luffman <nashluffman@gmail.com>
2024-10-14 22:08:26 +08:00
yangw 94e24377fb
feat: upgrade redis/sentinel image to 7.0.15 (#1099)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-10-12 17:11:08 +08:00
dependabot[bot] 10ba30ab1d
chore(deps): bump actions/checkout from 3 to 4 (#1085)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-05 20:37:24 +08:00
dependabot[bot] 9284b8fa95
chore(deps): bump azure/setup-helm from 3 to 4 (#1087)
Bumps [azure/setup-helm](https://github.com/azure/setup-helm) from 3 to 4.
- [Release notes](https://github.com/azure/setup-helm/releases)
- [Changelog](https://github.com/Azure/setup-helm/blob/main/CHANGELOG.md)
- [Commits](https://github.com/azure/setup-helm/compare/v3...v4)

---
updated-dependencies:
- dependency-name: azure/setup-helm
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-25 17:25:33 +05:30
dependabot[bot] 324a09ad0f
chore(deps): bump actions/setup-python from 4 to 5 (#1086)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-25 17:22:56 +05:30
Shubham Gupta 344b3d0362
Revert "chore(deps): bump helm/kind-action from 1.5.0 to 1.10.0" (#1082)
Revert "chore(deps): bump helm/kind-action from 1.5.0 to 1.10.0 (#1070)"

This reverts commit 36e2666610.
2024-09-23 19:50:53 +05:30
dependabot[bot] 753798e390
chore(deps): bump github.com/go-logr/logr from 1.4.1 to 1.4.2 (#942)
---
updated-dependencies:
- dependency-name: github.com/go-logr/logr
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 19:13:41 +05:30
dependabot[bot] 1ba262abb8
chore(deps): bump actions/checkout from 2 to 4 (#944)
---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 19:12:21 +05:30
dependabot[bot] 69970d4703
chore(deps): bump docker/login-action from 1 to 3 (#946)
---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 19:11:13 +05:30
dependabot[bot] 0a48634fb1
chore(deps): bump amannn/action-semantic-pull-request from 5.4.0 to 5.5.3 (#1013)
chore(deps): bump amannn/action-semantic-pull-request

Bumps [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) from 5.4.0 to 5.5.3.
- [Release notes](https://github.com/amannn/action-semantic-pull-request/releases)
- [Changelog](https://github.com/amannn/action-semantic-pull-request/blob/main/CHANGELOG.md)
- [Commits](e9fabac35e...0723387faa)

---
updated-dependencies:
- dependency-name: amannn/action-semantic-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 19:09:41 +05:30
dependabot[bot] 36e2666610
chore(deps): bump helm/kind-action from 1.5.0 to 1.10.0 (#1070)
Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.5.0 to 1.10.0.
- [Release notes](https://github.com/helm/kind-action/releases)
- [Commits](https://github.com/helm/kind-action/compare/v1.5.0...v1.10.0)

---
updated-dependencies:
- dependency-name: helm/kind-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 19:07:50 +05:30
Shubham Gupta 1dcc0c939b
ci: Revert GitHub Actions workflow for publishing charts (#1076)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-09-19 18:06:52 +05:30
Shubham Gupta 0c036f0a3d
ci: Fix Ci for the helm chart release (#1075)
* chore: update redis-operator chart version to 0.18.3

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: update publish-charts.yaml workflow

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-09-19 17:47:05 +05:30
Shubham Gupta c44d80b5a2
chore: update redis-operator chart version to 0.18.3 (#1074)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-09-19 17:41:52 +05:30
yangw debcfd34c5
docs: fix image src path (#1073)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-09-18 14:11:43 +08:00
yangw e73a1d4765
feat: add readiness/liveness probe to redis operator chart (#1072)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-09-17 16:54:22 +08:00
yangw dd94689aba
feat: add service monitor to redis sentinel chart (#1071)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-09-17 15:53:38 +08:00
drivebyer 3d31886fdb ci: add stale pr/issue workflow 2024-09-17 13:15:48 +08:00
yangw 72ce071038
test: add test strategy version 6.2.14 (#1068)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-09-17 11:42:36 +08:00
yangw f48930c523
test: add test strategy for redis version (#1067)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-09-16 23:27:30 +08:00
yangw 64d720485b
test: remove chainsaw test strategy (#1066)
* test: remove chainsaw test strategy

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

* test: remove chainsaw test strategy

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

* test: remove chainsaw test strategy

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-09-16 20:47:56 +08:00
dependabot[bot] c0dc6369bb
chore(deps): bump kyverno/chainsaw from 0.0.9 to 0.2.9 (#1057)
* chore(deps): bump kyverno/chainsaw from 0.0.9 to 0.2.9

Bumps [kyverno/chainsaw](https://github.com/kyverno/chainsaw) from 0.0.9 to 0.2.9.
- [Release notes](https://github.com/kyverno/chainsaw/releases)
- [Changelog](https://github.com/kyverno/chainsaw/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/kyverno/chainsaw/compare/v0.0.9...v0.2.9)

---
updated-dependencies:
- dependency-name: kyverno/chainsaw
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update ci.yaml

* update

* update

* update

* update

* update

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: yangw <yang.wu@daocloud.io>
Co-authored-by: drivebyer <wuyangmuc@gmail.com>
2024-09-16 17:16:23 +08:00
yangw 2b70f53c5c
test: cleanup some e2e test move to envtest (#1065)
* test: cleanup some e2e test, move to envtest

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

* update

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

* update

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

* update

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

* update

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

* update

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-09-15 23:34:12 +08:00
yangw 70bee6f2d3
test: move controller to their own package (#1064)
* test: move controller to their own package

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

* update

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-09-15 17:24:46 +08:00
yangw 86adf564f0
ci: add helm docs test action (#1058)
* ci: add helm docs test action

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* update

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* update

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* update

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* update

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-09-12 11:34:34 +08:00
civkule 10911243ef
feat: add image pull secret for redis operator (#1053)
* imagePullSecret for redis-operator

Added imagePullSecret for redis-operator in operator-deployment.yaml file

Signed-off-by: civkule <nac.ext@velux.com>

* added imagePullSecrets in values.yaml

Signed-off-by: civkule <nac.ext@velux.com>

---------

Signed-off-by: civkule <nac.ext@velux.com>
2024-08-30 17:17:14 +08:00
Rhys Evans 7c2d396f4c
feat: add tolerations to operator chart (#1051)
added tolerations

Signed-off-by: Rhys <rhys@rhysevans.co.uk>
Co-authored-by: Rhys <rhys.e@data-edge.co.uk>
2024-08-30 17:10:59 +08:00
yangw 10087be281
docs: generate chart README from helm-docs (#1041)
* docs: generate chart README from helm-docs

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* update

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-08-08 13:46:12 +08:00
Daniel Schaaff 31c5dcaa67
fix: bad indentation on redis standalone additional configs (#1040)
fix bad indentation on redis standalone additional configs

It was incorrectly being nested under the redis exporter config key.

Signed-off-by: Daniel Schaaff <daniel@danielschaaff.com>
2024-08-06 10:21:56 +08:00
drivebyer 3698e790d1 Update redis operator version 2024-08-01 14:14:47 +08:00
yangw e3655af543
fix: unknown field error when upgrade chart (#1034)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-07-24 11:22:36 +08:00
yangw b343653303
fix: field validate error when enable additional config for sentinel (#1033)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-07-23 18:12:03 +08:00
mattrobinsonsre c3bbe881a5
feat: support setting minReadySeconds on the stateful sets (#1023)
Signed-off-by: Matt Robinson <mattrobinsonsre@gmail.com>
2024-07-23 13:50:59 +08:00
yangw d64670ee36
fix: indention error when enable additional config (#1031)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-07-23 13:19:43 +08:00
drivebyer 1f51a5e60e Release operator chart 0.18.0 2024-07-12 23:25:54 +08:00
yangw 0dddaeac9a
feat: add redisReplicationPassword values to connect secured replication (#1021)
feat: add redisReplicationPassword values to connect secured replication cluster

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-07-10 14:31:55 +08:00
yangw 08eb5eb236
docs: fix example broken links (#1008)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-23 19:31:02 +08:00
dependabot[bot] 02fb120721
chore(deps): bump docker/build-push-action from 3 to 6 (#998)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-23 11:06:11 +08:00
yangw 224c2860d2
feat: add redis/redisreplication/redissentinel/rediscluster chart (#1007)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-23 11:04:27 +08:00
Laurentiu Soica f1080f5722
feat: allow rbac to pe externally provisioned (#1005)
* feat: allow rbac to pe externally provisioned

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: add new parameter in docs

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

---------

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>
Co-authored-by: laurentiusoica <laurentiu.soica@spirent.com>
2024-06-22 22:17:56 +08:00
Mathieu Cesbron dd4e8e107c
chore: remove latest version for conversion webhook (#760)
Remove latest version for conversion webhook

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-06-21 15:18:29 +08:00
yangw c58d54f69f
fix: add default port to enable `SENTINEL_PORT` environment (#999)
* fix: add default port to enable `SENTINEL_PORT` environment

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-06-19 20:58:01 +08:00
Laurentiu Soica 909d9e4a7f
feat: add support for extra volume mounts for redis sentinel (#994)
* feat: add support for extra volume mounts for redis sentinel

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: add tests

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: yaml lint

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: docs

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

---------

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>
Co-authored-by: laurentiusoica <laurentiu.soica@spirent.com>
2024-06-19 15:18:17 +08:00
Mahesh Kumar 6794133674
test: Cover Createorupdatestateful (#968)
* test:CreateOrUpdateStateFul test case

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* createorupdatestateful-test cover

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* test:createorupdatestateful fixing liniting

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* fixing linting

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* test: createorupdatestateful cover

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* test: fixing linting

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* test: fixed liniting

Signed-off-by: opstree <opstree@opstrees-MacBook-Pro-2.local>

* test: added new test case with error

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

---------

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
Signed-off-by: opstree <opstree@opstrees-MacBook-Pro-2.local>
Co-authored-by: opstree <opstree@opstrees-MacBook-Pro-2.local>
2024-06-19 14:32:00 +08:00
Mahesh Kumar 4f5f721c0d
test: cover getSidecars (#997)
Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
2024-06-19 14:27:20 +08:00
yangw 2838af46d2
fix: ReadyReplicas need to be checked in `IsStatefulSetReady` (#993)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-16 23:30:24 +08:00
yangw b6194b03c4
feat: add automountServiceAccountToken values for deployment and serviceaccnount (#991)
feat: add automountServiceAccountToken values for deployment and serviceaccount

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-15 20:58:01 +08:00
yangw 052d2e5e0d
fix: watchNamespace value does not take effect in chart (#990)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-15 18:21:48 +08:00
yangw 4afc8c2d16
test: cluster connection must be run after ready (#989)
* test: cluster connection must be run after ready

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

* remove assert

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

* fix

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-15 18:21:18 +08:00
Laurentiu Soica a838608369
feat: add securityContext for exporter, initcontainers and sidecars (#987)
* feat: add securityContext for exporter, initcontainers and sidecars

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: add docs

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: RedisExporterSecurityContext instead of SecurityContext

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: code review

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: refresh crds

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

* fix: refresh crds

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>

---------

Signed-off-by: laurentiusoica <laurentiu.soica@spirent.com>
Co-authored-by: laurentiusoica <laurentiu.soica@spirent.com>
2024-06-15 17:04:50 +08:00
yangw b22118c21e
refactor: reconcile on statefulset update (#988)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-15 17:02:07 +08:00
Mahesh Kumar 46ded9feb8
test: generateStatefulSetsDef cover (#980)
Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
2024-06-12 10:07:05 +08:00
yangw b44f30367c
refactor: add common controller util (#977)
* refactor: add common controller util

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix lint

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

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-08 11:52:04 +08:00
yangw ae814ecc05
feat: add security context values in operator chart (#973)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-06 22:38:13 +08:00
yangw 92ac24faff
feat: rolling update sequence from leader to follower (#966)
* feat: rolling update sequence from leader to follower

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add suffix

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix lint

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-06-05 14:24:15 +08:00
Mahesh Kumar 96a5ccf86c
test: generateInitContainerDef added additional env and resources (#963)
* test: cover generateInitContainerDef

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* test: generateInitContainerDef added additional env and resources

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

---------

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
2024-06-05 10:02:28 +08:00
yangw ba8dfa4349
fix: sentinel should not reconcile until replication cluster ready (#964)
* fix: sentinel should not reconcile until replication cluster ready

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

* check master attached slave

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

* increase waiting

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-04 22:51:16 +08:00
Mahesh Kumar a207422fac
test: cover generateContainerDef (#962)
Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
2024-06-03 19:49:19 +08:00
yangw 0fd0e42dd8
refactor: remove duplicated tls code (#961)
* remove dup log

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

* remove dup tsl replication code

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-06-02 23:24:42 +08:00
yangw 5554025660
ci: remove unuse kuttl test workflow (#958)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-05-31 10:05:19 +08:00
drivebyer 64d376eba3 Release operator chart 0.16.1 2024-05-30 22:22:24 +08:00
yangw df24341c84
ci: fix chart release yaml syntax (#957)
* ci: fix chart release yaml syntax

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

* add path

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-05-30 22:12:52 +08:00
drivebyer 52ed749d8b Release operator chart 0.15.11 2024-05-30 21:54:00 +08:00
Jordan Rodgers 5ec6ef3248
feat: add support for configurable probe handlers (#934)
add support for configurable probe handlers

Signed-off-by: Jordan Rodgers <jrodgers@mux.com>
2024-05-30 17:29:54 +08:00
yangw bd6ddac64f
build: separate chart and image release process (#956)
build: separate chart / image release process

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-05-30 11:30:02 +08:00
yangw 8ba7390442
feat: add redis operator helm chart and release workflow (#941)
* copy operator chart from helm-charts repo

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

* add chart release workflow

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* change operator image

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-05-27 23:43:24 +05:30
Thomas Montague e021986de8
build: add support for other container engines (#947)
Add support for other container engines.

Signed-off-by: Thomas Montague <thomas.montague@trmlabs.com>
2024-05-23 10:25:51 +08:00
yangw d15c80e546
fix: return ASAP after handling finalizer (#940)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-05-22 09:48:51 +08:00
dependabot[bot] 39ed5d0a7c
chore(deps): bump docker/setup-qemu-action from 2 to 3 (#915)
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 21:08:06 +08:00
dependabot[bot] 68d053b51f
chore(deps): bump docker/setup-buildx-action from 2 to 3 (#917)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 21:07:51 +08:00
dependabot[bot] deb9cd667c
chore(deps): bump golangci/golangci-lint-action from 5 to 6 (#916)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5 to 6.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 21:07:37 +08:00
dependabot[bot] 14fce7cd7c
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.17.2 to 2.17.3 (#920)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.17.2 to 2.17.3.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.17.2...v2.17.3)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 21:07:18 +08:00
yangw bd1e4faf06
fix: check redis replication after handling finalizer (#936)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-05-21 20:05:20 +08:00
yangw fae7db7845
build: repository name must be lowercase (#926)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-05-14 23:04:10 +08:00
yangw 09a80f41a7
feat: add redis-role label to redis replication (#925)
* feat: add redis-role label to redis replication

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix lint

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix lint

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-05-14 19:22:07 +08:00
yangw a9fa6997f9
fix: runtime panic when delete rediscluster which disable persistent (#922)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-05-11 13:28:18 +08:00
yangw 37ac693c16
feat: WATCH_NAMESPACE support multi namespace (#919)
* feat: WATCH_NAMESPACE support multi namespace

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

* format

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-05-07 22:54:38 +08:00
Mathieu Cesbron c0b3c04c2d
docs: update standalone pod name (#747)
Update standalone pod name

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-05-07 14:28:59 +08:00
teocns c02d5a65e4
fix: runtime panic when `storage` param is empty (#887)
* fix runtime panic when storage param is empty

Signed-off-by: Teo <teocns@gmail.com>

* Update redis-cluster.go

* remove blank

* Update redis-cluster.go

---------

Signed-off-by: Teo <teocns@gmail.com>
Co-authored-by: yangw <yang.wu@daocloud.io>
2024-05-07 11:46:41 +08:00
yangw 10c1e6bba8
build: add workflow to publish image to ghcr (#914)
* build: add ghcr release process

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

* fix: env

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-05-07 09:58:02 +08:00
yangw 4e60683fc5
feat: probe use built-in, discarded healthcheck.sh (#907)
* feat: probe use built-in, discarded healthcheck.sh

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* use shell

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-05-06 12:25:41 +05:30
yangw 95d1f55d5d
ci: run e2e after operator ci check (#913)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-05-06 14:45:02 +08:00
dependabot[bot] 840675c880
chore(deps): bump github.com/onsi/gomega from 1.33.0 to 1.33.1 (#910)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.33.0 to 1.33.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.33.0...v1.33.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-04 13:11:12 +08:00
dependabot[bot] f59f71e7b6
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.17.1 to 2.17.2 (#903)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.17.1 to 2.17.2.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.17.1...v2.17.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-30 16:37:02 +05:30
Jae Jahng (Jude) 9cd2ae947c
fix: exporter can not connect to redis when enable tls (#902)
Signed-off-by: wkd-woo <wkdwoos@gmail.com>
2024-04-29 15:10:30 +08:00
dependabot[bot] 4c7b570329
chore(deps): bump github.com/onsi/gomega from 1.32.0 to 1.33.0 (#881)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.32.0 to 1.33.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.32.0...v1.33.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-27 13:33:43 +08:00
dependabot[bot] 3c5373ecd7
chore(deps): bump golangci/golangci-lint-action from 4 to 5 (#894)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4 to 5.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-27 13:33:14 +08:00
yangw 40c4a0d11e
refactor: update status if not equal (#900)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-04-26 17:08:18 +08:00
dependabot[bot] f5028bd4bb
chore(deps): bump helm/kind-action from 1.9.0 to 1.10.0 (#889)
Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/helm/kind-action/releases)
- [Commits](https://github.com/helm/kind-action/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: helm/kind-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-25 10:01:12 +08:00
Mahesh Kumar 80bc4a41c5
test: cover generateInitContainerDef (#888)
Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
2024-04-23 10:09:19 +08:00
yangw 736836c39e
fix: should get the really leader count when scale in (#885)
* fix: should get the really leader count when scale in

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix timeout

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-04-22 14:11:59 +05:30
yangw 7999a058f4
fix: ClusterSlaves result should be cut (#884)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-04-20 14:42:08 +05:30
Mahesh Kumar b37366a670
test: cover func enableRedisMonitoring (#883)
Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
2024-04-19 17:42:19 +05:30
dependabot[bot] 15df443f6b
chore(deps): bump k8s.io/api from 0.29.3 to 0.29.4 (#874)
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.29.3 to 0.29.4.
- [Commits](https://github.com/kubernetes/api/compare/v0.29.3...v0.29.4)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-17 16:07:50 +08:00
yangw 80e7f2fd3b
fix: redis cluster update as scale out (#872)
* fix: redis cluster update as scale out

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

* add e2e test step && remove unnecessary test assert

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

* add newline

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

* add newline

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-04-16 19:14:03 +05:30
yangw 7b8c3757b2
ci: validate yaml before run e2e (#873)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-04-16 19:12:43 +05:30
Mahesh Kumar 454e88c936
test: Cover func updatestatefulset (#863)
* test case for updatestatefulset functions

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* tests: updated TestUpdateStatefulSet

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>

* fix: failing test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add one more case

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Mahesh Kumar <k.mahesh.9779@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: opstree <opstree@opstrees-MacBook-Pro-2.local>
Co-authored-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-04-13 19:35:35 +05:30
yangw a87435680e
feat: implement redis cluster ready state (#867)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-04-13 18:22:48 +05:30
yangw 86945fc2c4
refactor: add common AddFinalizer for all api (#858)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-04-02 00:06:47 +05:30
Shubham Gupta 41fd1646e8
test: Add unit test (#856)
* test: Add unit test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Cover TestCheckRedisCluster

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix coverage

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: coverage

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: remove print statement

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-31 23:19:36 +05:30
Shubham Gupta 80a26a9486
ci: Validate Test Yaml (#854)
* ci: Validate Test Yaml

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix yaml intendation

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix yaml via yamlfix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add line for fun

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* feat: run yamlfix in parallel

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: fix script

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: use root

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: add  yaml lint configuration

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: changes

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: config

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: chainsaw example

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: long lines

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: example validation

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix secrets

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: add comment

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-30 21:09:22 +05:30
yangw eb1cc0d3dc
feat: add redisreplication status masterNode (#849)
* feat: add redisreplication status masterNode

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix e2e

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix lint

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix lint

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-03-30 19:04:27 +05:30
Shubham Gupta ab45fe06d9
chore(deps): bump sigs.k8s.io/controller-runtime from 0.16.2 to 0.17.2 (#852)
* chore(deps): bump k8s.io/client-go from 0.28.2 to 0.29.3

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* bump : notify

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: remove unused code

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore(deps): bump sigs.k8s.io/controller-runtime from 0.16.2 to 0.17.2

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-30 10:06:53 +08:00
Shubham Gupta 1c2dc012a1
chore(deps): bump k8s.io/client-go from 0.28.2 to 0.29.3 (#851)
* chore(deps): bump k8s.io/client-go from 0.28.2 to 0.29.3

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: remove deprecated method

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* bump : notify

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* make codegen

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

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Co-authored-by: drivebyer <wuyangmuc@gmail.com>
2024-03-30 00:21:46 +05:30
Mathieu Cesbron bf1a5a90df
Remove useless comments (#761)
Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-03-29 18:02:31 +05:30
Shubham Gupta aeba01968b
test(client): Add Redis Mock Test code (#842)
* test(client) : Add Redis Mock Test code

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test(client): Add for followers node id's

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: cover checkAttachedSlave

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add redis server role

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: add redis operator pod logs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: add log statement

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: fix logs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix unit test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: return data

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix the role

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: remove comment

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* refactor: move logger to params

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add test Get statefulset

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-29 10:36:55 +08:00
dependabot[bot] a6d372d1b4
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.16.0 to 2.17.1 (#844)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.16.0 to 2.17.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.16.0...v2.17.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-27 10:34:01 +08:00
Shubham Gupta a521613535
test: Show Operator Failed Logs (#843)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-25 11:44:08 +08:00
Shubham Gupta ff9166508b
chore: use redis client library (#840)
* chore: use appropriate way to calulate slots

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: remove unncessary conversion

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: improve slaveid calculation

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-24 11:40:38 +05:30
Shubham Gupta 2ee43243be
test(client): Add redis mock client (#841)
* test(Client): Add redis mock client

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fake commit

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fake commit

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-24 11:40:25 +05:30
dependabot[bot] 17abdf401e
chore(deps): bump github.com/onsi/gomega from 1.31.1 to 1.32.0 (#834)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.31.1 to 1.32.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.31.1...v1.32.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-19 17:00:23 +08:00
yangw edc3083322
fix: ensure sentinel does not observes the failover progress in replication cluster (#803)
* fix: ensure sentinel does not observes the failover progress in replication cluster

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add e2e

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

* enhance check

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

* check master through sentinel

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

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-03-18 19:42:09 +05:30
dependabot[bot] e8b1ffffee
chore(deps): bump github.com/banzaicloud/k8s-objectmatcher from 1.7.0 to 1.8.0 (#819)
chore(deps): bump github.com/banzaicloud/k8s-objectmatcher

Bumps [github.com/banzaicloud/k8s-objectmatcher](https://github.com/banzaicloud/k8s-objectmatcher) from 1.7.0 to 1.8.0.
- [Commits](https://github.com/banzaicloud/k8s-objectmatcher/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/banzaicloud/k8s-objectmatcher
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-17 16:14:59 +05:30
Jami Karvanen 1cf27bbf08
fix: m/s replication when using ipv6 (#827)
* Delete unnecessary brackets wrapping the IPv6 address

Signed-off-by: Jami Karvanen <jami@karvanen.fi>

* Extract redis address formatting into separate getRedisServerAddress function

Signed-off-by: Jami Karvanen <jami@karvanen.fi>

* Add tests for getRedisServerAddress

Signed-off-by: Jami Karvanen <jami@karvanen.fi>

* Use getRedisServerAddress also in cluster-scaling.go

Signed-off-by: Jami Karvanen <jami@karvanen.fi>

---------

Signed-off-by: Jami Karvanen <jami@karvanen.fi>
2024-03-15 13:37:58 +08:00
dependabot[bot] 96c1b15526
chore(deps): bump google.golang.org/protobuf from 1.30.0 to 1.33.0 (#828)
Bumps google.golang.org/protobuf from 1.30.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-14 10:31:50 +08:00
dependabot[bot] 94afadd506
chore(deps): bump docker/build-push-action from 2 to 5 (#826)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-11 21:38:50 +08:00
Shubham Gupta 1dae4235b1
refactor(client): Use interface (#804)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-11 16:39:10 +05:30
yangw 61d89f4050
fix: sentinel waiting for replication pod got ready (#806)
* fix: sentinel waiting for replication pod got ready

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

* avoid nil pointer

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

* fix for linter

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-03-11 16:38:56 +05:30
dependabot[bot] fd786066f8
chore(deps): bump github.com/onsi/gomega from 1.30.0 to 1.31.1 (#820)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.30.0 to 1.31.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.30.0...v1.31.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 17:29:42 +08:00
dependabot[bot] 044d389b4d
chore(deps): bump codecov/codecov-action from 3 to 4 (#823)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 17:29:14 +08:00
dependabot[bot] d121d86988
chore(deps): bump docker/setup-buildx-action from 2 to 3 (#825)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 17:28:49 +08:00
dependabot[bot] 6fb1bdbfee
chore(deps): bump helm/kind-action from 1.5.0 to 1.9.0 (#824)
Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.5.0 to 1.9.0.
- [Release notes](https://github.com/helm/kind-action/releases)
- [Commits](https://github.com/helm/kind-action/compare/v1.5.0...v1.9.0)

---
updated-dependencies:
- dependency-name: helm/kind-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 17:28:07 +08:00
dependabot[bot] e4d5aec671
chore(deps): bump golangci/golangci-lint-action from 3 to 4 (#810)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3 to 4.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 15:51:05 +08:00
dependabot[bot] 69c549e96e
chore(deps): bump jlumbroso/free-disk-space from 1.3.0 to 1.3.1 (#812)
Bumps [jlumbroso/free-disk-space](https://github.com/jlumbroso/free-disk-space) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/jlumbroso/free-disk-space/releases)
- [Commits](https://github.com/jlumbroso/free-disk-space/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: jlumbroso/free-disk-space
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 15:50:13 +08:00
dependabot[bot] 60ea390422
chore(deps): bump github.com/redis/go-redis/v9 from 9.2.1 to 9.5.1 (#813)
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.2.1 to 9.5.1.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.2.1...v9.5.1)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 13:48:33 +08:00
dependabot[bot] 4ddd2f8441
chore(deps): bump actions/setup-go from 4 to 5 (#811)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 13:47:16 +08:00
dependabot[bot] 012d5babae
chore(deps): bump github/codeql-action from 1 to 3 (#809)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 10:16:25 +08:00
dependabot[bot] fcd7d5858c
chore(deps): bump actions/checkout from 2 to 4 (#808)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 10:15:44 +08:00
dependabot[bot] 9bab658b7a
chore(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#814)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 10:14:46 +08:00
dependabot[bot] 90122a4fe1
chore(deps): bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.16.0 (#815)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.11.0 to 2.16.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.11.0...v2.16.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-08 10:14:12 +08:00
Shubham Gupta 39e5bf5ddf
ci: add deps scope in pr semantics (#818)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-07 23:27:42 +05:30
Shubham Gupta d3abdd37a2
ci: Add dependabot and cherry-pick-bot (#807)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-07 23:23:24 +05:30
Shubham Gupta 17b9d2c812
test: service unit Testing (#800)
* test: service unit Testing

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: add Test_createService

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: update service

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-05 22:05:23 +05:30
Shubham Gupta 6318922184
test: Add Finalizers Unit Test (#799)
* test: Add Unit Test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: update makefile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* gci-ed

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add finalizers testing

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* gci-ed

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* style: fix trailing new line

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add Handle Redis Cluster Finalizers

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: makefile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add Handle Replication Finalizers

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add Redis Sentinel Handle Finalizers

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* chore: remove unused code

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix coverage

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-05 17:56:02 +05:30
Shubham Gupta dd8318bba5
test: Remove Duplicate Kuttl Test (#798)
* test: remove kuttl hostnetwork test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: remove kutll hostnetwork

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add chainsaw redis-standalone teardown

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add yaml language server

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add chainsaw redis-replication teardown

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: Drop teardown kuttl test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add chainsaw redis-sentinel teardown

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: Drop setup kuttl test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix typo in chainsaw redis-replication teardown

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add cluster scaling test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: Add cluster scaling

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: test for acl user (#797)

* test: test for acl user

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: add to ci

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* style: remove trailing space

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix uri scheme

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: test on all

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix typo

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: Add cluster scaling

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: remove kuttl test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: Add chainasw ignore annots

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: add ignore annots

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: mutiple runs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: fix failure

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-05 01:39:18 +05:30
Shubham Gupta 45dfa17a84
test: test for acl user (#797)
* test: test for acl user

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: add to ci

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* style: remove trailing space

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix uri scheme

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: test on all

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: fix typo

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-04 23:21:25 +05:30
Shubham Gupta 649ebd4f3d
ci: Improve CI linting (#791)
* ci: enable more linters

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: diable few checks for temporary

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: read permission to ci

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: try removing cache

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: diable ifelse linter for temp

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* syle: run gofumpt

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* sytle: run gci

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: prevent misspell

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: run go import

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* style: fix style errors

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* style: fix trailing lines

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* remove unwanted conversion

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* remove gci from generated file

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* style: remove init check

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: type conversion

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix: remove context

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: update configuration file

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: skip generated files

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ci: remove disabled lintesr

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-03 18:35:55 +05:30
Shubham Gupta 4e66ea217a
ci: halt failing release (#794)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-03 03:57:38 +05:30
Shubham Gupta 1193987d4e
ci: fmt and vet covered in golang Ci linters by default (#792)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-03 03:50:41 +05:30
Shubham Gupta 8f5969f973
add: codeowners (#793)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-03 03:49:18 +05:30
Shubham Gupta e97bf7d46f
ci: bump chainsaw version (#789)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2024-03-02 23:47:15 +05:30
Shubham Gupta 30315eb5d1
Create FUNDING.yml 2024-03-02 23:44:37 +05:30
yangw 891d740293
fix: nil pointer dereference in conversion webhook (#787)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-02-26 17:36:48 +05:30
yangw db14d1b018
chore: enhance log every reconcile redis replication (#780)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-02-20 14:20:32 +08:00
yangw df2df6d4b4
feat: add field to keep pvc after cr be deleted (#772)
* feat: add field to keep pvc after cr be deleted

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

* fix kind

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

* fix delete name

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-02-09 15:28:13 +05:30
yangw bb69d00c6a
test: remove redundant creating (#771)
test: remove redundant running spec

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-02-08 17:19:33 +05:30
yangw 997dc67f2a
ci: improve the PR semantics (#770)
* ci: improve the PR semantics

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

* update scope

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-02-07 13:53:07 +05:30
yangw a14300132e
chore: enhance log every reconcile redis cluster (#767)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2024-02-01 13:56:33 +05:30
Mathieu Cesbron 3e6fcb9a5f
Remove useless comment (#758)
Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-24 01:04:42 +05:30
Mathieu Cesbron 2e1ba97645
test: add redis sentinel integration tests (#755)
* Add redis sentinel in suite test

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

* Add redis sentinel integration tests

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

---------

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-21 10:52:44 +08:00
Mathieu Cesbron f9938bc321
test: add redis replication integration tests (#754)
* Remove commented code

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

* Add redis replication reconciler in suite test

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

* Add redis replication integration tests

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

---------

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-20 13:15:54 +08:00
Mathieu Cesbron 6bf05bcf1b
Add redis cluster integration tests (#753)
* Move var integration tests

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

* Add dynamic k8s client in integration tests

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

* Add Integration tests for redis cluster

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

---------

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-19 03:41:25 +05:30
Mathieu Cesbron 629c2dfe12
fix: generate dynamic k8s client only once (#752)
Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-18 10:18:47 +08:00
Mathieu Cesbron 169194a69f
chore: fix clinet typo (#751)
Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-16 10:09:23 +08:00
Mathieu Cesbron cd1e810c4f
test: add envtest for redis standalone (#748)
Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-15 13:35:37 +08:00
Mathieu Cesbron 7665d4aff3
feat: generate k8s client only once (#750)
Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-14 15:23:43 +08:00
Mathieu Cesbron e57531acce
docs: add namespace creation (#746)
* Remove trailing whitespaces

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

* Add namespace creation on doc

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>

---------

Signed-off-by: Mathieu Cesbron <mathieu.cesbron@protonmail.com>
2024-01-11 16:34:53 +08:00
yangw ef99c4d600
feat: add environment to customize data pvc prefix (#742)
* support customize pvc template name

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

* add test case

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

* kubectl

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

* wait operator ready

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

* fix sleep

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

* fix sleep

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

* remove debug

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-01-10 14:43:42 +05:30
yangw f07f596a61
fix: exporter no auth to redis (#743)
* fix exporter no auth

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

* add e2e

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

* fix unit test

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

* fix test

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2024-01-10 14:42:48 +05:30
yangw c8fd3bd33c
feat: support create redis cluster by nodeport service (#738)
* copy e2e test from setup

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* support nodeport cluster

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* setup test check cluster

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix ip

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix check string

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* enable nodeport e2e test

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* test: add nodeport service check

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* test: test with redis 6

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* test: change version && add REDIS_MAJOR_VERSION env

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* test: fix check syntax

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-12-28 01:16:27 +05:30
yangw 8f789aa070
fix: exporter connect to custom redis port (#736)
* fix port check

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

* test redis_up

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

* fix exporter env

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

* fix url

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-12-25 12:32:49 +05:30
Shubham Gupta 8e8ded98ac
feat: Redis AUTH password (#734)
* make-codegen

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix codegen

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix naming

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix test file

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix secret issues

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-18 15:18:18 +05:30
Shubham Gupta deefc14c2d
test: HA-setup ( Replication and Sentinel ) Unsecured | Partial Secured (#732)
* add empty test files

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add replication file

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add to CI

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix : HA setup

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix files

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* sentinel size 1

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ping cluster

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix svc name

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try saving a key

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix-bug

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix port

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* don't save key

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix quorum

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: partial secured sentinel

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test: partial secured with redis replication

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* make max parallel

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-18 06:59:20 +05:30
Shubham Gupta d8ad9f9add
test: Try ping and save key on redis replication (#731)
* test: Try ping and save key on redis replication

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* saving without password

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try Comment

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-18 02:26:24 +05:30
Shubham Gupta 25d807ae24
sentinel-setup (#733)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-18 01:52:22 +05:30
Shubham Gupta 0ed854fc14
test: Setting Password on Redis Cluster (#729)
* try: Setting Password on Redis Cluster

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add to CI

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix-name

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add Exporter

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix stdout

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-18 00:50:48 +05:30
Shubham Gupta 50a62d185a
test: Add replication to chainsaw setup (#730)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-18 00:39:54 +05:30
yangw 62d79b87d8
feat: support exporter custom port (#728)
* support exporter custom port

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add e2e

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-12-17 23:12:03 +05:30
Shubham Gupta 692c4acb3a
test: Try Saving Key (#727)
* try: saving a key

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* sleep for 5 min

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* host network

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-14 02:56:13 +05:30
yangw adca06866e
feat: rediscluster support hostnetwork && custom port (#723)
* add cr filed, default port to 6379

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* replace with custom port

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* service custom port

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* make default to 6379 when reconcile old cluster

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add e2e

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-12-14 00:55:21 +05:30
Shubham Gupta 48b515b19e
test: try Ping cluster (#726)
* try Ping cluster

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* use script

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* PONG

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ping cluster

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* remove

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try spacing

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* pong

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix quote

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-13 13:38:03 +05:30
Shubham Gupta 1e2265831b
feat: Add Chainsaw Action in CI (#722)
* add chainsaw action

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* update

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix Ci

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add release

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Ci

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* remove build

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* test version

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try with 0.0.8

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try with v0.0.9

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* bump

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try with v0.0.4

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add : Setup

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* only setup

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix name

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* increase timeout

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* more time

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* bump timeout

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add teardown

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix delete

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* file

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-12-12 04:55:29 +05:30
yangw 48add7ecbf
fix: specify k8s version which contain darwin arm64 (#719)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-12-07 12:49:21 +05:30
yangw 76927086d2
[Fix] : returned both a non-zero result and a non-nil error (#705)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-11-21 20:47:37 +05:30
yangw a597c39328
[Fix] : cluster scaling (#704)
* add scale e2e yamls

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

* temp

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix the cluster scale

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

* adjust e2e

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-11-21 01:51:39 +05:30
yangw 6502c91c29
Merge pull request #703 from drivebyer/fix-pvc
[Fix] : redis data pvc not deleted
2023-11-14 23:32:08 +08:00
drivebyer bdbe6f0a20 fix unit test
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-11-14 23:11:58 +08:00
drivebyer 2036996437 add case
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-11-14 23:00:55 +08:00
drivebyer 3c17b57cf0 add e2e
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-11-14 22:58:57 +08:00
drivebyer b1e89de166 add e2e
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-11-14 22:55:37 +08:00
drivebyer d38c382058 fix data pvc finalize
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-11-14 22:54:13 +08:00
Shubham Gupta 697538ec33
test : Add redis_test.go (#702)
* Add test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add TestCreateMultipleLeaderRedisCommand

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add TestGetRedisTLSArgs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* createRedisReplicationCommand

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* add

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-11 20:02:36 +05:30
Shubham Gupta 58db9ec5a4
test: Add secret_test.go (#701)
* fix client

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add secret test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix lint

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* update CI

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-11 05:16:27 +05:30
Shubham Gupta 36591d5ba3
fix : Add client for Testing (#700)
* mock client

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* feat: add client

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add finalizers

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add Test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-11 01:07:54 +05:30
Shubham Gupta defdcdfab6
Add : Mock Client (#699)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-10 21:06:12 +05:30
Shubham Gupta 916779166e
test: Make Code Testable (#697)
* testing-client

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* client_test.go

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* push

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix Client

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix Dockerfile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* try fixing lint

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix ci

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix CI

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix CI

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* ignoree

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* change location

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-10 20:45:57 +05:30
Shubham Gupta 56996ef25e
fix-env (#696)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-08 23:29:55 +05:30
Shubham Gupta a2e4b79314
fix (#695)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-08 23:09:40 +05:30
Shubham Gupta 737dd02c31
qemu (#694)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-08 22:48:36 +05:30
Shubham Gupta 88252755e3
fix (#693)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-08 22:35:36 +05:30
Shubham Gupta 3531d5b00b
Fix: Release Workflow (#692)
* push image

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-08 22:21:27 +05:30
Shubham Gupta d0ce0668e8
push image (#691)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-08 22:10:24 +05:30
Shubham Gupta 1fd09c40a9
fix logs (#690)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-11-08 13:53:16 +05:30
yangw 5bf8182035
adjust some log level (#686)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-11-06 19:30:24 +05:30
yangw 520d3a29bd
test: add test for redisreplication/redissentinel/rediscluster (#687)
* ut for redis replication

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

* ut for redis sentinel

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

* ut for redis cluster

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

* remove useless field

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-11-06 18:42:27 +05:30
Shubham Gupta f7e6a28ade
makefile : Add Target to run e2e Test (#685)
* makefile targets for e2e

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-29 20:47:42 +08:00
Shubham Gupta 89c2daa647
test : Add Unit Test for redis-standalone.yaml (#683)
* standalone-unit-test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* more test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* Add test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-29 02:01:26 +05:30
Shubham Gupta 4a857f99e9
test : validate all the cr in the example dir (#684)
* validate-example

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* modify name

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fixes

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix err

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* crd

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix examples

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix yamls

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix yaml

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix lint

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix lint

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix lint

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix lint

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-29 00:19:08 +05:30
yangw 52c67ffd64
[Fix] : wait follower statefulset ready before make cluster (#680)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-10-26 19:56:33 +05:30
yangw 10fd741d54
[Fix] : setup label redis_setup_type to sentinel (#679)
* fix label redis_setup_type to sentinel

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

* add test

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

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-10-23 23:54:56 +05:30
yangw 5a4b6cf5e5
[Test] : add assert service to setup (#678)
Signed-off-by: drivebyer <wuyangmuc@gmail.com>
2023-10-23 19:29:23 +05:30
yangw 5b003aeb86
[Test] : add redis replication setup case (#677)
* [Test] : add redis replication setup case

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* marking false

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix for review

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-10-23 17:00:50 +05:30
Shubham Gupta 42dfc93c75
feat: verify codgen in Makefile and Github workflow (#673)
* fixing workflow

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* verify

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix version in makefile

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-21 13:16:36 +05:30
Shubham Gupta 753438148b
add code-cov (#675)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-21 13:05:15 +05:30
guangwu a7c4452643
fix: typo (#674)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-10-21 11:56:13 +05:30
Shubham Gupta f7206cd021
Add missing deepcopy (#672)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-21 11:10:39 +05:30
yangw 91feb40d23
[Fix] : redis exporter mismatch environment (#670)
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-10-16 18:52:16 +05:30
Shubham Gupta 861b8f384e
update tags (#669)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-12 17:20:07 +08:00
dependabot[bot] 461cac47c5
Bump golang.org/x/net from 0.15.0 to 0.17.0 (#668)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-12 10:28:05 +05:30
yangw f5c68daf4d
[Feat] : support ignore specify annotation key in statefulset (#666)
* Support ignore specify annotation key in statefulset

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

* add e2e

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add test path

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* [DEBUG] ignore test dir

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove comment

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove assert file, which already assert in setup directory

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add test dirs

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* remove exporter

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add error assert

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add more assert

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* add more assert

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-10-10 12:10:29 +05:30
yangw aa02370c66
[Fix] : deploy can not set custom image:tag (#664)
* fix deploy image to latest tag

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

* fix image name consistent with kustomization.yaml

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

* alway use image locally

Co-authored-by: Shubham Gupta <69793468+shubham-cmyk@users.noreply.github.com>

* Update config/manager/kustomization.yaml

* check image

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix workflow

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: Shubham Gupta <69793468+shubham-cmyk@users.noreply.github.com>
Co-authored-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-07 21:02:32 +05:30
Shubham Gupta ea26e9d9dd
[Test] : e2e Github Action Workflow (#661)
* github action

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix naming

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* install kubectl

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* install kind utility

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* name kind

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* deploy operator

* fix test dir

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix current dir

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* run without deploye

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* make deploye

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* make  with version

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* upgrade kustomize

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix image

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* update pull policy

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* disable webhook for deployment

* disable webhook

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* print logs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* logs

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* check kind images

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* wait

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* log 2

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* remove

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: drivebyer <wuyangmuc@gmail.com>
2023-10-07 14:42:02 +05:30
yangw 9ffe55a363
[Fix] - sts will never be created (#663)
* Fix err would be set nil

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* nolint for shadow

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-10-07 14:26:56 +05:30
yangw aecb51c3cb
[Fix] - make deploy target not works well (#662)
* execute make manifests

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix indent

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* match operator's name && namespace

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* disable webhook related resources

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix no-group name for core api resources

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* disable manager auth by default

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix ClusterRoleBinding

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
2023-10-07 11:50:30 +05:30
Shubham Gupta 108c07aa39
add setup for redis standalone (#660)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-06 17:01:34 +05:30
Shubham Gupta 5b14d94771
Test (#659)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-06 14:36:41 +05:30
yangw 667ceae327
Fix e2e test (#658)
* fix kuttl timeout unit to second

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

* fix assert rediscluster version

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

* Update readme.md

---------

Signed-off-by: drivebyer <wuyangmuc@gmail.com>
Co-authored-by: Shubham Gupta <69793468+shubham-cmyk@users.noreply.github.com>
2023-10-06 11:03:21 +05:30
Azanul Haque ab69ce511a
Redis SDK version update (#657)
Signed-off-by: Azanul <azanulhaque@gmail.com>
2023-10-06 01:37:48 +05:30
Shubham Gupta 57883c067c
redis_test - unit test (#655)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-04 22:03:55 +05:30
Azanul Haque 6bbc0b13bb
Dependencies upgrade (#651)
* Dependencies upgrade

Signed-off-by: Azanul <azanulhaque@gmail.com>

* controller runtime options upgrade

Signed-off-by: Azanul <azanulhaque@gmail.com>

* CI go version upgrade

Signed-off-by: Azanul <azanulhaque@gmail.com>

* Dockerfile go version upgrade

Signed-off-by: Azanul <azanulhaque@gmail.com>

* fix lint bool pointer

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix pointer.BoolPtr

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* fix lint exec.Stream

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Azanul <azanulhaque@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Co-authored-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-10-04 11:58:51 +05:30
dependabot[bot] 97751a2b5b
Bump postcss from 8.2.9 to 8.4.31 in /docs (#654)
Bumps [postcss](https://github.com/postcss/postcss) from 8.2.9 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.2.9...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-04 11:33:39 +05:30
Aswath S 67acb29f54
Golang ci lint action (#653)
* Refactor. Change to golangci-lint action

Signed-off-by: titanventura <aswath7862001@gmail.com>

* Refactor. add './...' arg to golangci-lint command - gh-actions

Signed-off-by: titanventura <aswath7862001@gmail.com>

* Remove branch 'golang-ci-lint-action' from list of branches - gh-actions

Signed-off-by: titanventura <aswath7862001@gmail.com>

* Refactor. upgrade go and golangci-lint version - gh-actions

Signed-off-by: titanventura <aswath7862001@gmail.com>

* Refactor. remove 'golang-ci-lint-action' branch from list of branches and solve lint issues reported by golangci-lint v1.54.0

Signed-off-by: titanventura <aswath7862001@gmail.com>

* Refactor. run go fmt

Signed-off-by: titanventura <aswath7862001@gmail.com>

---------

Signed-off-by: titanventura <aswath7862001@gmail.com>
2023-10-04 09:43:12 +05:30
Aswath S b5d1184db8
Refactor. redis setup type in labels to contant (#652)
* Refactor. redis setup type in labels to contant

Signed-off-by: titanventura <aswath7862001@gmail.com>

* Refactor. make setuptype and constants private

Signed-off-by: titanventura <aswath7862001@gmail.com>

---------

Signed-off-by: titanventura <aswath7862001@gmail.com>
2023-10-03 20:16:52 +05:30
Shubham Gupta 673f117352
[Refactor] : Add Test Case (#650)
* unit-test

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

* comment

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>

---------

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-09-30 16:56:42 +05:30
Shubham Gupta eb25ef7d84
update env (#649)
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
2023-09-29 16:16:32 +05:30
485 changed files with 70451 additions and 32418 deletions

3
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,3 @@
# These are supported funding model platforms
github: shubham-cmyk drivebyer

View File

@ -1,5 +1,5 @@
<!--
Please read https://github.com/OT-CONTAINER-KIT/redis-operator/blob/master/CONTRIBUTING.md before submitting
Please read https://github.com/OT-CONTAINER-KIT/redis-operator/blob/main/CONTRIBUTING.md before submitting
your pull request. Please fill in each section below to help us better prioritize your pull request. Thanks!
-->
@ -27,7 +27,7 @@ Fixes #ISSUE
**Additional Context**
<!--
Is there anything else you'd like reviewers to know?
<!--
Is there anything else you'd like reviewers to know?
For example, any other related issues or testing carried out.
-->

2
.github/cherry-pick-bot.yml vendored Normal file
View File

@ -0,0 +1,2 @@
enabled: true
preservePullRequestTitle: true

10
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: monthly
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly

31
.github/workflows/auto-rebase.yaml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: >-
github.event.issue.pull_request != '' &&
(
contains(github.event.comment.body, '/rebase') ||
contains(github.event.comment.body, '/autosquash')
)
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout the latest code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.8
with:
autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

78
.github/workflows/auto-release.yaml vendored Normal file
View File

@ -0,0 +1,78 @@
name: Auto Create Release On Tag
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
- name: Get version
id: get_version
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Check if release exists
id: check_release
run: |
RELEASE_EXISTS=$(gh release view ${{ steps.get_version.outputs.VERSION }} --json id 2>/dev/null | jq -r '.id' || echo "")
if [ -n "$RELEASE_EXISTS" ] && [ "$RELEASE_EXISTS" != "null" ]; then
echo "Release already exists, skipping creation"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Release does not exist, will create it"
echo "exists=false" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release notes
id: release_notes
if: steps.check_release.outputs.exists == 'false'
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 ${{ steps.get_version.outputs.VERSION }}^ 2>/dev/null || git rev-list --max-parents=0 HEAD)
CHANGELOG=""
while IFS= read -r line; do
commit_hash=$(echo "$line" | cut -d' ' -f1)
commit_msg=$(echo "$line" | cut -d' ' -f2-)
author_login=$(gh api repos/${{ github.repository }}/commits/$commit_hash --jq '.author.login' 2>/dev/null || echo "unknown")
if [ "$author_login" != "null" ] && [ "$author_login" != "unknown" ]; then
CHANGELOG="$CHANGELOG* $commit_msg (@$author_login)"$'\n'
else
author_name=$(git show --pretty=format:"%an" -s $commit_hash)
CHANGELOG="$CHANGELOG* $commit_msg (@$author_name)"$'\n'
fi
done < <(git log --pretty=format:"%H %s" ${PREVIOUS_TAG}..${{ steps.get_version.outputs.VERSION }})
cat > release_notes.md << EOF
## Changes
${CHANGELOG}
EOF
- name: Create GitHub Release
if: steps.check_release.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.get_version.outputs.VERSION }}
body_path: release_notes.md
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

46
.github/workflows/call-test-charts.yaml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Test Helm Charts
on:
workflow_call:
inputs:
chart_dirs:
description: 'JSON array of chart directories to test'
required: false
type: string
default: '["redis-operator", "redis", "redis-cluster", "redis-replication", "redis-sentinel"]'
jobs:
test-charts:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.12.0
with:
cluster_name: kind
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.5.4
- name: Install yq
run: |
sudo snap install yq
- name: Install and test Redis Related Helm charts
run: |
kubectl cluster-info --context kind-kind
chart_dirs_json='${{ inputs.chart_dirs }}'
chart_dirs=($(echo $chart_dirs_json | jq -r '.[]'))
for dir in "${chart_dirs[@]}"
do
if [[ -f ./charts/$dir/Chart.yaml ]]; then
helm dependency update ./charts/$dir/
fi
helm install $dir ./charts/$dir/
helm test $dir
done
echo "Listing installed Helm charts..."

282
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,282 @@
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: read
env:
GOLANG_VERSION: 1.23.4
APPLICATION_NAME: redis-operator
DockerImagName: docker.io/opstree/redis-operator
BuildDocs: true
AppVersion: "v0.15.2"
DOCKERFILE_PATH: "**/Dockerfile"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
cache: false
- name: Get golangci-lint version from Makefile
run: |
GOLANGCI_VERSION=$(grep '^GOLANGCI_LINT_VERSION' Makefile | cut -d'=' -f2 | tr -d ' ?')
echo "GOLANGCI_LINT_VERSION=$GOLANGCI_VERSION" >> $GITHUB_ENV
- name: Run GolangCI-Lint
uses: golangci/golangci-lint-action@v8
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
gotest:
needs:
- lint
name: Go Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Install integration test dependencies
run: make integration-test-setup
- name: Run Go Tests with coverage
run: go test ./... -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
file: ./coverage.txt
fail_ci_if_error: false
verbose: true
helm_docs_test:
needs: [lint]
name: Helm Docs Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Ensure documentation is updated
uses: docker://jnorwood/helm-docs:latest
- name: Check for changes
run: |
if git diff --exit-code; then
echo -e "\n####### Helm docs are up-to-date! #######\n"
else
git status
echo -e "\n####### Helm docs are not up-to-date! Please run generate helm docs locally and push the changes #######\n"
exit 1
fi
validate_examples:
needs: [gotest, helm_docs_test]
name: Validate Examples
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install yamllint
run: sudo apt-get install -y yamllint
- name: Lint YAML files
run: yamllint --strict ./example
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.12.0
with:
cluster_name: kind
- name: Apply CRD
run: |
for crd in $(find ./config/crd/bases -type f -name '*.yaml'); do
kubectl create -f $crd
done
- name: Validate CRD Installation
run: |
CRDs=("redis" "redissentinels" "redisclusters" "redisreplications")
for crd in "${CRDs[@]}"; do
kubectl get crd $crd.redis.redis.opstreelabs.in || exit 1
done
- name: Validate CR
run: |
for example in $(find ./example -type f -name '*.yaml'); do
kubectl apply --dry-run=server -f $example
done
validate_yaml:
needs: [validate_examples]
name: Validate YAML
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install yamllint
run: sudo apt-get install -y yamllint
- name: Lint YAML files
run: yamllint --strict ./tests/
container_quality_dockerfile_lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Execute dockerlinter
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
ignore: DL3007,DL3018
build_go_binary:
needs: [lint]
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["amd64", "arm64"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Go Environment
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Set GOARCH
run: echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
- name: Build Go Binary
run: go build -o ${{ github.workspace }}/${{ env.APPLICATION_NAME }} cmd/main.go
- name: Archive Binary
run: |
mkdir -p ${{ github.workspace }}/compiled/${{ matrix.arch }}
zip ${{ github.workspace }}/compiled/${{ matrix.arch }}/${{ env.APPLICATION_NAME }}-${{ matrix.arch }}.zip ${{ github.workspace }}/${{ env.APPLICATION_NAME }}
build_scan_container_image:
needs: [container_quality_dockerfile_lint]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build multi-arch image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/arm64,linux/amd64
push: false
tags: ${{ env.DockerImagName }}:latest
gosec_scan:
needs: [build_go_binary]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Gosec Scan
uses: securego/gosec@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOSEC_OUTPUT: "junit-xml:/github/workspace/gosec-results.xml"
helm_chart_test:
needs: [gotest]
name: Helm Chart Test
uses: ./.github/workflows/call-test-charts.yaml
e2e_test:
# DEBUG
needs: [validate_yaml, helm_chart_test]
name: E2E Test
runs-on: ubuntu-latest
if: always() && (needs.validate_yaml.result == 'success') && (needs.helm_chart_test.result == 'success' || needs.helm_chart_test.result == 'skipped')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Dockerfile
run: docker build . --file Dockerfile --tag redis-operator:e2e
- name: Install Cosign
uses: sigstore/cosign-installer@v3.9.2
- name: Install chainsaw
uses: kyverno/action-install-chainsaw@v0.2.12
with:
verify: true
- name: Check install
run: chainsaw version
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.12.0
with:
config: tests/_config/kind-config.yaml
cluster_name: kind
# NOTE: This is a workaround for the issue where the default storage class does not support volume expansion.
# Since we don't require PVC resizing (unlike physical disks), we can simply ensure that the requested PVC size is met.
- name: Setup k8s Kind Cluster
run: |
DEFAULT_SC=$(kubectl get storageclass -o=jsonpath='{.items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")].metadata.name}')
kubectl patch storageclass $DEFAULT_SC -p '{"allowVolumeExpansion": true}'
# install cert-manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
- name: Load Docker image into Kind
run: |
kubectl cluster-info --context kind-kind
kind load docker-image redis-operator:e2e --name kind
- name: Install Redis Operator
run: |
make deploy IMG=redis-operator:e2e
kubectl set env deployment/redis-operator-redis-operator -n redis-operator-system OPERATOR_IMAGE=redis-operator:e2e FEATURE_GATES=GenerateConfigInInitContainer=true
- name: Wait for Redis Operator to be ready
run: |
kubectl wait --for=condition=available --timeout=300s deployment/redis-operator-redis-operator -n redis-operator-system
# - name: DEBUG:Install k9s
# run: |
# curl -sS https://webi.sh/k9s | sh; \
# source ~/.config/envman/PATH.env
# - name: DEBUG:Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# timeout-minutes: 15
# limit-access-to-actor: true
# detached: true
- name: Run chainsaw test
run: chainsaw test --test-dir ./tests/e2e-chainsaw/v1beta2 --config tests/_config/chainsaw-configuration.yaml

View File

@ -13,10 +13,10 @@ name: "CodeQL"
on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ main ]
schedule:
- cron: '24 4 * * 5'
@ -39,11 +39,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@ -68,4 +68,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3

View File

@ -1,128 +0,0 @@
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
env:
GolangVersion: 1.17
ApplicationName: redis-operator
DockerImagName: docker.io/opstree/redis-operator
BuildDocs: true
AppVersion: "v0.15.0"
DOCKERFILE_PATH: '**/Dockerfile'
jobs:
gofmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GolangVersion }}
- name: Check Go Fmt
run: |
gofmt_files=$(go fmt ./... | wc -l)
if [[ ${gofmt_files} > 0 ]]
then
echo "Please format golang files using:- go fmt ./..."
exit 1
else
echo "All files are formated using gofmt"
fi
govet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GolangVersion }}
- name: Run Go Vet
run: go vet ./...
code_quality_golang_ci_lint:
needs: [gofmt, govet]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GolangVersion }}
- name: Install GolangCI-Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.40.0
- name: Run GolangCI-Lint
run: ./bin/golangci-lint run --timeout 5m0s ./...
container_quality_dockerfile_lint:
needs: [gofmt, govet]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Execute dockerlinter
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
ignore: DL3007,DL3018
build_go_binary:
needs: [code_quality_golang_ci_lint]
runs-on: ubuntu-latest
strategy:
matrix:
arch: ['amd64', 'arm64']
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Go Environment
uses: actions/setup-go@v2
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Set GOARCH
run: echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
- name: Build Go Binary
run: go build -o ${{ github.workspace }}/${{ env.APPLICATION_NAME }}
- name: Archive Binary
run: |
mkdir -p ${{ github.workspace }}/compiled/${{ matrix.arch }}
zip ${{ github.workspace }}/compiled/${{ matrix.arch }}/${{ env.APPLICATION_NAME }}-${{ matrix.arch }}.zip ${{ github.workspace }}/${{ env.APPLICATION_NAME }}
build_scan_container_image:
needs: [container_quality_dockerfile_lint]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build multi-arch image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/arm64,linux/amd64
push: false
tags: ${{ env.DockerImagName }}:latest
gosec_scan:
needs: [build_go_binary]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Gosec Scan
uses: securego/gosec@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOSEC_OUTPUT: "junit-xml:/github/workspace/gosec-results.xml"

83
.github/workflows/pr-semantics.yaml vendored Normal file
View File

@ -0,0 +1,83 @@
# feat: (new feature for the user, not a new feature for build script)
# fix: (bug fix for the user, not a fix to a build script)
# build: (changes that affect the build system or external dependencies)
# chore: (updating grunt tasks etc; no production code change)
# ci: (updates to CI configuration files and scripts; no production code change)
# docs: (changes to the documentation)
# perf: (a code change that improves performance)
# refactor: (refactoring production code, eg. renaming a variable)
# style: (formatting, missing semi colons, etc; no production code change)
# test: (adding missing tests, refactoring tests; no production code change)
# revert: (reverting a previous commit)
# Example:
# test(runner): Add test for the runner
# ^ ^ ^
# | | |__ Subject
# | |_______ Scope
# |____________ Type
name: Semantic PR Validation
on:
pull_request:
types:
- opened
- edited
- synchronize
defaults:
run:
shell: bash
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Validate Pull Request
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed.
# Default: https://github.com/commitizen/conventional-commit-types
types: |
feat
fix
build
chore
ci
docs
perf
refactor
revert
style
test
revert
# Configure which scopes are allowed.
scopes: |
api
deps
config
client
config
data
test
utils
docs
release
testdata
standalone
replication
sentinel
cluster
ignoreLabels: |
bot
ignore-semantic-pull-request
# Configure that a scope must always be provided.
requireScope: false
# When using "Squash and merge" on a PR with only one commit, GitHub
# will suggest using that commit message instead of the PR title for the
# merge commit, and it's easy to commit this by mistake. Enable this option
# to also validate the commit message for one commit PRs.
validateSingleCommit: true
# Related to `validateSingleCommit` you can opt-in to validate that the PR
# title matches a single commit to avoid confusion.
validateSingleCommitMatchesPrTitle: true

158
.github/workflows/publish-charts.yaml vendored Normal file
View File

@ -0,0 +1,158 @@
name: Release Charts
on:
push:
paths:
- 'charts/**'
- '.github/workflows/publish-charts.yaml'
branches:
- main
jobs:
lint-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.5.4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
check-latest: true
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.7.0
- name: Run chart-testing (lint)
run: |
ct lint --config ct.yaml
test-charts:
needs:
- lint-charts
uses: ./.github/workflows/call-test-charts.yaml
release-charts:
runs-on: ubuntu-latest
needs:
- test-charts
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: "${{ github.repository_owner }}/redis-operator"
path: "redis-operator"
fetch-depth: 0
- name: Checkout helm-charts
uses: actions/checkout@v4
with:
repository: "${{ github.repository_owner }}/helm-charts"
# use token for helm-charts repo
token: "${{ secrets.HELM_CHARTER_TOKEN }}"
path: "helm-charts"
fetch-depth: 0
- name: Get chart version
run: |
echo "chart_version=$(echo ${GITHUB_REF##*/v})" >> $GITHUB_ENV
- name: Install Helm
uses: azure/setup-helm@v4
- name: Make charts
shell: bash
working-directory: redis-operator
run: |
helm repo add jetstack https://charts.jetstack.io
helm repo update
chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel")
for dir in "${chart_dirs[@]}"
do
if [[ -f ./charts/$dir/Chart.yaml ]]; then
helm dependency update ./charts/$dir/
fi
helm package charts/$dir -d .cr-release-packages
done
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to OCI registry (ghcr.io)
shell: bash
working-directory: redis-operator
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi
helm push "${pkg}" "oci://ghcr.io/ot-container-kit/charts"
done
- name: Install chart-releaser
uses: helm/chart-releaser-action@v1.7.0
with:
install_only: true
# upload charts to helm-charts repos's release
- name: Upload charts
shell: bash
working-directory: redis-operator
run: |
cr upload
env:
# GitHub repository
CR_GIT_REPO: "helm-charts"
# Path to directory with chart packages (default ".cr-release-packages")
CR_PACKAGE_PATH: ".cr-release-packages"
# use token for helm-charts repo
CR_TOKEN: "${{ secrets.HELM_CHARTER_TOKEN }}"
# owner
CR_OWNER: "${{ github.repository_owner }}"
# skip existing charts
CR_SKIP_EXISTING: "true"
# copy artifacts to helm-charts repo, we need those for update index
- name: Copy artifacts
run: |
cp -r redis-operator/.cr-release-packages helm-charts/
- name: Configure Git
working-directory: helm-charts
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
# this step will directly push to the main branch, so make sure you have the right permissions
- name: Update index
working-directory: helm-charts
run: |
cr index --push
env:
# GitHub repository
CR_GIT_REPO: "helm-charts"
# The GitHub pages branch (default "gh-pages")
CR_PAGES_BRANCH: "gh-pages"
# Path to directory with chart packages (default ".cr-release-packages")
CR_PACKAGE_PATH: ".cr-release-packages"
# use token for helm-charts repo
CR_TOKEN: "${{ secrets.HELM_CHARTER_TOKEN }}"
# owner
CR_OWNER: "${{ github.repository_owner }}"
# index path
CR_INDEX_PATH: "index.yaml"

111
.github/workflows/publish-image.yaml vendored Normal file
View File

@ -0,0 +1,111 @@
name: Publish Image
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
REPOSITORY: ot-container-kit/redis-operator
QuayImageName: quay.io/opstree/redis-operator
jobs:
release-ghcr-image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Env
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REPOSITORY }}/redis-operator:${{ env.TAG }}
${{ env.REGISTRY }}/${{ env.REPOSITORY }}/redis-operator:latest
platforms: linux/amd64,linux/arm64
release-quay-image:
runs-on: ubuntu-latest
environment: release-image
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Setup Env
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.QuayImageName }}:${{ env.TAG }}
${{ env.QuayImageName }}:latest
# trivy_scan:
# needs: [release_image]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Run Trivy vulnerability scanner for arm64 image
# uses: aquasecurity/trivy-action@master
# - name: Run Trivy vulnerability scanner for multi-arch image
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: ${{ env.QuayImageName }}:${{ env.APP_VERSION }}
# format: 'template'
# template: '@/contrib/sarif.tpl'
# output: 'trivy-results-latest.sarif'
# exit-code: '1'
# ignore-unfixed: true
# severity: 'CRITICAL,HIGH'
# - name: Run Trivy vulnerability scanner for latest image
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: ${{ env.QuayImageName }}:latest
# format: 'template'
# template: '@/contrib/sarif.tpl'
# output: 'trivy-results-latest.sarif'
# exit-code: '1'
# ignore-unfixed: true
# severity: 'CRITICAL,HIGH'

View File

@ -1,75 +0,0 @@
name: Release container images
on:
pull_request:
types: [closed]
branches:
- master
env:
ApplicationName: redis-operator
QuayImageName: quay.io/opstree/redis-operator
AppVersion: "v0.15.1"
DOCKERFILE_PATH: '**/Dockerfile'
jobs:
setup:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.ACCESS_TOKEN }}
build_multi_arch:
needs: setup
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Build and push multi-arch latest image
uses: docker/build-push-action@v2
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.QuayImageName }}:{{ env.AppVersion }}, ${{ env.QuayImageName }}:latest
trivy_scan:
needs: [build_multi_arch]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Trivy vulnerability scanner for arm64 image
uses: aquasecurity/trivy-action@master
- name: Run Trivy vulnerability scanner for multi-arch image
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.QuayImageName }}:${{ env.AppVersion }}
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results-latest.sarif'
exit-code: '1'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
- name: Run Trivy vulnerability scanner for latest image
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.QuayImageName }}:latest
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results-latest.sarif'
exit-code: '1'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'

56
.github/workflows/stale.yaml vendored Normal file
View File

@ -0,0 +1,56 @@
# Configuration for stale action workflow - https://github.com/actions/stale
name: Manage stale issues and PRs
on:
schedule:
# Run hourly
- cron: '30 1 * * *'
workflow_dispatch:
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
ascending: true
# --- Issues & PRs ---
# Number of days of inactivity before an issue or PR becomes stale
days-before-stale: 365
# Number of days of inactivity before a stale issue or PR is closed
days-before-close: 30
# API calls per run
operations-per-run: 1000
# --- Issues ---
stale-issue-label: "stale"
# Comment to post when marking an issue as stale
stale-issue-message: >
This issue has been automatically marked as stale.
**If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
# Comment to post when closing a stale issue
close-issue-message: >
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
# Issues with these labels will never be considered stale
exempt-issue-labels: "enhancement,good first issue,help wanted"
# --- PRs ---
stale-pr-label: "stale"
# Comment to post when marking a pull request as stale
stale-pr-message: >
This pull request has been automatically marked as stale.
**If this pull request is still relevant, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.
# Comment to post when closing a stale pull request
close-pr-message: >
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!
# PRs with these labels will never be considered stale
exempt-pr-labels: ""

37
.github/workflows/verify-codegen.yaml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Verify Codegen
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
verify-codegen:
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Run codegen and verify no diffs
run: |
make verify-codegen

8
.gitignore vendored
View File

@ -13,6 +13,7 @@ testbin/*
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html
# Kubernetes Generated files - skip generated files, except for vendored files
@ -24,5 +25,10 @@ testbin/*
*.swo
*~
.vscode
.go-version
docs/build
.DS_Store
docs/build
kubeconfig
CLAUDE.md

View File

@ -1,45 +1,54 @@
linters-settings:
govet:
check-shadowing: true
golint:
min-confidence: 0.8
gofmt:
simplify: true
# linters:
# enable-all: true
# disable:
# - errcheck
# - tagliatelle
# Exclude the files that are causing the errors
issues:
exclude-rules:
- path: _test\.go # Ignore test files for linting
linters:
- gocyclo
- errcheck
- dupl
- gosec
version: "2"
run:
timeout: 5m
go-version: "1.17"
test: false
# Exclude third-party packages and go.mod from the lint checks
exclude: |
'(^vendor/.*|.*_test\.go|go\.mod|.*validatingwebhookconfiguration\.go|.*mutatingwebhookconfiguration\.go)'
skip-files:
- '^.*validatingwebhookconfiguration\.go$'
- controllers/suite_test.go
skip-dirs:
- k8s.io/client-go
- github.com/banzaicloud/k8s-objectmatcher
- github.com/go-logr/logr
- github.com/go-redis/redis
- github.com/onsi/ginkgo
- github.com/onsi/gomega
- github.com/pkg/errors
- k8s.io/api
- k8s.io/apimachinery
- sigs.k8s.io/controller-runtime
- golang.org/x/sys
- vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
go: 1.23.4
tests: true
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- decorder
- dogsled
- durationcheck
- errname
- gochecknoinits
- goprintffuncname
- grouper
- importas
- makezero
- misspell
- noctx
- nolintlint
- nosprintfhostport
- thelper
- tparallel
- unconvert
- wastedassign
- whitespace
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
settings:
gofmt:
simplify: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@ -5,7 +5,7 @@ install:
- cd docs; yarn install # npm ci
branches:
only:
- master
- main
script:
- cd docs; yarn build # npm run docs:build
deploy:
@ -15,4 +15,4 @@ deploy:
github_token: $GITHUB_TOKEN # A token generated on GitHub allowing Travis to push code on your repository. Set in the Travis settings page of your repository, as a secure variable
keep_history: true
on:
branch: master
branch: main

12
.yamllint.yml Normal file
View File

@ -0,0 +1,12 @@
extends: default
rules:
line-length:
max: 300
level: warning
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
comments-indentation: disable
ignore:
- resources.yaml

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

1
CODEOWNERS Normal file
View File

@ -0,0 +1 @@
* @shubham-cmyk @drivebyer @iamabhishek-dubey

View File

@ -12,7 +12,7 @@
## Local Kubernetes Cluster
For development and testing of operator on local system, we need to set up a [Minikube](https://minikube.sigs.k8s.io/docs/start/) or local Kubernetes cluster.
For development and testing of operator on local system, we need to set up a [Minikube](https://minikube.sigs.k8s.io/docs/start/) or local Kubernetes cluster.
Minikube is a single node Kubernetes cluster that generally gets used for the development and testing on Kubernetes. For creating a Minkube cluster we need to simply run:
@ -28,7 +28,7 @@ $ minikube start --vm-driver virtualbox
⌛ Waiting for image downloads to complete ...
✨ Preparing Kubernetes environment ...
🚜 Pulling images required by Kubernetes v1.14.1 ...
🚀 Launching Kubernetes v1.14.1 using kubeadm ...
🚀 Launching Kubernetes v1.14.1 using kubeadm ...
⌛ Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑 Configuring cluster permissions ...
🤔 Verifying component health .....
@ -103,7 +103,7 @@ The structure for Redis operator includes different module's directory. The code
```shell
redis-operator/
|-- api
| |-- v1beta1
| |-- v1beta2
|-- bin
|-- config
| |-- certmanager
@ -146,7 +146,8 @@ The operator deployment can be done via `helm` cli, we just need to define the c
```shell
$ helm upgrade redis-operator ot-helm/redis-operator \
--install --namespace ot-operators --set redisOperator.imageName=<custom-url> \
--install --create-namespace --namespace ot-operators \
--set redisOperator.imageName=<custom-url> \
--set redisOperator.imageTag=<customTag>
```
@ -155,8 +156,8 @@ $ helm upgrade redis-operator ot-helm/redis-operator \
$ helm upgrade redis ot-helm/redis --namespace ot-operators
# For deploying cluster redis
$ helm upgrade redis-cluster ot-helm/redis-cluster \n
--set redisCluster.clusterSize=3 --install --namespace ot-operators \
$ helm upgrade redis-cluster ot-helm/redis-cluster \n
--set redisCluster.clusterSize=3 --install --namespace ot-operators \
--set pdb.enabled=false --set redisCluster.tag=v7.0.5-beta
```
@ -164,7 +165,7 @@ $ helm upgrade redis-cluster ot-helm/redis-cluster \n
Development of redis docker image is maintained inside a different repository - https://github.com/OT-CONTAINER-KIT/redis. To make any change or suggestion related to Redis docker image, please refer to this repository and make required changes.
In the repository, we have `Dockerfile` for [Redis](https://github.com/OT-CONTAINER-KIT/redis/blob/master/Dockerfile) and [Redis Exporter](https://github.com/OT-CONTAINER-KIT/redis/blob/master/Dockerfile.exporter)
In the repository, we have `Dockerfile` for [Redis](https://github.com/OT-CONTAINER-KIT/redis/blob/main/Dockerfile) and [Redis Exporter](https://github.com/OT-CONTAINER-KIT/redis/blob/main/Dockerfile.exporter)
For building the docker image for redis and redis exporter, there are simple make commands:

View File

@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.17 as builder
# Build the manager or agent binary
FROM golang:1.23-alpine3.21 AS builder
ARG BUILDOS
ARG BUILDPLATFORM
ARG BUILDARCH
@ -8,6 +8,7 @@ ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG IMG
WORKDIR /workspace
# Copy the Go Modules manifests
@ -18,25 +19,27 @@ COPY go.sum go.sum
RUN go mod download
# Copy the go source
COPY main.go main.go
COPY cmd/ cmd/
COPY api/ api/
COPY controllers/ controllers/
COPY k8sutils/ k8sutils/
COPY internal/ internal/
COPY mocks/ mocks/
# Build
ARG LDFLAGS="-s -w"
ARG LDFLAGS="-s -w -X github.com/OT-CONTAINER-KIT/redis-operator/internal/image.operatorImage=${IMG}"
ENV GOOS=$TARGETOS
ENV GOARCH=$TARGETARCH
ENV CGO_ENABLED=0
RUN GO111MODULE=on go build -ldflags "${LDFLAGS}" -a -o manager main.go
# Build the unified binary
RUN GO111MODULE=on go build -ldflags "${LDFLAGS}" -a -o operator cmd/main.go
# Use distroless as minimal base image to package the manager binary
# Use distroless as minimal base image to package the binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
LABEL maintainer="The Opstree Opensource <opensource@opstree.com>"
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/operator /operator
USER 65532:65532
ENTRYPOINT ["/manager"]
ENTRYPOINT ["/operator", "manager"]

View File

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [2020] [Opstree Solutions]
Copyright [2024] [Opstree Solutions]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

269
Makefile
View File

@ -1,7 +1,57 @@
# ===========================
# Variables
# ===========================
# Current Operator version
VERSION ?= 0.15.0
VERSION ?= 0.21.0
# Default bundle image tag
BUNDLE_IMG ?= controller-bundle:$(VERSION)
# Kubernetes version to use for envtest
ENVTEST_K8S_VERSION = 1.31.0
# Image URL to use for all building/pushing image targets
IMG ?= quay.io/opstree/redis-operator:v$(VERSION)
# Container engine to use (docker or podman)
CONTAINER_ENGINE ?= docker
# Platforms for multi-arch builds
PLATFORMS = "linux/arm64,linux/amd64"
# LDFLAGS for setting the operator image during build
LDFLAGS ?= "-s -w -X github.com/OT-CONTAINER-KIT/redis-operator/internal/image.operatorImage=$(IMG)"
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN = $(shell go env GOPATH)/bin
else
GOBIN = $(shell go env GOBIN)
endif
# Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
# Tool Binaries
KUBECTL ?= kubectl
KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
KUTTL = $(LOCALBIN)/kuttl-$(KUTTL_VERSION)
KIND = $(LOCALBIN)/kind-$(KIND_VERSION)
CRD_REF_DOCS = $(LOCALBIN)/crd-ref-docs-$(CRD_REF_DOCS_VERSION)
# Tool Versions
KUSTOMIZE_VERSION ?= v5.6.0
CONTROLLER_TOOLS_VERSION ?= v0.17.2
ENVTEST_VERSION ?= release-0.17
GOLANGCI_LINT_VERSION ?= v2.2.2
KUTTL_VERSION ?= 0.15.0
KIND_VERSION ?= v0.24.0
CRD_REF_DOCS_VERSION ?= v0.0.12
# Options for 'bundle-build'
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
@ -11,102 +61,105 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
# Image URL to use all building/pushing image targets
IMG ?= quay.io/opstree/redis-operator:v$(VERSION)
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
# ===========================
# Targets
# ===========================
# Default target
all: manager
# Run tests
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
.PHONY: test
test: generate fmt vet manifests
mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
# Build manager binary
.PHONY: manager
manager: generate fmt vet
go build -o bin/manager main.go
go build -ldflags $(LDFLAGS) -o bin/manager cmd/main.go
# Build agent binary
.PHONY: agent
agent: generate fmt vet
go build -o bin/agent cmd/agent/main.go
# Run against the configured Kubernetes cluster in ~/.kube/config
.PHONY: run
run: generate fmt vet manifests
go run ./main.go
go run cmd/main.go
# Install CRDs into a cluster
.PHONY: install
install: manifests kustomize
$(KUSTOMIZE) build config/crd | kubectl apply --server-side=true -f -
# Uninstall CRDs from a cluster
.PHONY: uninstall
uninstall: manifests kustomize
$(KUSTOMIZE) build config/crd | kubectl delete -f -
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
.PHONY: deploy
deploy: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -
$(KUSTOMIZE) build config/default | kubectl apply --server-side=true -f -
# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config
.PHONY: undeploy
undeploy:
$(KUSTOMIZE) build config/default | kubectl delete -f -
# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) crd rbac:roleName=manager-role webhook paths="./api/..." output:crd:artifacts:config=config/crd/bases
# Sync CRDs to chart directory
.PHONY: sync-crds
sync-crds: manifests kustomize
@echo "Syncing CRDs to chart directory..."
$(KUSTOMIZE) build config/crd > charts/redis-operator/crds/crds.yaml
@echo "CRDs synced successfully to charts/redis-operator/crds/crds.yaml"
# Run go fmt against code
.PHONY: fmt
fmt:
go fmt ./...
# Run go vet against code
.PHONY: vet
vet:
go vet ./...
# Generate code
.PHONY: generate
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
# Generate API documentation
.PHONY: generate-api-docs
generate-api-docs:
@hack/api-docs/build.sh
# Create a new builder instance for Docker Buildx with the specified platforms and set it as the current builder
.PHONY: docker-create
docker-create:
docker buildx create --platform "linux/amd64,linux/arm64" --use
${CONTAINER_ENGINE} buildx create --platform $(PLATFORMS) --use
# Build the docker image
# Build the manager Docker image
.PHONY: docker-build
docker-build:
docker buildx build --platform="linux/arm64,linux/amd64" -t ${IMG} .
${CONTAINER_ENGINE} buildx build --platform=$(PLATFORMS) --build-arg IMG=${IMG} -t ${IMG} -f Dockerfile .
# Push the docker image
# Push the manager Docker image
.PHONY: docker-push
docker-push:
docker buildx build --push --platform="linux/arm64,linux/amd64" -t ${IMG} .
${CONTAINER_ENGINE} buildx build --push --platform="$(PLATFORMS)" --build-arg IMG=${IMG} -t ${IMG} -f Dockerfile .
# Download controller-gen locally if necessary
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen:
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1)
# Download kustomize locally if necessary
KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize:
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7)
# go-install-tool will 'go install' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-install-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
# Load the manager image into docker
.PHONY: docker-load
docker-load:
${CONTAINER_ENGINE} buildx build --load --build-arg IMG=${IMG} -t ${IMG} -f Dockerfile .
# Generate bundle manifests and metadata, then validate generated files.
.PHONY: bundle
@ -119,4 +172,122 @@ bundle: manifests kustomize
# Build the bundle image.
.PHONY: bundle-build
bundle-build:
docker buildx build --platform="linux/arm64,linux/amd64" -f bundle.Dockerfile -t $(BUNDLE_IMG) .
${CONTAINER_ENGINE} buildx build --platform="$(PLATFORMS)" -f bundle.Dockerfile -t $(BUNDLE_IMG) .
# Rebuild all generated code
.PHONY: codegen
codegen: generate manifests sync-crds generate-dataAssert generate-metricsdocs generate-api-docs
# Verify that codegen is up to date.
.PHONY: verify-codegen
verify-codegen: codegen
@echo Checking codegen is up to date... >&2
@if [ -n "$$(git status --porcelain)" ]; then \
echo "There are uncommitted changes or untracked files after running codegen:" >&2; \
git status --porcelain >&2; \
echo "To correct this, locally run 'make codegen', commit the changes, and re-run tests." >&2; \
exit 1; \
fi
# ===========================
# Testing
# ===========================
.PHONY: tests
tests: integration-test-setup unit-tests integration-tests
.PHONY: unit-tests
unit-tests:
@echo Running tests... >&2
@go test ./... -race -coverprofile=coverage.out -covermode=atomic
@go tool cover -html=coverage.out
.PHONY: e2e-test
e2e-test: e2e-kind-setup kuttl
$(LOCALBIN)/kuttl test --config tests/_config/kuttl-test.yaml
.PHONY: integration-test-setup
integration-test-setup:
./hack/integrationSetup.sh
.PHONY: integration-tests
integration-tests:
ginkgo -r -race --repeat=5
.PHONY: e2e-kind-setup
e2e-kind-setup:
${CONTAINER_ENGINE} build -t redis-operator:e2e -f Dockerfile .
$(KIND) create cluster --config tests/_config/kind-config.yaml
$(KIND) load docker-image redis-operator:e2e --name kind
make deploy IMG=redis-operator:e2e
# ===========================
# Dependencies
# ===========================
$(LOCALBIN):
mkdir -p $(LOCALBIN)
# Download kustomize locally if necessary.
.PHONY: kustomize
kustomize: $(KUSTOMIZE)
$(KUSTOMIZE): $(LOCALBIN)
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
# Download controller-gen locally if necessary.
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN)
$(CONTROLLER_GEN): $(LOCALBIN)
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
# Download setup-envtest locally if necessary.
.PHONY: envtest
envtest: $(ENVTEST)
$(ENVTEST): $(LOCALBIN)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))
# Download golangci-lint locally if necessary.
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
# Download kind locally if necessary.
.PHONY: kind
kind: $(KIND)
$(KIND): $(LOCALBIN)
$(call go-install-tool,$(KIND),sigs.k8s.io/kind,${KIND_VERSION})
# Download kuttl locally if necessary.
.PHONY: kuttl
kuttl: $(KUTTL)
$(KUTTL): $(LOCALBIN)
curl -L https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION)/kubectl-kuttl_$(KUTTL_VERSION)_linux_x86_64 -o $(LOCALBIN)/kuttl
chmod +x $(LOCALBIN)/kuttl
.PHONY: generate-metricsdocs
generate-metricsdocs:
@mkdir -p $(shell pwd)/docs/content/en/docs/Monitoring
@go run ./internal/monitoring/metricsdocs > docs/content/en/docs/Monitoring/metrics.md
.PHONY: generate-dataAssert
generate-dataAssert:
@cd tests/data-assert && go run main.go gen-resource-yaml
# ===========================
# Helper Functions
# ===========================
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary (ideally with version)
# $2 - package url which can be installed
# $3 - specific version of package
define go-install-tool
@[ -f $(1) ] || { \
set -e; \
package=$(2)@$(3) ;\
echo "Downloading $${package}" ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
}
endef

59
PROJECT
View File

@ -4,12 +4,12 @@
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: redis.opstreelabs.in
layout:
- go.kubebuilder.io/v3
- go.kubebuilder.io/v4
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: redis-operator
repo: redis-operator
repo: github.com/OT-CONTAINER-KIT/redis-operator
resources:
- api:
crdVersion: v1
@ -17,11 +17,8 @@ resources:
domain: redis.opstreelabs.in
group: redis
kind: Redis
path: redis-operator/api/v1beta2
path: redis-operator/api/redis/v1beta2
version: v1beta2
webhooks:
conversion: true
webhookVersion: v1
- api:
crdVersion: v1
namespaced: true
@ -29,63 +26,29 @@ resources:
domain: redis.opstreelabs.in
group: redis
kind: RedisCluster
path: redis-operator/api/v1beta2
path: redis-operator/api/rediscluster/v1beta2
version: v1beta2
webhooks:
conversion: true
webhookVersion: v1
- api:
crdVersion: v1
controller: true
domain: redis.opstreelabs.in
group: redis
kind: RedisReplication
path: redis-operator/api/v1beta2
path: redis-operator/api/redisreplication/v1beta2
version: v1beta2
webhooks:
conversion: true
webhookVersion: v1
- api:
crdVersion: v1
controller: true
domain: redis.opstreelabs.in
group: redis
kind: RedisSentinel
path: redis-operator/api/v1beta2
path: redis-operator/api/redissentinel/v1beta2
version: v1beta2
- group: core
kind: Pod
path: k8s.io/api/core/v1
version: v1
webhooks:
conversion: true
defaulting: true
webhookVersion: v1
- api:
crdVersion: v1
namespaced: true
domain: redis.opstreelabs.in
group: redis
kind: Redis
path: redis-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: redis.opstreelabs.in
group: redis
kind: RedisCluster
path: redis-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: redis.opstreelabs.in
group: redis
kind: RedisReplication
path: redis-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: redis.opstreelabs.in
group: redis
kind: RedisSentinel
path: redis-operator/api/v1beta1
version: v1beta1
version: "3"

View File

@ -3,8 +3,8 @@
</p>
<p align="center">
<a href="https://dev.azure.com/opstreedevops/DevOps/_apis/build/status/redis-operator/redis-operator?repoName=OT-CONTAINER-KIT%2Fredis-operator&branchName=master">
<img src="https://dev.azure.com/opstreedevops/DevOps/_apis/build/status/redis-operator/redis-operator?repoName=OT-CONTAINER-KIT%2Fredis-operator&branchName=master" alt="Azure Pipelines">
<a href="https://github.com/OT-CONTAINER-KIT/redis-operator/actions/workflows/ci.yaml">
<img src="https://github.com/OT-CONTAINER-KIT/redis-operator/actions/workflows/ci.yaml/badge.svg" alt="CI Pipeline">
</a>
<a href="https://goreportcard.com/report/github.com/OT-CONTAINER-KIT/redis-operator">
<img src="https://goreportcard.com/badge/github.com/OT-CONTAINER-KIT/redis-operator" alt="GoReportCard">
@ -18,18 +18,18 @@
<a href="https://quay.io/repository/opstree/redis-operator">
<img src="https://img.shields.io/badge/container-ready-green" alt="Docker">
</a>
<a href="https://github.com/OT-CONTAINER-KIT/redis-operator/master/LICENSE">
<a href="https://github.com/OT-CONTAINER-KIT/redis-operator/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
</a>
</p>
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 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 feel free to add by creating a [pull request](https://github.com/OT-CONTAINER-KIT/redis-operator/pulls)
This operator only supports versions of redis `=>6`.
This operator only supports versions of Redis `>=6`.
## Architecture
@ -39,95 +39,94 @@ This operator only supports versions of redis `=>6`.
## Purpose
There are multiple problems that people face while setting up redis setup on Kubernetes, specially cluster type setup. The purpose of creating this opperator is to provide an easy and production ready interface for redis setup that include best-practices, security controls, monitoring, and management.
There are multiple problems that people face while setting up Redis setup on Kubernetes, especially cluster type setup. The purpose of creating this operator is to provide an easy and production-ready interface for Redis setup that includes best-practices, security controls, monitoring, and management.
## Supported Features
Here the features which are supported by this operator:-
Here are the features which are supported by this operator:
- Redis cluster and standalone mode setup
- Redis cluster failover and recovery
- Inbuilt monitoring with redis exporter
- Password and password-less setup of redis
- Password and password-less setup of Redis
- TLS support for additional security layer
- Ipv4 and Ipv6 support for redis setup
- Detailed monitoring grafana dashboard
## Getting Started
If you want to deploy redis-operator from scratch to a local Minikube cluster, begin with the [Getting started](https://ot-container-kit.github.io/redis-operator/#/quickstart/quickstart) document. It will guide your through the setup step-by-step.
The configuration of Redis setup should be described in [CRD definitions](config/crd/bases). All the examples related to redis standalone and cluster setup can be found inside [example](./example) folder.
- IPv4 and IPv6 support for Redis setup
- Detailed monitoring Grafana dashboard
## 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.
## Image Compatibility
The following table shows the compatibility between the Operator Version, Redis Image, Sentinel Image, and Exporter Image:
| Operator Version | Redis Image | Sentinel Image | Exporter Image |
|------------------|-------------|----------------|----------------|
| v0.15.0 | v7.0.12 | v7.0.12 | v1.48.0 |
| v0.15.0 | v7.0.11 | v7.0.11 | v1.48.0 |
| v0.14.0 | v7.0.7 | v7.0.7 | v1.48.0 |
| v0.13.0 | v6.2.5 | nil | v1.48.0 |
| ---------------- | ----------- | -------------- | -------------- |
| v0.19.x | > v7.0.12, >=v6.2.14 | > v7.0.12, >= v6.2.14 | v1.44.0 |
| v0.18.x | v7.0.12 | v7.0.12 | v1.44.0 |
| v0.17.0 | v7.0.12 | v7.0.12 | v1.44.0 |
| v0.16.0 | v7.0.12 | v7.0.12 | v1.44.0 |
| v0.15.1 | v7.0.12 | v7.0.12 | v1.44.0 |
| v0.15.0 | v7.0.11 | v7.0.11 | v1.44.0 |
| v0.14.0 | v7.0.7 | v7.0.7 | v1.44.0 |
| v0.13.0 | v6.2.5 | nil | v1.44.0 |
## Quickstart
The setup can be done by using helm. If you want to see more example, please go through the [example](./example) folder.
The setup can be done by using Helm. If you want to see more examples, please go through the [example](./example) folder.
But you can simply use the helm chart for installation.
But you can simply use the Helm chart for installation.
```shell
# Add the helm chart
# Add the Helm chart
$ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
```
```shell
# Deploy the redis-operator
$ helm upgrade redis-operator ot-helm/redis-operator --install --namespace ot-operators
# Deploy the Redis operator
$ helm upgrade redis-operator ot-helm/redis-operator \
--install --create-namespace --namespace ot-operators
```
After deployment, verify the installation of operator
After deployment, verify the installation of the operator
```shell
helm test redis-operator --namespace ot-operators
```
Creating redis cluster, standalone, replication and sentinel setup.
Creating Redis cluster, standalone, replication and sentinel setup.
```shell
# Create redis cluster setup
# Create Redis cluster setup
$ helm upgrade redis-cluster ot-helm/redis-cluster \
--set redisCluster.clusterSize=3 --install \
--set redisCluster.clusterSize=3 --install \
--namespace ot-operators
```
```shell
# Create redis standalone setup
# Create Redis standalone setup
$ helm upgrade redis ot-helm/redis \
--install --namespace ot-operators
```
```shell
# Create redis replication setup
# Create Redis replication setup
$ helm upgrade redis-replication ot-helm/replication \
--install --namespace ot-operators
```
```shell
# Create redis sentinel setup
# Create Redis sentinel setup
$ helm upgrade redis-sentinel ot-helm/sentinel \
--install --namespace ot-operators
```
If you want to customize the value file by yourself while initializing the helm command, the values files for reference are present [here](https://github.com/OT-CONTAINER-KIT/helm-charts/tree/main/charts/redis-setup).
If you want to customize the values file by yourself while initializing the Helm command, the values files for reference are present [here](https://github.com/OT-CONTAINER-KIT/helm-charts/tree/main/charts/redis-setup).
## Monitoring with Prometheus
To monitor redis performance we will be using prometheus. In any case, extra prometheus configuration will not be required because we will be using the Prometheus service discover pattern. For that we already have set these annotations:-
To monitor Redis performance we will be using Prometheus. In any case, extra Prometheus configuration will not be required because we will be using the Prometheus service discovery pattern. For that we already have set these annotations:
```yaml
annotations:
@ -148,4 +147,4 @@ Please see our [CHANGELOG.md](./CHANGELOG.md) for details.
This project is managed by [OpsTree Solutions](http://opstree.com). For any queries or suggestions, you can reach out to us at [opensource@opstree.com](mailto:opensource@opstree.com).
Join our Slack Channel: [#redis-operator](https://opstree.slack.com/archives/C05MBRB50JG).
Join our Slack Channel: [#redis-operator](https://join.slack.com/t/opstree/shared_invite/zt-3o8jp35x-UGMU2Cy0WSBk3Lbzqa2wVw).

19
ROADMAP.md Normal file
View File

@ -0,0 +1,19 @@
# Phase 1: Feature Expansion and Advanced Configuration (0-6 months)
- Advance Backup and Restore
- Automated Backup Policies: Users can define more complex backup strategies (e.g., time-based, event-triggered, incremental backups).
- Backup on Redis Persistence Options: Integrate support for Redis persistence modes like RDB snapshots and AOF (Append-Only File).
- Redis Stream and Pub/Sub Support
- Add support for Redis Streams and Pub/Sub messaging patterns, allowing users to manage Redis Stream-based applications directly through the operator.
- Valkey Support
- Adding support for Valkey standalone.
- Adding support for Valkey replication.
- Adding support for Valkey cluster mode.
- Adding TLS-based authentication.
- Adding password-based authentication support.
- Encryption support.
- Persistence support.
- Monitoring feature.
- Different Kubernetes native support like PDB, sidecar, tolerations, upgrade strategy.

View File

@ -0,0 +1,276 @@
package v1beta2
import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
)
// KubernetesConfig will be the JSON struct for Basic Redis Config
// +k8s:deepcopy-gen=true
type KubernetesConfig struct {
Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
ExistingPasswordSecret *ExistingPasswordSecret `json:"redisSecret,omitempty"`
ImagePullSecrets *[]corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
UpdateStrategy appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`
PersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
Service *ServiceConfig `json:"service,omitempty"`
IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
}
func (in *KubernetesConfig) GetServiceType() string {
if in.Service == nil {
return "ClusterIP"
}
return in.Service.ServiceType
}
func (in *KubernetesConfig) GetServiceAnnotations() map[string]string {
if in.Service == nil {
return nil
}
return in.Service.ServiceAnnotations
}
func (in *KubernetesConfig) GetHeadlessServiceAnnotations() map[string]string {
if in.Service == nil {
return nil
}
if in.Service.Headless == nil {
return nil
}
return in.Service.Headless.AdditionalAnnotations
}
// ShouldCreateAdditionalService returns whether additional service should be created
func (in *KubernetesConfig) ShouldCreateAdditionalService() bool {
if in.Service == nil {
return true
}
if in.Service.Additional == nil {
return true
}
if in.Service.Additional.Enabled == nil {
return true
}
return *in.Service.Additional.Enabled
}
// ShouldIncludeBusPort returns whether bus port should be included in the service
func (in *KubernetesConfig) ShouldIncludeBusPort() bool {
if in.Service == nil {
return false
}
if in.Service.IncludeBusPort == nil {
return false
}
return *in.Service.IncludeBusPort
}
// ShouldIncludeBusPortForHeadless returns whether bus port should be included in the headless service
func (in *KubernetesConfig) ShouldIncludeBusPortForHeadless() bool {
if in.Service == nil {
return false
}
if in.Service.Headless == nil {
return false
}
if in.Service.Headless.IncludeBusPort == nil {
return false
}
return *in.Service.Headless.IncludeBusPort
}
// ShouldIncludeBusPortForAdditional returns whether bus port should be included in the additional service
func (in *KubernetesConfig) ShouldIncludeBusPortForAdditional() bool {
if in.Service == nil {
return false
}
if in.Service.Additional == nil {
return false
}
if in.Service.Additional.IncludeBusPort == nil {
return false
}
return *in.Service.Additional.IncludeBusPort
}
// ServiceConfig define the type of service to be created and its annotations
// +k8s:deepcopy-gen=true
type ServiceConfig struct {
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
ServiceType string `json:"serviceType,omitempty"`
ServiceAnnotations map[string]string `json:"annotations,omitempty"`
// IncludeBusPort when set to true, it will add bus port to the service, such as 16379.
// This field is only used for Redis cluster mode.
IncludeBusPort *bool `json:"includeBusPort,omitempty"`
// Headless config for which suffix is -headless service
Headless *Service `json:"headless,omitempty"`
// Additional config for which suffix is -additional service
Additional *Service `json:"additional,omitempty"`
}
// Service is the struct to define the service type and its annotations
// +k8s:deepcopy-gen=true
type Service struct {
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
// +kubebuilder:default:=ClusterIP
Type string `json:"type,omitempty"`
AdditionalAnnotations map[string]string `json:"additionalAnnotations,omitempty"`
// IncludeBusPort when set to true, it will add bus port to the service, such as 16379.
// This field is only used for Redis cluster mode.
IncludeBusPort *bool `json:"includeBusPort,omitempty"`
// +kubebuilder:default:=true
Enabled *bool `json:"enabled,omitempty"`
}
// ExistingPasswordSecret is the struct to access the existing secret
// +k8s:deepcopy-gen=true
type ExistingPasswordSecret struct {
Name *string `json:"name,omitempty"`
Key *string `json:"key,omitempty"`
}
// RedisExporter interface will have the information for redis exporter related stuff
// +k8s:deepcopy-gen=true
type RedisExporter struct {
Enabled bool `json:"enabled,omitempty"`
// +kubebuilder:default:=9121
Port *int `json:"port,omitempty"`
Image string `json:"image"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
}
// RedisConfig defines the external configuration of Redis
// +k8s:deepcopy-gen=true
type RedisConfig struct {
// MaxMemoryPercentOfLimit is the percentage of redis container memory limit to be used as maxmemory.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=100
MaxMemoryPercentOfLimit *int `json:"maxMemoryPercentOfLimit,omitempty"`
DynamicConfig []string `json:"dynamicConfig,omitempty"`
AdditionalRedisConfig *string `json:"additionalRedisConfig,omitempty"`
}
// Storage is the inteface to add pvc and pv support in redis
// +k8s:deepcopy-gen=true
type Storage struct {
KeepAfterDelete bool `json:"keepAfterDelete,omitempty"`
VolumeClaimTemplate corev1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
VolumeMount AdditionalVolume `json:"volumeMount,omitempty"`
}
// Additional Volume is provided by user that is mounted on the pods
// +k8s:deepcopy-gen=true
type AdditionalVolume struct {
Volume []corev1.Volume `json:"volume,omitempty"`
MountPath []corev1.VolumeMount `json:"mountPath,omitempty"`
}
// TLS Configuration for redis instances
// +k8s:deepcopy-gen=true
type TLSConfig struct {
CaKeyFile string `json:"ca,omitempty"`
CertKeyFile string `json:"cert,omitempty"`
KeyFile string `json:"key,omitempty"`
// Reference to secret which contains the certificates
Secret corev1.SecretVolumeSource `json:"secret"`
}
// Sidecar for each Redis pods
// +k8s:deepcopy-gen=true
type Sidecar struct {
Name string `json:"name"`
Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
Volumes *[]corev1.VolumeMount `json:"mountPath,omitempty"`
Command []string `json:"command,omitempty" protobuf:"bytes,3,rep,name=command"`
Ports *[]corev1.ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
}
// RedisLeader interface will have the redis leader configuration
// +k8s:deepcopy-gen=true
type RedisLeader struct {
// Replicas overrides clusterSize for leader nodes count. If not set, uses clusterSize value
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
}
// RedisFollower interface will have the redis follower configuration
// +k8s:deepcopy-gen=true
type RedisFollower struct {
// Replicas overrides clusterSize for follower nodes count. If not set, uses clusterSize value
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
}
// RedisPodDisruptionBudget configure a PodDisruptionBudget on the resource (leader/follower)
// +k8s:deepcopy-gen=true
type RedisPodDisruptionBudget struct {
Enabled bool `json:"enabled,omitempty"`
MinAvailable *int32 `json:"minAvailable,omitempty"`
MaxUnavailable *int32 `json:"maxUnavailable,omitempty"`
}
// +k8s:deepcopy-gen=true
type RedisSentinelConfig struct {
AdditionalSentinelConfig *string `json:"additionalSentinelConfig,omitempty"`
RedisReplicationName string `json:"redisReplicationName"`
RedisReplicationPassword *corev1.EnvVarSource `json:"redisReplicationPassword,omitempty"`
// +kubebuilder:default:=myMaster
MasterGroupName string `json:"masterGroupName,omitempty"`
// +kubebuilder:default:="6379"
RedisPort string `json:"redisPort,omitempty"`
// +kubebuilder:default:="2"
Quorum string `json:"quorum,omitempty"`
// +kubebuilder:default:="1"
ParallelSyncs string `json:"parallelSyncs,omitempty"`
// +kubebuilder:default:="180000"
FailoverTimeout string `json:"failoverTimeout,omitempty"`
// +kubebuilder:default:="30000"
DownAfterMilliseconds string `json:"downAfterMilliseconds,omitempty"`
// +kubebuilder:default:="no"
ResolveHostnames string `json:"resolveHostnames,omitempty"`
// +kubebuilder:default:="no"
AnnounceHostnames string `json:"announceHostnames,omitempty"`
}
// InitContainer for each Redis pods
// +k8s:deepcopy-gen=true
type InitContainer struct {
Enabled *bool `json:"enabled,omitempty"`
Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
Command []string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
}
// +k8s:deepcopy-gen=true
type ACLConfig struct {
Secret *corev1.SecretVolumeSource `json:"secret,omitempty"`
}

View File

@ -0,0 +1,86 @@
package v1beta2
import (
"testing"
"github.com/stretchr/testify/assert"
"k8s.io/utils/ptr"
)
func TestKubernetesConfig_ShouldCreateAdditionalService(t *testing.T) {
tests := []struct {
name string
config *KubernetesConfig
expected bool
}{
{
name: "nil config",
config: nil,
expected: true,
},
{
name: "empty config",
config: &KubernetesConfig{},
expected: true,
},
{
name: "nil service",
config: &KubernetesConfig{
Service: nil,
},
expected: true,
},
{
name: "nil additional",
config: &KubernetesConfig{
Service: &ServiceConfig{
Additional: nil,
},
},
expected: true,
},
{
name: "nil enabled",
config: &KubernetesConfig{
Service: &ServiceConfig{
Additional: &Service{
Enabled: nil,
},
},
},
expected: true,
},
{
name: "enabled true",
config: &KubernetesConfig{
Service: &ServiceConfig{
Additional: &Service{
Enabled: ptr.To(true),
},
},
},
expected: true,
},
{
name: "enabled false",
config: &KubernetesConfig{
Service: &ServiceConfig{
Additional: &Service{
Enabled: ptr.To(false),
},
},
},
expected: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if tt.config == nil {
assert.True(t, (&KubernetesConfig{}).ShouldCreateAdditionalService())
return
}
assert.Equal(t, tt.expected, tt.config.ShouldCreateAdditionalService())
})
}
}

View File

@ -14,20 +14,8 @@ 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
import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
)
// log is for logging in this package.
var redisclusterlog = logf.Log.WithName("rediscluster-resource")
func (r *RedisCluster) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).
Complete()
}
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

View File

@ -1,5 +1,4 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2020 Opstree Solutions.
@ -19,12 +18,33 @@ limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package api
package v1beta2
import (
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ACLConfig) DeepCopyInto(out *ACLConfig) {
*out = *in
if in.Secret != nil {
in, out := &in.Secret, &out.Secret
*out = new(v1.SecretVolumeSource)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACLConfig.
func (in *ACLConfig) DeepCopy() *ACLConfig {
if in == nil {
return nil
}
out := new(ACLConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AdditionalVolume) DeepCopyInto(out *AdditionalVolume) {
*out = *in
@ -79,6 +99,57 @@ func (in *ExistingPasswordSecret) DeepCopy() *ExistingPasswordSecret {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *InitContainer) DeepCopyInto(out *InitContainer) {
*out = *in
if in.Enabled != nil {
in, out := &in.Enabled, &out.Enabled
*out = new(bool)
**out = **in
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(v1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
if in.EnvVars != nil {
in, out := &in.EnvVars, &out.EnvVars
*out = new([]v1.EnvVar)
if **in != nil {
in, out := *in, *out
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitContainer.
func (in *InitContainer) DeepCopy() *InitContainer {
if in == nil {
return nil
}
out := new(InitContainer)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubernetesConfig) DeepCopyInto(out *KubernetesConfig) {
*out = *in
@ -102,11 +173,26 @@ func (in *KubernetesConfig) DeepCopyInto(out *KubernetesConfig) {
}
}
in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy)
if in.PersistentVolumeClaimRetentionPolicy != nil {
in, out := &in.PersistentVolumeClaimRetentionPolicy, &out.PersistentVolumeClaimRetentionPolicy
*out = new(appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy)
**out = **in
}
if in.Service != nil {
in, out := &in.Service, &out.Service
*out = new(ServiceConfig)
(*in).DeepCopyInto(*out)
}
if in.IgnoreAnnotations != nil {
in, out := &in.IgnoreAnnotations, &out.IgnoreAnnotations
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.MinReadySeconds != nil {
in, out := &in.MinReadySeconds, &out.MinReadySeconds
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesConfig.
@ -119,24 +205,19 @@ func (in *KubernetesConfig) DeepCopy() *KubernetesConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Probe) DeepCopyInto(out *Probe) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Probe.
func (in *Probe) DeepCopy() *Probe {
if in == nil {
return nil
}
out := new(Probe)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisConfig) DeepCopyInto(out *RedisConfig) {
*out = *in
if in.MaxMemoryPercentOfLimit != nil {
in, out := &in.MaxMemoryPercentOfLimit, &out.MaxMemoryPercentOfLimit
*out = new(int)
**out = **in
}
if in.DynamicConfig != nil {
in, out := &in.DynamicConfig, &out.DynamicConfig
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.AdditionalRedisConfig != nil {
in, out := &in.AdditionalRedisConfig, &out.AdditionalRedisConfig
*out = new(string)
@ -157,6 +238,11 @@ func (in *RedisConfig) DeepCopy() *RedisConfig {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisExporter) DeepCopyInto(out *RedisExporter) {
*out = *in
if in.Port != nil {
in, out := &in.Port, &out.Port
*out = new(int)
**out = **in
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(v1.ResourceRequirements)
@ -173,6 +259,11 @@ func (in *RedisExporter) DeepCopyInto(out *RedisExporter) {
}
}
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisExporter.
@ -210,13 +301,13 @@ func (in *RedisFollower) DeepCopyInto(out *RedisFollower) {
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(Probe)
**out = **in
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(Probe)
**out = **in
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
@ -236,6 +327,13 @@ func (in *RedisFollower) DeepCopyInto(out *RedisFollower) {
(*out)[key] = val
}
}
if in.TopologySpreadConstraints != nil {
in, out := &in.TopologySpreadConstraints, &out.TopologySpreadConstraints
*out = make([]v1.TopologySpreadConstraint, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisFollower.
@ -273,13 +371,13 @@ func (in *RedisLeader) DeepCopyInto(out *RedisLeader) {
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(Probe)
**out = **in
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(Probe)
**out = **in
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
@ -299,6 +397,13 @@ func (in *RedisLeader) DeepCopyInto(out *RedisLeader) {
(*out)[key] = val
}
}
if in.TopologySpreadConstraints != nil {
in, out := &in.TopologySpreadConstraints, &out.TopologySpreadConstraints
*out = make([]v1.TopologySpreadConstraint, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisLeader.
@ -344,6 +449,11 @@ func (in *RedisSentinelConfig) DeepCopyInto(out *RedisSentinelConfig) {
*out = new(string)
**out = **in
}
if in.RedisReplicationPassword != nil {
in, out := &in.RedisReplicationPassword, &out.RedisReplicationPassword
*out = new(v1.EnvVarSource)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelConfig.
@ -356,6 +466,38 @@ func (in *RedisSentinelConfig) DeepCopy() *RedisSentinelConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Service) DeepCopyInto(out *Service) {
*out = *in
if in.AdditionalAnnotations != nil {
in, out := &in.AdditionalAnnotations, &out.AdditionalAnnotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.IncludeBusPort != nil {
in, out := &in.IncludeBusPort, &out.IncludeBusPort
*out = new(bool)
**out = **in
}
if in.Enabled != nil {
in, out := &in.Enabled, &out.Enabled
*out = new(bool)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.
func (in *Service) DeepCopy() *Service {
if in == nil {
return nil
}
out := new(Service)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceConfig) DeepCopyInto(out *ServiceConfig) {
*out = *in
@ -366,6 +508,21 @@ func (in *ServiceConfig) DeepCopyInto(out *ServiceConfig) {
(*out)[key] = val
}
}
if in.IncludeBusPort != nil {
in, out := &in.IncludeBusPort, &out.IncludeBusPort
*out = new(bool)
**out = **in
}
if in.Headless != nil {
in, out := &in.Headless, &out.Headless
*out = new(Service)
(*in).DeepCopyInto(*out)
}
if in.Additional != nil {
in, out := &in.Additional, &out.Additional
*out = new(Service)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceConfig.
@ -397,6 +554,36 @@ func (in *Sidecar) DeepCopyInto(out *Sidecar) {
}
}
}
if in.Volumes != nil {
in, out := &in.Volumes, &out.Volumes
*out = new([]v1.VolumeMount)
if **in != nil {
in, out := *in, *out
*out = make([]v1.VolumeMount, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = new([]v1.ContainerPort)
if **in != nil {
in, out := *in, *out
*out = make([]v1.ContainerPort, len(*in))
copy(*out, *in)
}
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sidecar.

View File

@ -1,159 +0,0 @@
package api
import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
)
// KubernetesConfig will be the JSON struct for Basic Redis Config
// +k8s:deepcopy-gen=true
type KubernetesConfig struct {
Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
ExistingPasswordSecret *ExistingPasswordSecret `json:"redisSecret,omitempty"`
ImagePullSecrets *[]corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
UpdateStrategy appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`
Service *ServiceConfig `json:"service,omitempty"`
}
// ServiceConfig define the type of service to be created and its annotations
// +k8s:deepcopy-gen=true
type ServiceConfig struct {
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
ServiceType string `json:"serviceType,omitempty"`
ServiceAnnotations map[string]string `json:"annotations,omitempty"`
}
// ExistingPasswordSecret is the struct to access the existing secret
// +k8s:deepcopy-gen=true
type ExistingPasswordSecret struct {
Name *string `json:"name,omitempty"`
Key *string `json:"key,omitempty"`
}
// RedisExporter interface will have the information for redis exporter related stuff
// +k8s:deepcopy-gen=true
type RedisExporter struct {
Enabled bool `json:"enabled,omitempty"`
Image string `json:"image"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
}
// RedisConfig defines the external configuration of Redis
// +k8s:deepcopy-gen=true
type RedisConfig struct {
AdditionalRedisConfig *string `json:"additionalRedisConfig,omitempty"`
}
// Storage is the inteface to add pvc and pv support in redis
// +k8s:deepcopy-gen=true
type Storage struct {
VolumeClaimTemplate corev1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
VolumeMount AdditionalVolume `json:"volumeMount,omitempty"`
}
// Additional Volume is provided by user that is mounted on the pods
// +k8s:deepcopy-gen=true
type AdditionalVolume struct {
Volume []corev1.Volume `json:"volume,omitempty"`
MountPath []corev1.VolumeMount `json:"mountPath,omitempty"`
}
// TLS Configuration for redis instances
// +k8s:deepcopy-gen=true
type TLSConfig struct {
CaKeyFile string `json:"ca,omitempty"`
CertKeyFile string `json:"cert,omitempty"`
KeyFile string `json:"key,omitempty"`
// Reference to secret which contains the certificates
Secret corev1.SecretVolumeSource `json:"secret"`
}
// Probe is a interface for ReadinessProbe and LivenessProbe
// +k8s:deepcopy-gen=true
type Probe struct {
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty" protobuf:"varint,2,opt,name=initialDelaySeconds"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
TimeoutSeconds int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=10
PeriodSeconds int32 `json:"periodSeconds,omitempty" protobuf:"varint,4,opt,name=periodSeconds"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
SuccessThreshold int32 `json:"successThreshold,omitempty" protobuf:"varint,5,opt,name=successThreshold"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=3
FailureThreshold int32 `json:"failureThreshold,omitempty" protobuf:"varint,6,opt,name=failureThreshold"`
}
// Sidecar for each Redis pods
// +k8s:deepcopy-gen=true
type Sidecar struct {
Name string `json:"name"`
Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
}
// RedisLeader interface will have the redis leader configuration
// +k8s:deepcopy-gen=true
type RedisLeader struct {
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}
// RedisFollower interface will have the redis follower configuration
// +k8s:deepcopy-gen=true
type RedisFollower struct {
Replicas *int32 `json:"replicas,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}
// RedisPodDisruptionBudget configure a PodDisruptionBudget on the resource (leader/follower)
// +k8s:deepcopy-gen=true
type RedisPodDisruptionBudget struct {
Enabled bool `json:"enabled,omitempty"`
MinAvailable *int32 `json:"minAvailable,omitempty"`
MaxUnavailable *int32 `json:"maxUnavailable,omitempty"`
}
// +k8s:deepcopy-gen=true
type RedisSentinelConfig struct {
AdditionalSentinelConfig *string `json:"additionalSentinelConfig,omitempty"`
RedisReplicationName string `json:"redisReplicationName"`
// +kubebuilder:default:=myMaster
MasterGroupName string `json:"masterGroupName,omitempty"`
// +kubebuilder:default:="6379"
RedisPort string `json:"redisPort,omitempty"`
// +kubebuilder:default:="2"
Quorum string `json:"quorum,omitempty"`
// +kubebuilder:default:="1"
ParallelSyncs string `json:"parallelSyncs,omitempty"`
// +kubebuilder:default:="180000"
FailoverTimeout string `json:"failoverTimeout,omitempty"`
// +kubebuilder:default:="30000"
DownAfterMilliseconds string `json:"downAfterMilliseconds,omitempty"`
}

View File

@ -5,7 +5,7 @@ package api
// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch
// +kubebuilder:rbac:groups=redis.redis.opstreelabs.in,resources=redis/finalizers;rediscluster/finalizers;redisclusters/finalizers;redissentinel/finalizers;redissentinels/finalizers;redisreplication/finalizers;redisreplications/finalizers,verbs=update
// +kubebuilder:rbac:groups=redis.redis.opstreelabs.in,resources=redis/status;rediscluster/status;redisclusters/status;redissentinel/status;redissentinels/status;redisreplication/status;redisreplications/status,verbs=get;patch;update
// +kubebuilder:rbac:groups=,resources=secrets;pods/exec;pods;services;configmaps;events;persistentvolumeclaims;namespaces,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups="",resources=secrets;pods/exec;pods;services;configmaps;events;persistentvolumeclaims;namespaces,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups=policy,resources=poddisruptionbudgets,verbs=create;delete;get;list;patch;update;watch

View File

@ -0,0 +1,80 @@
/*
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
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// RedisSpec defines the desired state of Redis
type RedisSpec struct {
KubernetesConfig common.KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *common.RedisExporter `json:"redisExporter,omitempty"`
RedisConfig *common.RedisConfig `json:"redisConfig,omitempty"`
Storage *common.Storage `json:"storage,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *common.TLSConfig `json:"TLS,omitempty"`
ACL *common.ACLConfig `json:"acl,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
InitContainer *common.InitContainer `json:"initContainer,omitempty"`
Sidecars *[]common.Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
HostPort *int `json:"hostPort,omitempty"`
}
// RedisStatus defines the observed state of Redis
type RedisStatus struct{}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// Redis is the Schema for the redis API
type Redis struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisSpec `json:"spec"`
Status RedisStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Redis `json:"items"`
}
//nolint:gochecknoinits
func init() {
SchemeBuilder.Register(&Redis{}, &RedisList{})
}

View File

@ -18,12 +18,8 @@ package v1beta2
import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
)
// log is for logging in this package.
var redislog = logf.Log.WithName("redis-resource")
func (r *Redis) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).

View File

@ -0,0 +1,227 @@
//go:build !ignore_autogenerated
/*
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.
*/
// Code generated by controller-gen. DO NOT EDIT.
package v1beta2
import (
commonv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
"k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Redis) DeepCopyInto(out *Redis) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Redis.
func (in *Redis) DeepCopy() *Redis {
if in == nil {
return nil
}
out := new(Redis)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Redis) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisList) DeepCopyInto(out *RedisList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Redis, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisList.
func (in *RedisList) DeepCopy() *RedisList {
if in == nil {
return nil
}
out := new(RedisList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSpec) DeepCopyInto(out *RedisSpec) {
*out = *in
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.RedisExporter != nil {
in, out := &in.RedisExporter, &out.RedisExporter
*out = new(commonv1beta2.RedisExporter)
(*in).DeepCopyInto(*out)
}
if in.RedisConfig != nil {
in, out := &in.RedisConfig, &out.RedisConfig
*out = new(commonv1beta2.RedisConfig)
(*in).DeepCopyInto(*out)
}
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(commonv1beta2.Storage)
(*in).DeepCopyInto(*out)
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.PodSecurityContext != nil {
in, out := &in.PodSecurityContext, &out.PodSecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = new([]v1.Toleration)
if **in != nil {
in, out := *in, *out
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(commonv1beta2.TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.ACL != nil {
in, out := &in.ACL, &out.ACL
*out = new(commonv1beta2.ACLConfig)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.InitContainer != nil {
in, out := &in.InitContainer, &out.InitContainer
*out = new(commonv1beta2.InitContainer)
(*in).DeepCopyInto(*out)
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]commonv1beta2.Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]commonv1beta2.Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
if in.TerminationGracePeriodSeconds != nil {
in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
*out = new(int64)
**out = **in
}
if in.EnvVars != nil {
in, out := &in.EnvVars, &out.EnvVars
*out = new([]v1.EnvVar)
if **in != nil {
in, out := *in, *out
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.HostPort != nil {
in, out := &in.HostPort, &out.HostPort
*out = new(int)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSpec.
func (in *RedisSpec) DeepCopy() *RedisSpec {
if in == nil {
return nil
}
out := new(RedisSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisStatus) DeepCopyInto(out *RedisStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisStatus.
func (in *RedisStatus) DeepCopy() *RedisStatus {
if in == nil {
return nil
}
out := new(RedisStatus)
in.DeepCopyInto(out)
return out
}

View File

@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package v1beta1 contains API Schema definitions for the redis v1beta1 API group
// Package v1beta2 contains API Schema definitions for the redis v1beta2 API group
// +kubebuilder:object:generate=true
// +groupName=redis.redis.opstreelabs.in
package v1beta1
package v1beta2
import (
"k8s.io/apimachinery/pkg/runtime/schema"
@ -26,7 +26,7 @@ import (
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "redis.redis.opstreelabs.in", Version: "v1beta1"}
GroupVersion = schema.GroupVersion{Group: "redis.redis.opstreelabs.in", Version: "v1beta2"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

View File

@ -0,0 +1,13 @@
package v1beta2
import "k8s.io/utils/ptr"
// SetDefault sets default values for the RedisCluster object.
func (r *RedisCluster) SetDefault() {
if r.Spec.Port == nil {
r.Spec.Port = ptr.To(6379)
}
if r.Spec.RedisExporter != nil && r.Spec.RedisExporter.Port == nil {
r.Spec.RedisExporter.Port = ptr.To(9121)
}
}

View File

@ -0,0 +1,176 @@
/*
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
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// RedisClusterSpec defines the desired state of RedisCluster
type RedisClusterSpec struct {
// ClusterSize defines the default number of replicas for both leader and follower when not explicitly set
ClusterSize *int32 `json:"clusterSize"`
KubernetesConfig common.KubernetesConfig `json:"kubernetesConfig"`
HostNetwork bool `json:"hostNetwork,omitempty"`
// +kubebuilder:default:=6379
Port *int `json:"port,omitempty"`
// +kubebuilder:default:=v7
ClusterVersion *string `json:"clusterVersion,omitempty"`
RedisConfig *common.RedisConfig `json:"redisConfig,omitempty"`
RedisLeader RedisLeader `json:"redisLeader,omitempty"`
RedisFollower RedisFollower `json:"redisFollower,omitempty"`
RedisExporter *common.RedisExporter `json:"redisExporter,omitempty"`
Storage *ClusterStorage `json:"storage,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
TLS *common.TLSConfig `json:"TLS,omitempty"`
ACL *common.ACLConfig `json:"acl,omitempty"`
InitContainer *common.InitContainer `json:"initContainer,omitempty"`
Sidecars *[]common.Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
PersistenceEnabled *bool `json:"persistenceEnabled,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
HostPort *int `json:"hostPort,omitempty"`
}
// Node-conf needs to be added only in redis cluster
type ClusterStorage struct {
// +kubebuilder:default=false
NodeConfVolume bool `json:"nodeConfVolume,omitempty"`
NodeConfVolumeClaimTemplate corev1.PersistentVolumeClaim `json:"nodeConfVolumeClaimTemplate,omitempty"`
common.Storage `json:",inline"`
}
func (cr *RedisClusterSpec) GetReplicaCounts(t string) int32 {
replica := cr.ClusterSize
if t == "leader" && cr.RedisLeader.Replicas != nil {
replica = cr.RedisLeader.Replicas
} else if t == "follower" && cr.RedisFollower.Replicas != nil {
replica = cr.RedisFollower.Replicas
}
return *replica
}
// GetRedisLeaderResources returns the resources for the redis leader, if not set, it will return the default resources
func (cr *RedisClusterSpec) GetRedisLeaderResources() *corev1.ResourceRequirements {
if cr.RedisLeader.Resources != nil {
return cr.RedisLeader.Resources
}
return cr.KubernetesConfig.Resources
}
// GetRedisDynamicConfig returns Redis dynamic configuration parameters.
// Priority: top-level config > leader config > follower config
func (cr *RedisClusterSpec) GetRedisDynamicConfig() []string {
// Use top-level configuration if available
if cr.RedisConfig != nil && len(cr.RedisConfig.DynamicConfig) > 0 {
return cr.RedisConfig.DynamicConfig
}
// Return empty slice if no configuration is found
return []string{}
}
// GetRedisFollowerResources returns the resources for the redis follower, if not set, it will return the default resources
func (cr *RedisClusterSpec) GetRedisFollowerResources() *corev1.ResourceRequirements {
if cr.RedisFollower.Resources != nil {
return cr.RedisFollower.Resources
}
return cr.KubernetesConfig.Resources
}
// RedisLeader interface will have the redis leader configuration
type RedisLeader struct {
common.RedisLeader `json:",inline"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
}
// RedisFollower interface will have the redis follower configuration
type RedisFollower struct {
common.RedisFollower `json:",inline"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
}
// RedisClusterStatus defines the observed state of RedisCluster
// +kubebuilder:subresource:status
type RedisClusterStatus struct {
State RedisClusterState `json:"state,omitempty"`
Reason string `json:"reason,omitempty"`
// +kubebuilder:default=0
ReadyLeaderReplicas int32 `json:"readyLeaderReplicas,omitempty"`
// +kubebuilder:default=0
ReadyFollowerReplicas int32 `json:"readyFollowerReplicas,omitempty"`
}
type RedisClusterState string
const (
InitializingClusterLeaderReason string = "RedisCluster is initializing leaders"
InitializingClusterFollowerReason string = "RedisCluster is initializing followers"
BootstrapClusterReason string = "RedisCluster is bootstrapping"
ReadyClusterReason string = "RedisCluster is ready"
)
// Status Field of the Redis Cluster
const (
RedisClusterInitializing RedisClusterState = "Initializing"
RedisClusterBootstrap RedisClusterState = "Bootstrap"
// RedisClusterReady means the RedisCluster is ready for use, we use redis-cli --cluster check 127.0.0.1:6379 to check the cluster status
RedisClusterReady RedisClusterState = "Ready"
RedisClusterFailed RedisClusterState = "Failed"
)
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="ClusterSize",type=integer,JSONPath=`.spec.clusterSize`,description=Current cluster node count
// +kubebuilder:printcolumn:name="ReadyLeaderReplicas",type="integer",JSONPath=".status.readyLeaderReplicas",description="Number of ready leader replicas"
// +kubebuilder:printcolumn:name="ReadyFollowerReplicas",type="integer",JSONPath=".status.readyFollowerReplicas",description="Number of ready follower replicas"
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="The current state of the Redis Cluster",priority=1
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of Cluster",priority=1
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.reason",description="The reason for the current state",priority=1
// RedisCluster is the Schema for the redisclusters API
type RedisCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisClusterSpec `json:"spec"`
Status RedisClusterStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// RedisClusterList contains a list of RedisCluster
type RedisClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisCluster `json:"items"`
}
//nolint:gochecknoinits
func init() {
SchemeBuilder.Register(&RedisCluster{}, &RedisClusterList{})
}

View File

@ -0,0 +1,100 @@
/*
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
import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)
const (
webhookPath = "/validate-redis-redis-opstreelabs-in-v1beta2-rediscluster"
)
// log is for logging in this package.
var redisclusterlog = logf.Log.WithName("rediscluster-v1beta2-validation")
// +kubebuilder:webhook:path=/validate-redis-redis-opstreelabs-in-v1beta2-rediscluster,mutating=false,failurePolicy=fail,sideEffects=None,groups=redis.redis.opstreelabs.in,resources=redisclusters,verbs=create;update,versions=v1beta2,name=validate-rediscluster.redis.opstreelabs.in,admissionReviewVersions=v1
// SetupWebhookWithManager will setup the manager
func (r *RedisCluster) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).
Complete()
}
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.ClusterSize == nil {
return warnings, nil
}
// Check if the Size is at least 3 for proper cluster operation
if *r.Spec.ClusterSize < 3 {
errors = append(errors, field.Invalid(
field.NewPath("spec").Child("clusterSize"),
*r.Spec.ClusterSize,
"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.ClusterSize = 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.ClusterSize = 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

@ -0,0 +1,290 @@
//go:build !ignore_autogenerated
/*
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.
*/
// Code generated by controller-gen. DO NOT EDIT.
package v1beta2
import (
commonv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterStorage) DeepCopyInto(out *ClusterStorage) {
*out = *in
in.NodeConfVolumeClaimTemplate.DeepCopyInto(&out.NodeConfVolumeClaimTemplate)
in.Storage.DeepCopyInto(&out.Storage)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStorage.
func (in *ClusterStorage) DeepCopy() *ClusterStorage {
if in == nil {
return nil
}
out := new(ClusterStorage)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisCluster) DeepCopyInto(out *RedisCluster) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisCluster.
func (in *RedisCluster) DeepCopy() *RedisCluster {
if in == nil {
return nil
}
out := new(RedisCluster)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisCluster) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisClusterList) DeepCopyInto(out *RedisClusterList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RedisCluster, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterList.
func (in *RedisClusterList) DeepCopy() *RedisClusterList {
if in == nil {
return nil
}
out := new(RedisClusterList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisClusterList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisClusterSpec) DeepCopyInto(out *RedisClusterSpec) {
*out = *in
if in.ClusterSize != nil {
in, out := &in.ClusterSize, &out.ClusterSize
*out = new(int32)
**out = **in
}
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.Port != nil {
in, out := &in.Port, &out.Port
*out = new(int)
**out = **in
}
if in.ClusterVersion != nil {
in, out := &in.ClusterVersion, &out.ClusterVersion
*out = new(string)
**out = **in
}
if in.RedisConfig != nil {
in, out := &in.RedisConfig, &out.RedisConfig
*out = new(commonv1beta2.RedisConfig)
(*in).DeepCopyInto(*out)
}
in.RedisLeader.DeepCopyInto(&out.RedisLeader)
in.RedisFollower.DeepCopyInto(&out.RedisFollower)
if in.RedisExporter != nil {
in, out := &in.RedisExporter, &out.RedisExporter
*out = new(commonv1beta2.RedisExporter)
(*in).DeepCopyInto(*out)
}
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(ClusterStorage)
(*in).DeepCopyInto(*out)
}
if in.PodSecurityContext != nil {
in, out := &in.PodSecurityContext, &out.PodSecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(v1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(commonv1beta2.TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.ACL != nil {
in, out := &in.ACL, &out.ACL
*out = new(commonv1beta2.ACLConfig)
(*in).DeepCopyInto(*out)
}
if in.InitContainer != nil {
in, out := &in.InitContainer, &out.InitContainer
*out = new(commonv1beta2.InitContainer)
(*in).DeepCopyInto(*out)
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]commonv1beta2.Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]commonv1beta2.Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
if in.PersistenceEnabled != nil {
in, out := &in.PersistenceEnabled, &out.PersistenceEnabled
*out = new(bool)
**out = **in
}
if in.EnvVars != nil {
in, out := &in.EnvVars, &out.EnvVars
*out = new([]v1.EnvVar)
if **in != nil {
in, out := *in, *out
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.HostPort != nil {
in, out := &in.HostPort, &out.HostPort
*out = new(int)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterSpec.
func (in *RedisClusterSpec) DeepCopy() *RedisClusterSpec {
if in == nil {
return nil
}
out := new(RedisClusterSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisClusterStatus) DeepCopyInto(out *RedisClusterStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterStatus.
func (in *RedisClusterStatus) DeepCopy() *RedisClusterStatus {
if in == nil {
return nil
}
out := new(RedisClusterStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisFollower) DeepCopyInto(out *RedisFollower) {
*out = *in
in.RedisFollower.DeepCopyInto(&out.RedisFollower)
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
if in.TerminationGracePeriodSeconds != nil {
in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
*out = new(int64)
**out = **in
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(v1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisFollower.
func (in *RedisFollower) DeepCopy() *RedisFollower {
if in == nil {
return nil
}
out := new(RedisFollower)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisLeader) DeepCopyInto(out *RedisLeader) {
*out = *in
in.RedisLeader.DeepCopyInto(&out.RedisLeader)
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
if in.TerminationGracePeriodSeconds != nil {
in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
*out = new(int64)
**out = **in
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(v1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisLeader.
func (in *RedisLeader) DeepCopy() *RedisLeader {
if in == nil {
return nil
}
out := new(RedisLeader)
in.DeepCopyInto(out)
return out
}

View File

@ -0,0 +1,36 @@
/*
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 API Schema definitions for the redis v1beta2 API group
// +kubebuilder:object:generate=true
// +groupName=redis.redis.opstreelabs.in
package v1beta2
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "redis.redis.opstreelabs.in", Version: "v1beta2"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

View File

@ -0,0 +1,76 @@
package v1beta2
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type RedisReplicationSpec struct {
Size *int32 `json:"clusterSize"`
KubernetesConfig common.KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *common.RedisExporter `json:"redisExporter,omitempty"`
RedisConfig *common.RedisConfig `json:"redisConfig,omitempty"`
Storage *common.Storage `json:"storage,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *common.TLSConfig `json:"TLS,omitempty"`
PodDisruptionBudget *common.RedisPodDisruptionBudget `json:"pdb,omitempty"`
ACL *common.ACLConfig `json:"acl,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
InitContainer *common.InitContainer `json:"initContainer,omitempty"`
Sidecars *[]common.Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
TopologySpreadConstrains []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
HostPort *int `json:"hostPort,omitempty"`
}
func (cr *RedisReplicationSpec) GetReplicationCounts(t string) int32 {
replica := cr.Size
return *replica
}
// RedisStatus defines the observed state of Redis
type RedisReplicationStatus struct {
MasterNode string `json:"masterNode,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Master",type="string",JSONPath=".status.masterNode"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// Redis is the Schema for the redis API
type RedisReplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisReplicationSpec `json:"spec"`
Status RedisReplicationStatus `json:"status,omitempty"`
}
func (rr *RedisReplication) GetStatefulSetName() string {
return rr.Name
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisReplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisReplication `json:"items"`
}
//nolint:gochecknoinits
func init() {
SchemeBuilder.Register(&RedisReplication{}, &RedisReplicationList{})
}

View File

@ -18,12 +18,8 @@ package v1beta2
import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
)
// log is for logging in this package.
var redisreplicationlog = logf.Log.WithName("redisreplication-resource")
func (r *RedisReplication) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).

View File

@ -0,0 +1,244 @@
//go:build !ignore_autogenerated
/*
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.
*/
// Code generated by controller-gen. DO NOT EDIT.
package v1beta2
import (
commonv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
"k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplication) DeepCopyInto(out *RedisReplication) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplication.
func (in *RedisReplication) DeepCopy() *RedisReplication {
if in == nil {
return nil
}
out := new(RedisReplication)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisReplication) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplicationList) DeepCopyInto(out *RedisReplicationList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RedisReplication, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationList.
func (in *RedisReplicationList) DeepCopy() *RedisReplicationList {
if in == nil {
return nil
}
out := new(RedisReplicationList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisReplicationList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplicationSpec) DeepCopyInto(out *RedisReplicationSpec) {
*out = *in
if in.Size != nil {
in, out := &in.Size, &out.Size
*out = new(int32)
**out = **in
}
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.RedisExporter != nil {
in, out := &in.RedisExporter, &out.RedisExporter
*out = new(commonv1beta2.RedisExporter)
(*in).DeepCopyInto(*out)
}
if in.RedisConfig != nil {
in, out := &in.RedisConfig, &out.RedisConfig
*out = new(commonv1beta2.RedisConfig)
(*in).DeepCopyInto(*out)
}
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(commonv1beta2.Storage)
(*in).DeepCopyInto(*out)
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.PodSecurityContext != nil {
in, out := &in.PodSecurityContext, &out.PodSecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = new([]v1.Toleration)
if **in != nil {
in, out := *in, *out
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(commonv1beta2.TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.PodDisruptionBudget != nil {
in, out := &in.PodDisruptionBudget, &out.PodDisruptionBudget
*out = new(commonv1beta2.RedisPodDisruptionBudget)
(*in).DeepCopyInto(*out)
}
if in.ACL != nil {
in, out := &in.ACL, &out.ACL
*out = new(commonv1beta2.ACLConfig)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.InitContainer != nil {
in, out := &in.InitContainer, &out.InitContainer
*out = new(commonv1beta2.InitContainer)
(*in).DeepCopyInto(*out)
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]commonv1beta2.Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]commonv1beta2.Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
if in.TerminationGracePeriodSeconds != nil {
in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
*out = new(int64)
**out = **in
}
if in.EnvVars != nil {
in, out := &in.EnvVars, &out.EnvVars
*out = new([]v1.EnvVar)
if **in != nil {
in, out := *in, *out
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.TopologySpreadConstrains != nil {
in, out := &in.TopologySpreadConstrains, &out.TopologySpreadConstrains
*out = make([]v1.TopologySpreadConstraint, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.HostPort != nil {
in, out := &in.HostPort, &out.HostPort
*out = new(int)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationSpec.
func (in *RedisReplicationSpec) DeepCopy() *RedisReplicationSpec {
if in == nil {
return nil
}
out := new(RedisReplicationSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplicationStatus) DeepCopyInto(out *RedisReplicationStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationStatus.
func (in *RedisReplicationStatus) DeepCopy() *RedisReplicationStatus {
if in == nil {
return nil
}
out := new(RedisReplicationStatus)
in.DeepCopyInto(out)
return out
}

View File

@ -0,0 +1,36 @@
/*
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 API Schema definitions for the redis v1beta2 API group
// +kubebuilder:object:generate=true
// +groupName=redis.redis.opstreelabs.in
package v1beta2
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "redis.redis.opstreelabs.in", Version: "v1beta2"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

View File

@ -0,0 +1,76 @@
package v1beta2
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type RedisSentinelSpec struct {
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=3
Size *int32 `json:"clusterSize"`
KubernetesConfig common.KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *common.RedisExporter `json:"redisExporter,omitempty"`
RedisSentinelConfig *RedisSentinelConfig `json:"redisSentinelConfig,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *common.TLSConfig `json:"TLS,omitempty"`
PodDisruptionBudget *common.RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty" protobuf:"bytes,12,opt,name=livenessProbe"`
InitContainer *common.InitContainer `json:"initContainer,omitempty"`
Sidecars *[]common.Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
VolumeMount *common.AdditionalVolume `json:"volumeMount,omitempty"`
TopologySpreadConstrains []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
HostPort *int `json:"hostPort,omitempty"`
}
func (cr *RedisSentinelSpec) GetSentinelCounts(t string) int32 {
replica := cr.Size
return *replica
}
type RedisSentinelConfig struct {
common.RedisSentinelConfig `json:",inline"`
}
type RedisSentinelStatus struct{}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
//+kubebuilder:storageversion
// Redis is the Schema for the redis API
type RedisSentinel struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisSentinelSpec `json:"spec"`
Status RedisSentinelStatus `json:"status,omitempty"`
}
func (rs *RedisSentinel) GetStatefulSetName() string {
return rs.Name + "-sentinel"
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisSentinelList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisSentinel `json:"items"`
}
//nolint:gochecknoinits
func init() {
SchemeBuilder.Register(&RedisSentinel{}, &RedisSentinelList{})
}

View File

@ -0,0 +1,102 @@
/*
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
import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)
const (
webhookPath = "/validate-redis-redis-opstreelabs-in-v1beta2-redissentinel"
)
// log is for logging in this package.
var redissentinellog = logf.Log.WithName("redissentinel-v1beta2-validation")
// +kubebuilder:webhook:path=/validate-redis-redis-opstreelabs-in-v1beta2-redissentinel,mutating=false,failurePolicy=fail,sideEffects=None,groups=redis.redis.opstreelabs.in,resources=redissentinels,verbs=create;update,versions=v1beta2,name=validate-redissentinel.redis.opstreelabs.in,admissionReviewVersions=v1
// SetupWebhookWithManager will setup the manager
func (r *RedisSentinel) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).
Complete()
}
var _ webhook.Validator = &RedisSentinel{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *RedisSentinel) ValidateCreate() (admission.Warnings, error) {
redissentinellog.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 *RedisSentinel) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
redissentinellog.Info("validate update", "name", r.Name)
return r.validate(old.(*RedisSentinel))
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *RedisSentinel) ValidateDelete() (admission.Warnings, error) {
redissentinellog.Info("validate delete", "name", r.Name)
return nil, nil
}
// validate validates the Redis Sentinel CR
func (r *RedisSentinel) validate(_ *RedisSentinel) (admission.Warnings, error) {
var errors field.ErrorList
var warnings admission.Warnings
if r.Spec.Size == nil {
return warnings, nil
}
// Check if the Size is an odd number
if *r.Spec.Size%2 == 0 {
errors = append(errors, field.Invalid(
field.NewPath("spec").Child("clusterSize"),
*r.Spec.Size,
"Redis Sentinel cluster size must be an odd number for proper leader election",
))
}
if len(errors) == 0 {
return nil, nil
}
return nil, apierrors.NewInvalid(
schema.GroupKind{Group: "redis.redis.opstreelabs.in", Kind: "RedisSentinel"},
r.Name,
errors,
)
}
func (r *RedisSentinel) WebhookPath() string {
return webhookPath
}
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

View File

@ -0,0 +1,69 @@
package v1beta2_test
import (
"encoding/json"
"fmt"
"testing"
v1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/redissentinel/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 TestRedisSentinelWebhook(t *testing.T) {
cases := []webhook.ValidationWebhookTestCase{
{
Name: "success-create-v1beta2-redissentinel-validate-clusterSize",
Operation: admissionv1beta1.Create,
Object: func(t *testing.T, uid string) []byte {
t.Helper()
sentinel := mkRedisSentinel(uid)
sentinel.Spec.Size = ptr.To(int32(3))
return marshal(t, sentinel)
},
Check: webhook.ValidationWebhookSucceeded,
},
{
Name: "failed-create-v1beta2-redissentinel-validate-clusterSize",
Operation: admissionv1beta1.Create,
Object: func(t *testing.T, uid string) []byte {
t.Helper()
sentinel := mkRedisSentinel(uid)
sentinel.Spec.Size = ptr.To(int32(4))
return marshal(t, sentinel)
},
Check: webhook.ValidationWebhookFailed("Redis Sentinel cluster size must be an odd number for proper leader election"),
},
}
gvk := metav1.GroupVersionKind{
Group: "redis.redis.opstreelabs.in",
Version: "v1beta2",
Kind: "RedisSentinel",
}
sentinel := &v1beta2.RedisSentinel{}
webhook.RunValidationWebhookTests(t, gvk, sentinel, cases...)
}
func mkRedisSentinel(uid string) *v1beta2.RedisSentinel {
return &v1beta2.RedisSentinel{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("test-%s", uid),
UID: types.UID(fmt.Sprintf("test-%s", uid)),
},
Spec: v1beta2.RedisSentinelSpec{},
}
}
func marshal(t *testing.T, obj interface{}) []byte {
t.Helper()
bytes, err := json.Marshal(obj)
require.NoError(t, err)
return bytes
}

View File

@ -0,0 +1,255 @@
//go:build !ignore_autogenerated
/*
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.
*/
// Code generated by controller-gen. DO NOT EDIT.
package v1beta2
import (
commonv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/common/v1beta2"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinel) DeepCopyInto(out *RedisSentinel) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinel.
func (in *RedisSentinel) DeepCopy() *RedisSentinel {
if in == nil {
return nil
}
out := new(RedisSentinel)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisSentinel) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelConfig) DeepCopyInto(out *RedisSentinelConfig) {
*out = *in
in.RedisSentinelConfig.DeepCopyInto(&out.RedisSentinelConfig)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelConfig.
func (in *RedisSentinelConfig) DeepCopy() *RedisSentinelConfig {
if in == nil {
return nil
}
out := new(RedisSentinelConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelList) DeepCopyInto(out *RedisSentinelList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RedisSentinel, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelList.
func (in *RedisSentinelList) DeepCopy() *RedisSentinelList {
if in == nil {
return nil
}
out := new(RedisSentinelList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisSentinelList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelSpec) DeepCopyInto(out *RedisSentinelSpec) {
*out = *in
if in.Size != nil {
in, out := &in.Size, &out.Size
*out = new(int32)
**out = **in
}
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.RedisExporter != nil {
in, out := &in.RedisExporter, &out.RedisExporter
*out = new(commonv1beta2.RedisExporter)
(*in).DeepCopyInto(*out)
}
if in.RedisSentinelConfig != nil {
in, out := &in.RedisSentinelConfig, &out.RedisSentinelConfig
*out = new(RedisSentinelConfig)
(*in).DeepCopyInto(*out)
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.PodSecurityContext != nil {
in, out := &in.PodSecurityContext, &out.PodSecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.SecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = new([]v1.Toleration)
if **in != nil {
in, out := *in, *out
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(commonv1beta2.TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.PodDisruptionBudget != nil {
in, out := &in.PodDisruptionBudget, &out.PodDisruptionBudget
*out = new(commonv1beta2.RedisPodDisruptionBudget)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(v1.Probe)
(*in).DeepCopyInto(*out)
}
if in.InitContainer != nil {
in, out := &in.InitContainer, &out.InitContainer
*out = new(commonv1beta2.InitContainer)
(*in).DeepCopyInto(*out)
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]commonv1beta2.Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]commonv1beta2.Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
if in.TerminationGracePeriodSeconds != nil {
in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
*out = new(int64)
**out = **in
}
if in.EnvVars != nil {
in, out := &in.EnvVars, &out.EnvVars
*out = new([]v1.EnvVar)
if **in != nil {
in, out := *in, *out
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.VolumeMount != nil {
in, out := &in.VolumeMount, &out.VolumeMount
*out = new(commonv1beta2.AdditionalVolume)
(*in).DeepCopyInto(*out)
}
if in.TopologySpreadConstrains != nil {
in, out := &in.TopologySpreadConstrains, &out.TopologySpreadConstrains
*out = make([]v1.TopologySpreadConstraint, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.HostPort != nil {
in, out := &in.HostPort, &out.HostPort
*out = new(int)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelSpec.
func (in *RedisSentinelSpec) DeepCopy() *RedisSentinelSpec {
if in == nil {
return nil
}
out := new(RedisSentinelSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelStatus) DeepCopyInto(out *RedisSentinelStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelStatus.
func (in *RedisSentinelStatus) DeepCopy() *RedisSentinelStatus {
if in == nil {
return nil
}
out := new(RedisSentinelStatus)
in.DeepCopyInto(out)
return out
}

View File

@ -1,18 +0,0 @@
package status
type RedisClusterState string
const (
ReadyClusterReason string = "RedisCluster is ready"
InitializingClusterLeaderReason string = "RedisCluster is initializing leaders"
InitializingClusterFollowerReason string = "RedisCluster is initializing followers"
BootstrapClusterReason string = "RedisCluster is bootstrapping"
)
// Status Field of the Redis Cluster
const (
RedisClusterReady RedisClusterState = "Ready"
RedisClusterInitializing RedisClusterState = "Initializing"
RedisClusterBootstrap RedisClusterState = "Bootstrap"
// RedisClusterFailed RedisClusterState = "Failed"
)

View File

@ -1,69 +0,0 @@
/*
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 v1beta1
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api"
)
// KubernetesConfig will be the JSON struct for Basic Redis Config
type KubernetesConfig struct {
common.KubernetesConfig `json:",inline"`
}
// ServiceConfig define the type of service to be created and its annotations
type ServiceConfig struct {
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
ServiceType string `json:"serviceType,omitempty"`
ServiceAnnotations map[string]string `json:"annotations,omitempty"`
}
// RedisConfig defines the external configuration of Redis
type RedisConfig struct {
common.RedisConfig `json:",inline"`
}
// ExistingPasswordSecret is the struct to access the existing secret
type ExistingPasswordSecret struct {
Name *string `json:"name,omitempty"`
Key *string `json:"key,omitempty"`
}
// Storage is the inteface to add pvc and pv support in redis
type Storage struct {
common.Storage `json:",inline"`
}
// RedisExporter interface will have the information for redis exporter related stuff
type RedisExporter struct {
common.RedisExporter `json:",inline"`
}
// TLS Configuration for redis instances
type TLSConfig struct {
common.TLSConfig `json:",inline"`
}
// Probe is a interface for ReadinessProbe and LivenessProbe
type Probe struct {
common.Probe `json:",inline"`
}
// Sidecar for each Redis pods
type Sidecar struct {
common.Sidecar `json:",inline"`
}

View File

@ -1,167 +0,0 @@
package v1beta1
import (
redisv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
// ConvertTo converts this Redis to the Hub version (vbeta2).
func (src *Redis) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*redisv1beta2.Redis)
// if src == nil {
// return errors.New("source is nil")
// }
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &redisv1beta2.RedisExporter{}
dst.Spec.RedisExporter.RedisExporter = src.Spec.RedisExporter.RedisExporter
}
// RedisConfig
if src.Spec.RedisConfig != nil {
dst.Spec.RedisConfig = &redisv1beta2.RedisConfig{}
dst.Spec.RedisConfig.RedisConfig = src.Spec.RedisConfig.RedisConfig
}
// Storage
if src.Spec.Storage != nil {
dst.Spec.Storage = &redisv1beta2.Storage{}
dst.Spec.Storage.VolumeClaimTemplate = src.Spec.Storage.VolumeClaimTemplate
dst.Spec.Storage.VolumeMount = src.Spec.Storage.VolumeMount
}
// NodeSelector
if src.Spec.NodeSelector != nil {
dst.Spec.NodeSelector = src.Spec.NodeSelector
}
// SecurityContext >> PodSecurityContext
if src.Spec.SecurityContext != nil {
dst.Spec.PodSecurityContext = src.Spec.SecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Affinity
if src.Spec.Affinity != nil {
dst.Spec.Affinity = src.Spec.Affinity
}
// Tolerations
if src.Spec.Tolerations != nil {
dst.Spec.Tolerations = src.Spec.Tolerations
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &redisv1beta2.TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// ReadinessProbe
if src.Spec.ReadinessProbe != nil {
dst.Spec.ReadinessProbe = &redisv1beta2.Probe{}
dst.Spec.ReadinessProbe.Probe = src.Spec.ReadinessProbe.Probe
}
// LivenessProbe
if src.Spec.LivenessProbe != nil {
dst.Spec.LivenessProbe = &redisv1beta2.Probe{}
dst.Spec.LivenessProbe.Probe = src.Spec.LivenessProbe.Probe
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []redisv1beta2.Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, redisv1beta2.Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
return nil
}
// ConvertFrom converts from the Hub version (vbeta2) to this version.
func (dst *Redis) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*redisv1beta2.Redis)
// if src == nil {
// return errors.New("source is nil")
// }
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &RedisExporter{}
dst.Spec.RedisExporter.RedisExporter = src.Spec.RedisExporter.RedisExporter
}
// RedisConfig
if src.Spec.RedisConfig != nil {
dst.Spec.RedisConfig = &RedisConfig{}
dst.Spec.RedisConfig.RedisConfig = src.Spec.RedisConfig.RedisConfig
}
// Storage
if src.Spec.Storage != nil {
dst.Spec.Storage = &Storage{}
dst.Spec.Storage.VolumeClaimTemplate = src.Spec.Storage.VolumeClaimTemplate
dst.Spec.Storage.VolumeMount = src.Spec.Storage.VolumeMount
}
// NodeSelector
if src.Spec.NodeSelector != nil {
dst.Spec.NodeSelector = src.Spec.NodeSelector
}
// PodSecurityContext >> SecurityContext
if src.Spec.PodSecurityContext != nil {
dst.Spec.SecurityContext = src.Spec.PodSecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Affinity
if src.Spec.Affinity != nil {
dst.Spec.Affinity = src.Spec.Affinity
}
// Tolerations
if src.Spec.Tolerations != nil {
dst.Spec.Tolerations = src.Spec.Tolerations
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// ReadinessProbe
if src.Spec.ReadinessProbe != nil {
dst.Spec.ReadinessProbe = &Probe{}
dst.Spec.ReadinessProbe.Probe = src.Spec.ReadinessProbe.Probe
}
// LivenessProbe
if src.Spec.LivenessProbe != nil {
dst.Spec.LivenessProbe = &Probe{}
dst.Spec.LivenessProbe.Probe = src.Spec.LivenessProbe.Probe
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
return nil
}

View File

@ -1,74 +0,0 @@
/*
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 v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// RedisSpec defines the desired state of Redis
type RedisSpec struct {
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *RedisExporter `json:"redisExporter,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Storage *Storage `json:"storage,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
}
// RedisStatus defines the observed state of Redis
type RedisStatus struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// Redis is the Schema for the redis API
type Redis struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisSpec `json:"spec"`
Status RedisStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Redis `json:"items"`
}
func init() {
SchemeBuilder.Register(&Redis{}, &RedisList{})
}

View File

@ -1,245 +0,0 @@
package v1beta1
import (
redisv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
// ConvertTo converts this RedisCluster to the Hub version (v1beta2) from the current version (v1beta1)
func (src *RedisCluster) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*redisv1beta2.RedisCluster)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Size
if src.Spec.Size != nil {
dst.Spec.Size = src.Spec.Size
}
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// ClusterVersion
if src.Spec.ClusterVersion != nil {
dst.Spec.ClusterVersion = src.Spec.ClusterVersion
}
// RedisLeader
dst.Spec.RedisLeader = redisv1beta2.RedisLeader{}
if src.Spec.RedisLeader.Replicas != nil {
dst.Spec.RedisLeader.Replicas = src.Spec.RedisLeader.Replicas
}
if src.Spec.RedisLeader.RedisConfig != nil {
dst.Spec.RedisLeader.RedisConfig = src.Spec.RedisLeader.RedisConfig
}
if src.Spec.RedisLeader.Affinity != nil {
dst.Spec.RedisLeader.Affinity = src.Spec.RedisLeader.Affinity
}
if src.Spec.RedisLeader.PodDisruptionBudget != nil {
dst.Spec.RedisLeader.PodDisruptionBudget = src.Spec.RedisLeader.PodDisruptionBudget
}
if src.Spec.RedisLeader.ReadinessProbe != nil {
dst.Spec.RedisLeader.ReadinessProbe = src.Spec.RedisLeader.ReadinessProbe
}
if src.Spec.RedisLeader.LivenessProbe != nil {
dst.Spec.RedisLeader.LivenessProbe = src.Spec.RedisLeader.LivenessProbe
}
if src.Spec.RedisLeader.Tolerations != nil {
dst.Spec.RedisLeader.Tolerations = src.Spec.RedisLeader.Tolerations
}
if src.Spec.RedisLeader.NodeSelector != nil {
dst.Spec.RedisLeader.NodeSelector = src.Spec.RedisLeader.NodeSelector
}
// RedisFollower
dst.Spec.RedisFollower = redisv1beta2.RedisFollower{}
if src.Spec.RedisFollower.Replicas != nil {
dst.Spec.RedisFollower.Replicas = src.Spec.RedisFollower.Replicas
}
if src.Spec.RedisFollower.RedisConfig != nil {
dst.Spec.RedisFollower.RedisConfig = src.Spec.RedisFollower.RedisConfig
}
if src.Spec.RedisFollower.Affinity != nil {
dst.Spec.RedisFollower.Affinity = src.Spec.RedisFollower.Affinity
}
if src.Spec.RedisFollower.PodDisruptionBudget != nil {
dst.Spec.RedisFollower.PodDisruptionBudget = src.Spec.RedisFollower.PodDisruptionBudget
}
if src.Spec.RedisFollower.ReadinessProbe != nil {
dst.Spec.RedisFollower.ReadinessProbe = src.Spec.RedisFollower.ReadinessProbe
}
if src.Spec.RedisFollower.LivenessProbe != nil {
dst.Spec.RedisFollower.LivenessProbe = src.Spec.RedisFollower.LivenessProbe
}
if src.Spec.RedisFollower.Tolerations != nil {
dst.Spec.RedisFollower.Tolerations = src.Spec.RedisFollower.Tolerations
}
if src.Spec.RedisFollower.NodeSelector != nil {
dst.Spec.RedisFollower.NodeSelector = src.Spec.RedisFollower.NodeSelector
}
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &redisv1beta2.RedisExporter{}
dst.Spec.RedisExporter.RedisExporter = src.Spec.RedisExporter.RedisExporter
}
// Storage-v1bet1 >> ClusterStorage-v1beta2
if src.Spec.Storage != nil {
// Note : Add the Check the creation of node-conf later
dst.Spec.Storage = &redisv1beta2.ClusterStorage{}
dst.Spec.Storage.VolumeClaimTemplate = src.Spec.Storage.VolumeClaimTemplate
dst.Spec.Storage.VolumeMount = src.Spec.Storage.VolumeMount
}
// SecurityContext >> PodSecurityContext
if src.Spec.SecurityContext != nil {
dst.Spec.PodSecurityContext = src.Spec.SecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Resources
if src.Spec.Resources != nil {
dst.Spec.Resources = src.Spec.Resources
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &redisv1beta2.TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []redisv1beta2.Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, redisv1beta2.Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
// PersistenceEnabled
if src.Spec.PersistenceEnabled != nil {
dst.Spec.PersistenceEnabled = src.Spec.PersistenceEnabled
}
return nil
}
// ConvertFrom converts from the Hub version (vbeta2) to this version.
func (dst *RedisCluster) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*redisv1beta2.RedisCluster)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Size
if src.Spec.Size != nil {
dst.Spec.Size = src.Spec.Size
}
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// ClusterVersion
if src.Spec.ClusterVersion != nil {
dst.Spec.ClusterVersion = src.Spec.ClusterVersion
}
// RedisLeader
dst.Spec.RedisLeader = RedisLeader{}
if src.Spec.RedisLeader.Replicas != nil {
dst.Spec.RedisLeader.Replicas = src.Spec.RedisLeader.Replicas
}
if src.Spec.RedisLeader.RedisConfig != nil {
dst.Spec.RedisLeader.RedisConfig = src.Spec.RedisLeader.RedisConfig
}
if src.Spec.RedisLeader.Affinity != nil {
dst.Spec.RedisLeader.Affinity = src.Spec.RedisLeader.Affinity
}
if src.Spec.RedisLeader.PodDisruptionBudget != nil {
dst.Spec.RedisLeader.PodDisruptionBudget = src.Spec.RedisLeader.PodDisruptionBudget
}
if src.Spec.RedisLeader.ReadinessProbe != nil {
dst.Spec.RedisLeader.ReadinessProbe = src.Spec.RedisLeader.ReadinessProbe
}
if src.Spec.RedisLeader.LivenessProbe != nil {
dst.Spec.RedisLeader.LivenessProbe = src.Spec.RedisLeader.LivenessProbe
}
if src.Spec.RedisLeader.Tolerations != nil {
dst.Spec.RedisLeader.Tolerations = src.Spec.RedisLeader.Tolerations
}
if src.Spec.RedisLeader.NodeSelector != nil {
dst.Spec.RedisLeader.NodeSelector = src.Spec.RedisLeader.NodeSelector
}
// RedisFollower
dst.Spec.RedisFollower = RedisFollower{}
if src.Spec.RedisFollower.Replicas != nil {
dst.Spec.RedisFollower.Replicas = src.Spec.RedisFollower.Replicas
}
if src.Spec.RedisFollower.RedisConfig != nil {
dst.Spec.RedisFollower.RedisConfig = src.Spec.RedisFollower.RedisConfig
}
if src.Spec.RedisFollower.Affinity != nil {
dst.Spec.RedisFollower.Affinity = src.Spec.RedisFollower.Affinity
}
if src.Spec.RedisFollower.PodDisruptionBudget != nil {
dst.Spec.RedisFollower.PodDisruptionBudget = src.Spec.RedisFollower.PodDisruptionBudget
}
if src.Spec.RedisFollower.ReadinessProbe != nil {
dst.Spec.RedisFollower.ReadinessProbe = src.Spec.RedisFollower.ReadinessProbe
}
if src.Spec.RedisFollower.LivenessProbe != nil {
dst.Spec.RedisFollower.LivenessProbe = src.Spec.RedisFollower.LivenessProbe
}
if src.Spec.RedisFollower.Tolerations != nil {
dst.Spec.RedisFollower.Tolerations = src.Spec.RedisFollower.Tolerations
}
if src.Spec.RedisFollower.NodeSelector != nil {
dst.Spec.RedisFollower.NodeSelector = src.Spec.RedisFollower.NodeSelector
}
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &RedisExporter{}
dst.Spec.RedisExporter.RedisExporter = src.Spec.RedisExporter.RedisExporter
}
// ClusterStorage(v1beta2) >> Storage(v1beta1)
if src.Spec.Storage != nil {
dst.Spec.Storage = &Storage{}
dst.Spec.Storage.VolumeClaimTemplate = src.Spec.Storage.VolumeClaimTemplate
dst.Spec.Storage.VolumeMount = src.Spec.Storage.VolumeMount
}
// PodSecurityContext >> SecurityContext
if src.Spec.PodSecurityContext != nil {
dst.Spec.SecurityContext = src.Spec.PodSecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Resources
if src.Spec.Resources != nil {
dst.Spec.Resources = src.Spec.Resources
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
// PersistenceEnabled
if src.Spec.PersistenceEnabled != nil {
dst.Spec.PersistenceEnabled = src.Spec.PersistenceEnabled
}
return nil
}

View File

@ -1,96 +0,0 @@
/*
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 v1beta1
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// RedisClusterSpec defines the desired state of RedisCluster
type RedisClusterSpec struct {
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
// +kubebuilder:default:=v7
ClusterVersion *string `json:"clusterVersion,omitempty"`
// +kubebuilder:default:={livenessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}, readinessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}}
RedisLeader RedisLeader `json:"redisLeader,omitempty"`
// +kubebuilder:default:={livenessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}, readinessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}}
RedisFollower RedisFollower `json:"redisFollower,omitempty"`
RedisExporter *RedisExporter `json:"redisExporter,omitempty"`
Storage *Storage `json:"storage,omitempty"`
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
PersistenceEnabled *bool `json:"persistenceEnabled,omitempty"`
}
func (cr *RedisClusterSpec) GetReplicaCounts(t string) int32 {
replica := cr.Size
if t == "leader" && cr.RedisLeader.Replicas != nil {
replica = cr.RedisLeader.Replicas
} else if t == "follower" && cr.RedisFollower.Replicas != nil {
replica = cr.RedisFollower.Replicas
}
return *replica
}
// RedisLeader interface will have the redis leader configuration
type RedisLeader struct {
common.RedisLeader `json:",inline"`
}
// RedisFollower interface will have the redis follower configuration
type RedisFollower struct {
common.RedisFollower `json:",inline"`
}
// RedisClusterStatus defines the observed state of RedisCluster
type RedisClusterStatus struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="ClusterSize",type=integer,JSONPath=`.spec.clusterSize`,description=Current cluster node count
// +kubebuilder:printcolumn:name="LeaderReplicas",type=integer,JSONPath=`.spec.redisLeader.CommonAttributes.Replicas`,description=Overridden Leader replica count
// +kubebuilder:printcolumn:name="FollowerReplicas",type=integer,JSONPath=`.spec.redisFollower.CommonAttributes.Replicas`,description=Overridden Follower replica count
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description=Age of Cluster
// RedisCluster is the Schema for the redisclusters API
type RedisCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisClusterSpec `json:"spec"`
Status RedisClusterStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// RedisClusterList contains a list of RedisCluster
type RedisClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisCluster `json:"items"`
}
func init() {
SchemeBuilder.Register(&RedisCluster{}, &RedisClusterList{})
}

View File

@ -1,164 +0,0 @@
package v1beta1
import (
redisv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
// ConvertTo converts this RedisReplication to the Hub version (vbeta2).
func (src *RedisReplication) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*redisv1beta2.RedisReplication)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Size
dst.Spec.Size = src.Spec.Size
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &redisv1beta2.RedisExporter{}
dst.Spec.RedisExporter.RedisExporter = src.Spec.RedisExporter.RedisExporter
}
// RedisConfig
if src.Spec.RedisConfig != nil {
dst.Spec.RedisConfig = &redisv1beta2.RedisConfig{}
dst.Spec.RedisConfig.RedisConfig = src.Spec.RedisConfig.RedisConfig
}
// Storage
if src.Spec.Storage != nil {
dst.Spec.Storage = &redisv1beta2.Storage{}
dst.Spec.Storage.VolumeClaimTemplate = src.Spec.Storage.VolumeClaimTemplate
dst.Spec.Storage.VolumeMount = src.Spec.Storage.VolumeMount
}
// NodeSelector
if src.Spec.NodeSelector != nil {
dst.Spec.NodeSelector = src.Spec.NodeSelector
}
// SecurityContext >> PodSecurityContext
if src.Spec.SecurityContext != nil {
dst.Spec.PodSecurityContext = src.Spec.SecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Affinity
if src.Spec.Affinity != nil {
dst.Spec.Affinity = src.Spec.Affinity
}
// Tolerations
if src.Spec.Tolerations != nil {
dst.Spec.Tolerations = src.Spec.Tolerations
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &redisv1beta2.TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// ReadinessProbe
if src.Spec.ReadinessProbe != nil {
dst.Spec.ReadinessProbe = &redisv1beta2.Probe{}
dst.Spec.ReadinessProbe.Probe = src.Spec.ReadinessProbe.Probe
}
// LivenessProbe
if src.Spec.LivenessProbe != nil {
dst.Spec.LivenessProbe = &redisv1beta2.Probe{}
dst.Spec.LivenessProbe.Probe = src.Spec.LivenessProbe.Probe
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []redisv1beta2.Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, redisv1beta2.Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
return nil
}
// ConvertFrom converts from the Hub version (vbeta2) to this version.
func (dst *RedisReplication) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*redisv1beta2.RedisReplication)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Size
dst.Spec.Size = src.Spec.Size
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// RedisExporter
if src.Spec.RedisExporter != nil {
dst.Spec.RedisExporter = &RedisExporter{}
dst.Spec.RedisExporter.RedisExporter = src.Spec.RedisExporter.RedisExporter
}
// RedisConfig
if src.Spec.RedisConfig != nil {
dst.Spec.RedisConfig = &RedisConfig{}
dst.Spec.RedisConfig.RedisConfig = src.Spec.RedisConfig.RedisConfig
}
// Storage
if src.Spec.Storage != nil {
dst.Spec.Storage = &Storage{}
dst.Spec.Storage.VolumeClaimTemplate = src.Spec.Storage.VolumeClaimTemplate
dst.Spec.Storage.VolumeMount = src.Spec.Storage.VolumeMount
}
// NodeSelector
if src.Spec.NodeSelector != nil {
dst.Spec.NodeSelector = src.Spec.NodeSelector
}
// PodSecurityContext >> SecurityContext
if src.Spec.PodSecurityContext != nil {
dst.Spec.SecurityContext = src.Spec.PodSecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Affinity
if src.Spec.Affinity != nil {
dst.Spec.Affinity = src.Spec.Affinity
}
// Tolerations
if src.Spec.Tolerations != nil {
dst.Spec.Tolerations = src.Spec.Tolerations
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// ReadinessProbe
if src.Spec.ReadinessProbe != nil {
dst.Spec.ReadinessProbe = &Probe{}
dst.Spec.ReadinessProbe.Probe = src.Spec.ReadinessProbe.Probe
}
// LivenessProbe
if src.Spec.LivenessProbe != nil {
dst.Spec.ReadinessProbe = &Probe{}
dst.Spec.LivenessProbe.Probe = src.Spec.LivenessProbe.Probe
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
return nil
}

View File

@ -1,60 +0,0 @@
package v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type RedisReplicationSpec struct {
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *RedisExporter `json:"redisExporter,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Storage *Storage `json:"storage,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
}
func (cr *RedisReplicationSpec) GetReplicationCounts(t string) int32 {
replica := cr.Size
return *replica
}
// RedisStatus defines the observed state of Redis
type RedisReplicationStatus struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// Redis is the Schema for the redis API
type RedisReplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisReplicationSpec `json:"spec"`
Status RedisReplicationStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisReplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisReplication `json:"items"`
}
func init() {
SchemeBuilder.Register(&RedisReplication{}, &RedisReplicationList{})
}

View File

@ -1,142 +0,0 @@
package v1beta1
import (
redisv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
// ConvertTo converts this RedisSentinel to the Hub version (v1beta2).
func (src *RedisSentinel) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*redisv1beta2.RedisSentinel)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Size
dst.Spec.Size = src.Spec.Size
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// RedisSentinelConfig
if src.Spec.RedisSentinelConfig != nil {
dst.Spec.RedisSentinelConfig = &redisv1beta2.RedisSentinelConfig{}
dst.Spec.RedisSentinelConfig.RedisSentinelConfig = src.Spec.RedisSentinelConfig.RedisSentinelConfig
}
// NodeSelector
if src.Spec.NodeSelector != nil {
dst.Spec.NodeSelector = src.Spec.NodeSelector
}
// SecurityContext >> PodSecurityContext
if src.Spec.SecurityContext != nil {
dst.Spec.PodSecurityContext = src.Spec.SecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Affinity
if src.Spec.Affinity != nil {
dst.Spec.Affinity = src.Spec.Affinity
}
// Tolerations
if src.Spec.Tolerations != nil {
dst.Spec.Tolerations = src.Spec.Tolerations
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &redisv1beta2.TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// ReadinessProbe
if src.Spec.ReadinessProbe != nil {
dst.Spec.ReadinessProbe = &redisv1beta2.Probe{}
dst.Spec.ReadinessProbe.Probe = src.Spec.ReadinessProbe.Probe
}
// LivenessProbe
if src.Spec.LivenessProbe != nil {
dst.Spec.ReadinessProbe = &redisv1beta2.Probe{}
dst.Spec.LivenessProbe.Probe = src.Spec.LivenessProbe.Probe
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []redisv1beta2.Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, redisv1beta2.Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
return nil
}
// ConvertFrom converts from the Hub version (vbeta2) to this version.
func (dst *RedisSentinel) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*redisv1beta2.RedisSentinel)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Size
dst.Spec.Size = src.Spec.Size
// KubernetesConfig
dst.Spec.KubernetesConfig.KubernetesConfig = src.Spec.KubernetesConfig.KubernetesConfig
// RedisSentinelConfig
if src.Spec.RedisSentinelConfig != nil {
dst.Spec.RedisSentinelConfig = &RedisSentinelConfig{}
dst.Spec.RedisSentinelConfig.RedisSentinelConfig = src.Spec.RedisSentinelConfig.RedisSentinelConfig
}
// NodeSelector
if src.Spec.NodeSelector != nil {
dst.Spec.NodeSelector = src.Spec.NodeSelector
}
// PodSecurityContext >> SecurityContext
if src.Spec.PodSecurityContext != nil {
dst.Spec.SecurityContext = src.Spec.PodSecurityContext
}
// PriorityClassName
if src.Spec.PriorityClassName != "" {
dst.Spec.PriorityClassName = src.Spec.PriorityClassName
}
// Affinity
if src.Spec.Affinity != nil {
dst.Spec.Affinity = src.Spec.Affinity
}
// Tolerations
if src.Spec.Tolerations != nil {
dst.Spec.Tolerations = src.Spec.Tolerations
}
// TLS
if src.Spec.TLS != nil {
dst.Spec.TLS = &TLSConfig{}
dst.Spec.TLS.TLSConfig = src.Spec.TLS.TLSConfig
}
// ReadinessProbe
if src.Spec.ReadinessProbe != nil {
dst.Spec.ReadinessProbe = &Probe{}
dst.Spec.ReadinessProbe.Probe = src.Spec.ReadinessProbe.Probe
}
// LivenessProbe
if src.Spec.LivenessProbe != nil {
dst.Spec.ReadinessProbe = &Probe{}
dst.Spec.LivenessProbe.Probe = src.Spec.LivenessProbe.Probe
}
// Sidecars
if src.Spec.Sidecars != nil {
var sidecars []Sidecar
for _, sidecar := range *src.Spec.Sidecars {
sidecars = append(sidecars, Sidecar{
Sidecar: sidecar.Sidecar,
})
}
dst.Spec.Sidecars = &sidecars
}
// ServiceAccountName
if src.Spec.ServiceAccountName != nil {
dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName
}
return nil
}

View File

@ -1,66 +0,0 @@
package v1beta1
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type RedisSentinelSpec struct {
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Default=3
// +kubebuilder:validation:Not=2
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
RedisSentinelConfig *RedisSentinelConfig `json:"redisSentinelConfig,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
PodDisruptionBudget *common.RedisPodDisruptionBudget `json:"pdb,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
}
func (cr *RedisSentinelSpec) GetSentinelCounts(t string) int32 {
replica := cr.Size
return *replica
}
type RedisSentinelConfig struct {
common.RedisSentinelConfig `json:",inline"`
}
type RedisSentinelStatus struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// Redis is the Schema for the redis API
type RedisSentinel struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisSentinelSpec `json:"spec"`
Status RedisSentinelStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisSentinelList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisSentinel `json:"items"`
}
func init() {
SchemeBuilder.Register(&RedisSentinel{}, &RedisSentinelList{})
}

View File

@ -1,880 +0,0 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
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.
*/
// Code generated by controller-gen. DO NOT EDIT.
package v1beta1
import (
"github.com/OT-CONTAINER-KIT/redis-operator/api"
"k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExistingPasswordSecret) DeepCopyInto(out *ExistingPasswordSecret) {
*out = *in
if in.Name != nil {
in, out := &in.Name, &out.Name
*out = new(string)
**out = **in
}
if in.Key != nil {
in, out := &in.Key, &out.Key
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExistingPasswordSecret.
func (in *ExistingPasswordSecret) DeepCopy() *ExistingPasswordSecret {
if in == nil {
return nil
}
out := new(ExistingPasswordSecret)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubernetesConfig) DeepCopyInto(out *KubernetesConfig) {
*out = *in
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesConfig.
func (in *KubernetesConfig) DeepCopy() *KubernetesConfig {
if in == nil {
return nil
}
out := new(KubernetesConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Probe) DeepCopyInto(out *Probe) {
*out = *in
out.Probe = in.Probe
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Probe.
func (in *Probe) DeepCopy() *Probe {
if in == nil {
return nil
}
out := new(Probe)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Redis) DeepCopyInto(out *Redis) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Redis.
func (in *Redis) DeepCopy() *Redis {
if in == nil {
return nil
}
out := new(Redis)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Redis) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisCluster) DeepCopyInto(out *RedisCluster) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisCluster.
func (in *RedisCluster) DeepCopy() *RedisCluster {
if in == nil {
return nil
}
out := new(RedisCluster)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisCluster) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisClusterList) DeepCopyInto(out *RedisClusterList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RedisCluster, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterList.
func (in *RedisClusterList) DeepCopy() *RedisClusterList {
if in == nil {
return nil
}
out := new(RedisClusterList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisClusterList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisClusterSpec) DeepCopyInto(out *RedisClusterSpec) {
*out = *in
if in.Size != nil {
in, out := &in.Size, &out.Size
*out = new(int32)
**out = **in
}
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.ClusterVersion != nil {
in, out := &in.ClusterVersion, &out.ClusterVersion
*out = new(string)
**out = **in
}
in.RedisLeader.DeepCopyInto(&out.RedisLeader)
in.RedisFollower.DeepCopyInto(&out.RedisFollower)
if in.RedisExporter != nil {
in, out := &in.RedisExporter, &out.RedisExporter
*out = new(RedisExporter)
(*in).DeepCopyInto(*out)
}
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(Storage)
(*in).DeepCopyInto(*out)
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(v1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
if in.PersistenceEnabled != nil {
in, out := &in.PersistenceEnabled, &out.PersistenceEnabled
*out = new(bool)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterSpec.
func (in *RedisClusterSpec) DeepCopy() *RedisClusterSpec {
if in == nil {
return nil
}
out := new(RedisClusterSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisClusterStatus) DeepCopyInto(out *RedisClusterStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisClusterStatus.
func (in *RedisClusterStatus) DeepCopy() *RedisClusterStatus {
if in == nil {
return nil
}
out := new(RedisClusterStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisConfig) DeepCopyInto(out *RedisConfig) {
*out = *in
in.RedisConfig.DeepCopyInto(&out.RedisConfig)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisConfig.
func (in *RedisConfig) DeepCopy() *RedisConfig {
if in == nil {
return nil
}
out := new(RedisConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisExporter) DeepCopyInto(out *RedisExporter) {
*out = *in
in.RedisExporter.DeepCopyInto(&out.RedisExporter)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisExporter.
func (in *RedisExporter) DeepCopy() *RedisExporter {
if in == nil {
return nil
}
out := new(RedisExporter)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisFollower) DeepCopyInto(out *RedisFollower) {
*out = *in
in.RedisFollower.DeepCopyInto(&out.RedisFollower)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisFollower.
func (in *RedisFollower) DeepCopy() *RedisFollower {
if in == nil {
return nil
}
out := new(RedisFollower)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisLeader) DeepCopyInto(out *RedisLeader) {
*out = *in
in.RedisLeader.DeepCopyInto(&out.RedisLeader)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisLeader.
func (in *RedisLeader) DeepCopy() *RedisLeader {
if in == nil {
return nil
}
out := new(RedisLeader)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisList) DeepCopyInto(out *RedisList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Redis, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisList.
func (in *RedisList) DeepCopy() *RedisList {
if in == nil {
return nil
}
out := new(RedisList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplication) DeepCopyInto(out *RedisReplication) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplication.
func (in *RedisReplication) DeepCopy() *RedisReplication {
if in == nil {
return nil
}
out := new(RedisReplication)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisReplication) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplicationList) DeepCopyInto(out *RedisReplicationList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RedisReplication, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationList.
func (in *RedisReplicationList) DeepCopy() *RedisReplicationList {
if in == nil {
return nil
}
out := new(RedisReplicationList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisReplicationList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplicationSpec) DeepCopyInto(out *RedisReplicationSpec) {
*out = *in
if in.Size != nil {
in, out := &in.Size, &out.Size
*out = new(int32)
**out = **in
}
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.RedisExporter != nil {
in, out := &in.RedisExporter, &out.RedisExporter
*out = new(RedisExporter)
(*in).DeepCopyInto(*out)
}
if in.RedisConfig != nil {
in, out := &in.RedisConfig, &out.RedisConfig
*out = new(RedisConfig)
(*in).DeepCopyInto(*out)
}
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(Storage)
(*in).DeepCopyInto(*out)
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = new([]v1.Toleration)
if **in != nil {
in, out := *in, *out
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(Probe)
**out = **in
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(Probe)
**out = **in
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationSpec.
func (in *RedisReplicationSpec) DeepCopy() *RedisReplicationSpec {
if in == nil {
return nil
}
out := new(RedisReplicationSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisReplicationStatus) DeepCopyInto(out *RedisReplicationStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisReplicationStatus.
func (in *RedisReplicationStatus) DeepCopy() *RedisReplicationStatus {
if in == nil {
return nil
}
out := new(RedisReplicationStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinel) DeepCopyInto(out *RedisSentinel) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinel.
func (in *RedisSentinel) DeepCopy() *RedisSentinel {
if in == nil {
return nil
}
out := new(RedisSentinel)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisSentinel) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelConfig) DeepCopyInto(out *RedisSentinelConfig) {
*out = *in
in.RedisSentinelConfig.DeepCopyInto(&out.RedisSentinelConfig)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelConfig.
func (in *RedisSentinelConfig) DeepCopy() *RedisSentinelConfig {
if in == nil {
return nil
}
out := new(RedisSentinelConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelList) DeepCopyInto(out *RedisSentinelList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RedisSentinel, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelList.
func (in *RedisSentinelList) DeepCopy() *RedisSentinelList {
if in == nil {
return nil
}
out := new(RedisSentinelList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RedisSentinelList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelSpec) DeepCopyInto(out *RedisSentinelSpec) {
*out = *in
if in.Size != nil {
in, out := &in.Size, &out.Size
*out = new(int32)
**out = **in
}
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.RedisSentinelConfig != nil {
in, out := &in.RedisSentinelConfig, &out.RedisSentinelConfig
*out = new(RedisSentinelConfig)
(*in).DeepCopyInto(*out)
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = new([]v1.Toleration)
if **in != nil {
in, out := *in, *out
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.PodDisruptionBudget != nil {
in, out := &in.PodDisruptionBudget, &out.PodDisruptionBudget
*out = new(api.RedisPodDisruptionBudget)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(Probe)
**out = **in
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(Probe)
**out = **in
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelSpec.
func (in *RedisSentinelSpec) DeepCopy() *RedisSentinelSpec {
if in == nil {
return nil
}
out := new(RedisSentinelSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSentinelStatus) DeepCopyInto(out *RedisSentinelStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSentinelStatus.
func (in *RedisSentinelStatus) DeepCopy() *RedisSentinelStatus {
if in == nil {
return nil
}
out := new(RedisSentinelStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisSpec) DeepCopyInto(out *RedisSpec) {
*out = *in
in.KubernetesConfig.DeepCopyInto(&out.KubernetesConfig)
if in.RedisExporter != nil {
in, out := &in.RedisExporter, &out.RedisExporter
*out = new(RedisExporter)
(*in).DeepCopyInto(*out)
}
if in.RedisConfig != nil {
in, out := &in.RedisConfig, &out.RedisConfig
*out = new(RedisConfig)
(*in).DeepCopyInto(*out)
}
if in.Storage != nil {
in, out := &in.Storage, &out.Storage
*out = new(Storage)
(*in).DeepCopyInto(*out)
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(v1.PodSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = new([]v1.Toleration)
if **in != nil {
in, out := *in, *out
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(Probe)
**out = **in
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(Probe)
**out = **in
}
if in.Sidecars != nil {
in, out := &in.Sidecars, &out.Sidecars
*out = new([]Sidecar)
if **in != nil {
in, out := *in, *out
*out = make([]Sidecar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisSpec.
func (in *RedisSpec) DeepCopy() *RedisSpec {
if in == nil {
return nil
}
out := new(RedisSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RedisStatus) DeepCopyInto(out *RedisStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisStatus.
func (in *RedisStatus) DeepCopy() *RedisStatus {
if in == nil {
return nil
}
out := new(RedisStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceConfig) DeepCopyInto(out *ServiceConfig) {
*out = *in
if in.ServiceAnnotations != nil {
in, out := &in.ServiceAnnotations, &out.ServiceAnnotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceConfig.
func (in *ServiceConfig) DeepCopy() *ServiceConfig {
if in == nil {
return nil
}
out := new(ServiceConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Sidecar) DeepCopyInto(out *Sidecar) {
*out = *in
in.Sidecar.DeepCopyInto(&out.Sidecar)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sidecar.
func (in *Sidecar) DeepCopy() *Sidecar {
if in == nil {
return nil
}
out := new(Sidecar)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Storage) DeepCopyInto(out *Storage) {
*out = *in
in.Storage.DeepCopyInto(&out.Storage)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Storage.
func (in *Storage) DeepCopy() *Storage {
if in == nil {
return nil
}
out := new(Storage)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TLSConfig) DeepCopyInto(out *TLSConfig) {
*out = *in
in.TLSConfig.DeepCopyInto(&out.TLSConfig)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfig.
func (in *TLSConfig) DeepCopy() *TLSConfig {
if in == nil {
return nil
}
out := new(TLSConfig)
in.DeepCopyInto(out)
return out
}

View File

@ -1,96 +0,0 @@
/*
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
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api"
corev1 "k8s.io/api/core/v1"
)
// KubernetesConfig will be the JSON struct for Basic Redis Config
type KubernetesConfig struct {
common.KubernetesConfig `json:",inline"`
}
// ServiceConfig define the type of service to be created and its annotations
type ServiceConfig struct {
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
ServiceType string `json:"serviceType,omitempty"`
ServiceAnnotations map[string]string `json:"annotations,omitempty"`
}
// RedisConfig defines the external configuration of Redis
type RedisConfig struct {
common.RedisConfig `json:",inline"`
}
// ExistingPasswordSecret is the struct to access the existing secret
type ExistingPasswordSecret struct {
Name *string `json:"name,omitempty"`
Key *string `json:"key,omitempty"`
}
// Storage is the inteface to add pvc and pv support in redis
type Storage struct {
common.Storage `json:",inline"`
}
// Node-conf needs to be added only in redis cluster
type ClusterStorage struct {
// +kubebuilder:default=false
NodeConfVolume bool `json:"nodeConfVolume,omitempty"`
NodeConfVolumeClaimTemplate corev1.PersistentVolumeClaim `json:"nodeConfVolumeClaimTemplate,omitempty"`
common.Storage `json:",inline"`
}
// RedisExporter interface will have the information for redis exporter related stuff
type RedisExporter struct {
common.RedisExporter `json:",inline"`
}
// TLS Configuration for redis instances
type TLSConfig struct {
common.TLSConfig `json:",inline"`
}
type ACLConfig struct {
Secret *corev1.SecretVolumeSource `json:"secret,omitempty"`
}
// Probe is a interface for ReadinessProbe and LivenessProbe
type Probe struct {
common.Probe `json:",inline"`
}
// Sidecar for each Redis pods
type Sidecar struct {
common.Sidecar `json:",inline"`
Volumes *[]corev1.VolumeMount `json:"mountPath,omitempty"`
Command []string `json:"command,omitempty" protobuf:"bytes,3,rep,name=command"`
Ports *[]corev1.ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"`
}
// InitContainer for each Redis pods
type InitContainer struct {
Enabled *bool `json:"enabled,omitempty"`
Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
Command []string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
}

View File

@ -1,80 +0,0 @@
/*
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
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// RedisSpec defines the desired state of Redis
type RedisSpec struct {
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *RedisExporter `json:"redisExporter,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Storage *Storage `json:"storage,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
ACL *ACLConfig `json:"acl,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
InitContainer *InitContainer `json:"initContainer,omitempty"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
}
// RedisStatus defines the observed state of Redis
type RedisStatus struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// Redis is the Schema for the redis API
type Redis struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisSpec `json:"spec"`
Status RedisStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Redis `json:"items"`
}
func init() {
SchemeBuilder.Register(&Redis{}, &RedisList{})
}

View File

@ -1,115 +0,0 @@
/*
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
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api"
status "github.com/OT-CONTAINER-KIT/redis-operator/api/status"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// RedisClusterSpec defines the desired state of RedisCluster
type RedisClusterSpec struct {
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
// +kubebuilder:default:=v7
ClusterVersion *string `json:"clusterVersion,omitempty"`
// +kubebuilder:default:={livenessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}, readinessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}}
RedisLeader RedisLeader `json:"redisLeader,omitempty"`
// +kubebuilder:default:={livenessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}, readinessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}}
RedisFollower RedisFollower `json:"redisFollower,omitempty"`
RedisExporter *RedisExporter `json:"redisExporter,omitempty"`
Storage *ClusterStorage `json:"storage,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
ACL *ACLConfig `json:"acl,omitempty"`
InitContainer *InitContainer `json:"initContainer,omitempty"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
PersistenceEnabled *bool `json:"persistenceEnabled,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
}
func (cr *RedisClusterSpec) GetReplicaCounts(t string) int32 {
replica := cr.Size
if t == "leader" && cr.RedisLeader.Replicas != nil {
replica = cr.RedisLeader.Replicas
} else if t == "follower" && cr.RedisFollower.Replicas != nil {
replica = cr.RedisFollower.Replicas
}
return *replica
}
// RedisLeader interface will have the redis leader configuration
type RedisLeader struct {
common.RedisLeader `json:",inline"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
}
// RedisFollower interface will have the redis follower configuration
type RedisFollower struct {
common.RedisFollower `json:",inline"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
}
// RedisClusterStatus defines the observed state of RedisCluster
// +kubebuilder:subresource:status
type RedisClusterStatus struct {
State status.RedisClusterState `json:"state,omitempty"`
Reason string `json:"reason,omitempty"`
// +kubebuilder:default=0
ReadyLeaderReplicas int32 `json:"readyLeaderReplicas,omitempty"`
// +kubebuilder:default=0
ReadyFollowerReplicas int32 `json:"readyFollowerReplicas,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="ClusterSize",type=integer,JSONPath=`.spec.clusterSize`,description=Current cluster node count
// +kubebuilder:printcolumn:name="ReadyLeaderReplicas",type="integer",JSONPath=".status.readyLeaderReplicas",description="Number of ready leader replicas"
// +kubebuilder:printcolumn:name="ReadyFollowerReplicas",type="integer",JSONPath=".status.readyFollowerReplicas",description="Number of ready follower replicas"
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="The current state of the Redis Cluster",priority=1
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of Cluster",priority=1
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.reason",description="The reason for the current state",priority=1
// RedisCluster is the Schema for the redisclusters API
type RedisCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisClusterSpec `json:"spec"`
Status RedisClusterStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// RedisClusterList contains a list of RedisCluster
type RedisClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisCluster `json:"items"`
}
func init() {
SchemeBuilder.Register(&RedisCluster{}, &RedisClusterList{})
}

View File

@ -1,66 +0,0 @@
package v1beta2
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type RedisReplicationSpec struct {
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *RedisExporter `json:"redisExporter,omitempty"`
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Storage *Storage `json:"storage,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
ACL *ACLConfig `json:"acl,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
InitContainer *InitContainer `json:"initContainer,omitempty"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
}
func (cr *RedisReplicationSpec) GetReplicationCounts(t string) int32 {
replica := cr.Size
return *replica
}
// RedisStatus defines the observed state of Redis
type RedisReplicationStatus struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// Redis is the Schema for the redis API
type RedisReplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisReplicationSpec `json:"spec"`
Status RedisReplicationStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisReplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisReplication `json:"items"`
}
func init() {
SchemeBuilder.Register(&RedisReplication{}, &RedisReplicationList{})
}

View File

@ -1,71 +0,0 @@
package v1beta2
import (
common "github.com/OT-CONTAINER-KIT/redis-operator/api"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type RedisSentinelSpec struct {
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=3
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
RedisExporter *RedisExporter `json:"redisExporter,omitempty"`
RedisSentinelConfig *RedisSentinelConfig `json:"redisSentinelConfig,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
PriorityClassName string `json:"priorityClassName,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"`
TLS *TLSConfig `json:"TLS,omitempty"`
PodDisruptionBudget *common.RedisPodDisruptionBudget `json:"pdb,omitempty"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
InitContainer *InitContainer `json:"initContainer,omitempty"`
Sidecars *[]Sidecar `json:"sidecars,omitempty"`
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
}
func (cr *RedisSentinelSpec) GetSentinelCounts(t string) int32 {
replica := cr.Size
return *replica
}
type RedisSentinelConfig struct {
common.RedisSentinelConfig `json:",inline"`
}
type RedisSentinelStatus struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
//+kubebuilder:storageversion
// Redis is the Schema for the redis API
type RedisSentinel struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RedisSentinelSpec `json:"spec"`
Status RedisSentinelStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// RedisList contains a list of Redis
type RedisSentinelList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RedisSentinel `json:"items"`
}
func init() {
SchemeBuilder.Register(&RedisSentinel{}, &RedisSentinelList{})
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
apiVersion: v2
name: redis-cluster
description: Provides easy redis setup definitions for Kubernetes services, and deployment.
version: 0.17.0
appVersion: "0.17.0"
home: https://github.com/ot-container-kit/redis-operator
sources:
- https://github.com/ot-container-kit/redis-operator
maintainers:
- name: iamabhishek-dubey
- name: sandy724
- name: shubham-cmyk
keywords:
- operator
- redis
- opstree
- kubernetes
- openshift
- redis-exporter
icon: https://github.com/OT-CONTAINER-KIT/redis-operator/raw/main/static/redis-operator-logo.svg
type: application

View File

@ -0,0 +1,132 @@
# redis
Redis is a key-value based distributed database, this helm chart is for redis cluster setup. This helm chart needs [Redis Operator](../redis-operator) inside Kubernetes cluster. The redis cluster definition can be modified or changed by [values.yaml](./values.yaml).
**Homepage:** <https://github.com/ot-container-kit/redis-operator>
## Maintainers
| Name | Email | Url |
| ---- | ------ | --- |
| iamabhishek-dubey | | |
| sandy724 | | |
| shubham-cmyk | | |
## Pre-Requisities
- Kubernetes 1.15+
- Helm 3.X
- Redis Operator 0.7.0
## Source Code
* <https://github.com/ot-container-kit/redis-operator>
```shell
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
helm install <my-release> ot-helm/redis-cluster \
--set redisCluster.clusterSize=3 --namespace <namespace>
```
Redis setup can be upgraded by using `helm upgrade` command:-
```shell
helm upgrade <my-release> ot-helm/redis-cluster --install \
--set redisCluster.clusterSize=5 --namespace <namespace>
```
For uninstalling the chart:-
```shell
helm delete <my-release> --namespace <namespace>
```
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| TLS.ca | string | `"ca.key"` | |
| TLS.cert | string | `"tls.crt"` | |
| TLS.key | string | `"tls.key"` | |
| TLS.secret.secretName | string | `""` | |
| acl.secret.secretName | string | `""` | |
| env | list | `[]` | |
| externalConfig.data | string | `"tcp-keepalive 400\nslowlog-max-len 158\nstream-node-max-bytes 2048\n"` | |
| externalConfig.enabled | bool | `false` | |
| externalService.enabled | bool | `false` | |
| externalService.port | int | `6379` | |
| externalService.serviceType | string | `"LoadBalancer"` | |
| initContainer.args | list | `[]` | |
| initContainer.command | list | `[]` | |
| initContainer.enabled | bool | `false` | |
| initContainer.env | list | `[]` | |
| initContainer.image | string | `""` | |
| initContainer.imagePullPolicy | string | `"IfNotPresent"` | |
| initContainer.resources | object | `{}` | |
| labels | object | `{}` | |
| podSecurityContext.fsGroup | int | `1000` | |
| podSecurityContext.runAsUser | int | `1000` | |
| priorityClassName | string | `""` | |
| redisCluster.clusterSize | int | `3` | Default number of replicas for both leader and follower when not explicitly set |
| redisCluster.clusterVersion | string | `"v7"` | |
| redisCluster.enableMasterSlaveAntiAffinity | bool | `false` | Enable pod anti-affinity between leader and follower pods by adding the appropriate label. Notice that this requires the operator to have its mutating webhook enabled, otherwise it will only add an annotation to the RedisCluster CR. Default is false. |
| redisCluster.follower.affinity | string | `nil` | |
| redisCluster.follower.livenessProbe | object | `{}` | |
| redisCluster.follower.nodeSelector | string | `nil` | |
| redisCluster.follower.pdb.enabled | bool | `false` | |
| redisCluster.follower.pdb.maxUnavailable | int | `1` | |
| redisCluster.follower.pdb.minAvailable | int | `1` | |
| redisCluster.follower.readinessProbe | object | `{}` | |
| redisCluster.follower.replicas | int | `3` | Number of Redis follower (slave) nodes. If not set, uses clusterSize value |
| redisCluster.follower.securityContext | object | `{}` | |
| redisCluster.follower.serviceType | string | `"ClusterIP"` | |
| redisCluster.follower.tolerations | list | `[]` | |
| redisCluster.image | string | `"quay.io/opstree/redis"` | |
| redisCluster.imagePullPolicy | string | `"IfNotPresent"` | |
| redisCluster.imagePullSecrets | object | `{}` | |
| redisCluster.leader.affinity | object | `{}` | |
| redisCluster.leader.livenessProbe | object | `{}` | |
| redisCluster.leader.nodeSelector | string | `nil` | |
| redisCluster.leader.pdb.enabled | bool | `false` | |
| redisCluster.leader.pdb.maxUnavailable | int | `1` | |
| redisCluster.leader.pdb.minAvailable | int | `1` | |
| redisCluster.leader.readinessProbe | object | `{}` | |
| redisCluster.leader.replicas | int | `3` | Number of Redis leader (master) nodes. If not set, uses clusterSize value |
| redisCluster.leader.securityContext | object | `{}` | |
| redisCluster.leader.serviceType | string | `"ClusterIP"` | |
| redisCluster.leader.tolerations | list | `[]` | |
| redisCluster.minReadySeconds | int | `0` | |
| redisCluster.name | string | `""` | |
| redisCluster.persistenceEnabled | bool | `true` | |
| redisCluster.recreateStatefulSetOnUpdateInvalid | bool | `false` | Some fields of statefulset are immutable, such as volumeClaimTemplates. When set to true, the operator will delete the statefulset and recreate it. Default is false. |
| redisCluster.redisSecret.secretKey | string | `""` | |
| redisCluster.redisSecret.secretName | string | `""` | |
| redisCluster.resources | object | `{}` | |
| redisCluster.tag | string | `"v7.0.15"` | |
| redisExporter.enabled | bool | `false` | |
| redisExporter.env | list | `[]` | |
| redisExporter.image | string | `"quay.io/opstree/redis-exporter"` | |
| redisExporter.imagePullPolicy | string | `"IfNotPresent"` | |
| redisExporter.resources | object | `{}` | |
| redisExporter.securityContext | object | `{}` | |
| redisExporter.tag | string | `"v1.44.0"` | |
| serviceAccountName | string | `""` | |
| serviceMonitor.enabled | bool | `false` | |
| serviceMonitor.extraLabels | object | `{}` | extraLabels are added to the servicemonitor when enabled set to true |
| serviceMonitor.interval | string | `"30s"` | |
| serviceMonitor.namespace | string | `"monitoring"` | |
| serviceMonitor.scrapeTimeout | string | `"10s"` | |
| sidecars.env | object | `{}` | |
| sidecars.image | string | `""` | |
| sidecars.imagePullPolicy | string | `"IfNotPresent"` | |
| sidecars.name | string | `""` | |
| sidecars.resources.limits.cpu | string | `"100m"` | |
| sidecars.resources.limits.memory | string | `"128Mi"` | |
| sidecars.resources.requests.cpu | string | `"50m"` | |
| sidecars.resources.requests.memory | string | `"64Mi"` | |
| storageSpec.nodeConfVolume | bool | `true` | |
| storageSpec.nodeConfVolumeClaimTemplate.spec.accessModes[0] | string | `"ReadWriteOnce"` | |
| storageSpec.nodeConfVolumeClaimTemplate.spec.resources.requests.storage | string | `"1Gi"` | |
| storageSpec.volumeClaimTemplate.spec.accessModes[0] | string | `"ReadWriteOnce"` | |
| storageSpec.volumeClaimTemplate.spec.resources.requests.storage | string | `"1Gi"` | |

View File

@ -0,0 +1,45 @@
# redis
Redis is a key-value based distributed database, this helm chart is for redis cluster setup. This helm chart needs [Redis Operator](../redis-operator) inside Kubernetes cluster. The redis cluster definition can be modified or changed by [values.yaml](./values.yaml).
**Homepage:** <https://github.com/ot-container-kit/redis-operator>
## Maintainers
| Name | Email | Url |
| ---- | ------ | --- |
| iamabhishek-dubey | | |
| sandy724 | | |
| shubham-cmyk | | |
## Pre-Requisities
- Kubernetes 1.15+
- Helm 3.X
- Redis Operator 0.7.0
## Source Code
* <https://github.com/ot-container-kit/redis-operator>
```shell
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
helm install <my-release> ot-helm/redis-cluster \
--set redisCluster.clusterSize=3 --namespace <namespace>
```
Redis setup can be upgraded by using `helm upgrade` command:-
```shell
helm upgrade <my-release> ot-helm/redis-cluster --install \
--set redisCluster.clusterSize=5 --namespace <namespace>
```
For uninstalling the chart:-
```shell
helm delete <my-release> --namespace <namespace>
```
{{ template "chart.valuesSection" . }}

View File

@ -0,0 +1,99 @@
{{/* vim: set filetype=mustache: */}}
{{/* Define common labels */}}
{{- define "common.labels" -}}
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- if .Values.labels }}
{{- range $labelkey, $labelvalue := .Values.labels }}
{{ $labelkey}}: {{ $labelvalue }}
{{- end }}
{{- end }}
{{- end -}}
{{/* Helper for Redis Cluster (leader & follower) */}}
{{- define "redis.role" -}}
{{- if .affinity }}
affinity:
{{- toYaml .affinity | nindent 2 }}
{{- end }}
{{- if .tolerations }}
tolerations:
{{- toYaml .tolerations | nindent 2 }}
{{- end }}
{{- if .pdb.enabled }}
pdb:
enabled: {{ .pdb.enabled }}
maxUnavailable: {{ .pdb.maxUnavailable }}
minAvailable: {{ .pdb.minAvailable }}
{{- end }}
{{- if .nodeSelector }}
nodeSelector:
{{- toYaml .nodeSelector | nindent 2 }}
{{- end }}
{{- if .securityContext }}
securityContext:
{{- toYaml .securityContext | nindent 2 }}
{{- end }}
{{- if .livenessProbe }}
livenessProbe:
{{- toYaml .livenessProbe | nindent 2 }}
{{- end }}
{{- if .readinessProbe }}
readinessProbe:
{{- toYaml .readinessProbe | nindent 2 }}
{{- end }}
{{- end -}}
{{/* Generate sidecar properties */}}
{{- define "sidecar.properties" -}}
{{- with .Values.sidecars }}
name: {{ .name }}
image: {{ .image }}
{{- if .imagePullPolicy }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- end }}
{{- if .resources }}
resources:
{{ toYaml .resources | nindent 2 }}
{{- end }}
{{- if .env }}
env:
{{ toYaml .env | nindent 2 }}
{{- end }}
{{- end }}
{{- end -}}
{{/* Generate init container properties */}}
{{- define "initContainer.properties" -}}
{{- with .Values.initContainer }}
{{- if .enabled }}
enabled: {{ .enabled }}
image: {{ .image }}
{{- if .imagePullPolicy }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- end }}
{{- if .resources }}
resources:
{{ toYaml .resources | nindent 2 }}
{{- end }}
{{- if .env }}
env:
{{ toYaml .env | nindent 2 }}
{{- end }}
{{- if .command }}
command:
{{ toYaml .command | nindent 2 }}
{{- end }}
{{- if .args }}
args:
{{ toYaml .args | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

View File

@ -0,0 +1,17 @@
{{- if eq .Values.externalConfig.enabled true }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.redisCluster.name | default .Release.Name }}-ext-config
labels:
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
data:
redis-additional.conf: |
{{ .Values.externalConfig.data | nindent 4 }}
{{- end }}

View File

@ -0,0 +1,29 @@
{{- if and (gt (int .Values.redisCluster.follower.replicas) 0) (eq .Values.externalService.enabled true) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.redisCluster.name | default .Release.Name }}-follower-external-service
{{- if .Values.externalService.annotations }}
annotations:
{{ toYaml .Values.externalService.annotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
spec:
type: {{ .Values.externalService.serviceType }}
selector:
app: {{ .Values.redisCluster.name | default .Release.Name }}-follower
redis_setup_type: cluster
role: follower
ports:
- protocol: TCP
port: {{ .Values.externalService.port }}
targetPort: 6379
name: client
{{- end }}

View File

@ -0,0 +1,30 @@
{{- if and (eq .Values.serviceMonitor.enabled true) (gt (int .Values.redisCluster.follower.replicas) 0) }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Values.redisCluster.name | default .Release.Name }}-follower-prometheus-monitoring
labels:
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- with .Values.serviceMonitor.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: {{ .Values.redisCluster.name | default .Release.Name }}-follower
redis_setup_type: cluster
role: follower
endpoints:
- port: redis-exporter
interval: {{ .Values.serviceMonitor.interval }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
namespaceSelector:
matchNames:
- {{ .Values.serviceMonitor.namespace }}
{{- end }}

View File

@ -0,0 +1,29 @@
{{- if and (gt (int .Values.redisCluster.leader.replicas) 0) (eq .Values.externalService.enabled true) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.redisCluster.name | default .Release.Name }}-leader-external-service
{{- if .Values.externalService.annotations }}
annotations:
{{ toYaml .Values.externalService.annotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
spec:
type: {{ .Values.externalService.serviceType }}
selector:
app: {{ .Values.redisCluster.name | default .Release.Name }}-leader
redis_setup_type: cluster
role: leader
ports:
- protocol: TCP
port: {{ .Values.externalService.port }}
targetPort: 6379
name: client
{{- end }}

View File

@ -0,0 +1,30 @@
{{- if and (eq .Values.serviceMonitor.enabled true) (gt (int .Values.redisCluster.leader.replicas) 0) }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Values.redisCluster.name | default .Release.Name }}-leader-prometheus-monitoring
labels:
app.kubernetes.io/name: {{ .Values.redisCluster.name | default .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Values.redisCluster.name | default .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: middleware
{{- with .Values.serviceMonitor.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: {{ .Values.redisCluster.name | default .Release.Name }}-leader
redis_setup_type: cluster
role: leader
endpoints:
- port: redis-exporter
interval: {{ .Values.serviceMonitor.interval }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
namespaceSelector:
matchNames:
- {{ .Values.serviceMonitor.namespace }}
{{- end }}

View File

@ -0,0 +1,97 @@
---
apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisCluster
metadata:
name: {{ .Values.redisCluster.name | default .Release.Name }}
labels: {{- include "common.labels" . | nindent 4 }}
annotations:
{{ if .Values.redisCluster.recreateStatefulSetOnUpdateInvalid }}
redis.opstreelabs.in/recreate-statefulset: "true"
{{ end }}
{{- if .Values.redisCluster.enableMasterSlaveAntiAffinity }}
redisclusters.redis.redis.opstreelabs.in/role-anti-affinity: "true"
{{- end }}
spec:
clusterSize: {{ .Values.redisCluster.clusterSize }}
persistenceEnabled: {{ .Values.redisCluster.persistenceEnabled }}
clusterVersion: {{ .Values.redisCluster.clusterVersion }}
redisLeader: {{- include "redis.role" .Values.redisCluster.leader | nindent 4 }}
replicas: {{ .Values.redisCluster.leader.replicas }}
{{- if .Values.externalConfig.enabled }}
redisConfig:
additionalRedisConfig: "{{ .Values.redisCluster.name | default .Release.Name }}-ext-config"
{{- end }}
redisFollower: {{- include "redis.role" .Values.redisCluster.follower | nindent 4 }}
replicas: {{ .Values.redisCluster.follower.replicas }}
{{- if .Values.externalConfig.enabled }}
redisConfig:
additionalRedisConfig: "{{ .Values.redisCluster.name | default .Release.Name }}-ext-config"
{{- end }}
redisExporter:
enabled: {{ .Values.redisExporter.enabled }}
image: "{{ .Values.redisExporter.image }}:{{ .Values.redisExporter.tag }}"
imagePullPolicy: "{{ .Values.redisExporter.imagePullPolicy }}"
{{- if .Values.redisExporter.resources}}
resources: {{ toYaml .Values.redisExporter.resources | nindent 6 }}
{{- end }}
{{- if .Values.redisExporter.env }}
env: {{ toYaml .Values.redisExporter.env | nindent 6 }}
{{- end }}
{{- if .Values.redisExporter.securityContext}}
securityContext: {{ toYaml .Values.redisExporter.securityContext | nindent 6 }}
{{- end }}
kubernetesConfig:
image: "{{ .Values.redisCluster.image }}:{{ .Values.redisCluster.tag }}"
imagePullPolicy: "{{ .Values.redisCluster.imagePullPolicy }}"
{{- if .Values.redisCluster.imagePullSecrets}}
imagePullSecrets: {{ toYaml .Values.redisCluster.imagePullSecrets | nindent 4 }}
{{- end }}
{{- if .Values.redisCluster.resources}}
resources: {{ toYaml .Values.redisCluster.resources | nindent 6 }}
{{- end }}
{{- if and .Values.redisCluster.redisSecret.secretName .Values.redisCluster.redisSecret.secretKey }}
redisSecret:
name: {{ .Values.redisCluster.redisSecret.secretName | quote }}
key: {{ .Values.redisCluster.redisSecret.secretKey | quote }}
{{- end }}
{{- if .Values.redisCluster.minReadySeconds }}
minReadySeconds: {{ .Values.redisCluster.minReadySeconds}}
{{- end }}
{{- if .Values.storageSpec }}
storage: {{ toYaml .Values.storageSpec | nindent 4 }}
{{- end }}
{{- if and .Values.priorityClassName (ne .Values.priorityClassName "") }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.podSecurityContext }}
podSecurityContext: {{ toYaml .Values.podSecurityContext | nindent 4 }}
{{- end }}
{{- if and .Values.TLS.ca .Values.TLS.cert .Values.TLS.key .Values.TLS.secret.secretName }}
TLS:
ca: {{ .Values.TLS.ca | quote }}
cert: {{ .Values.TLS.cert | quote }}
key: {{ .Values.TLS.key | quote }}
secret:
secretName: {{ .Values.TLS.secret.secretName | quote }}
{{- end }}
{{- if and .Values.acl.secret (ne .Values.acl.secret.secretName "") }}
acl:
secret:
secretName: {{ .Values.acl.secret.secretName | quote }}
{{- end }}
{{- if and .Values.sidecars (ne .Values.sidecars.name "") (ne .Values.sidecars.image "") }}
sidecars: {{ include "sidecar.properties" . | nindent 4 }}
{{- end }}
{{- if and .Values.initContainer .Values.initContainer.enabled (ne .Values.initContainer.image "") }}
initContainer: {{ include "initContainer.properties" . | nindent 4 }}
{{- end }}
{{- if .Values.env }}
env: {{ toYaml .Values.env | nindent 4 }}
{{- end }}
{{- if and .Values.serviceAccountName (ne .Values.serviceAccountName "") }}
serviceAccountName: "{{ .Values.serviceAccountName }}"
{{- end }}

View File

@ -0,0 +1,224 @@
---
redisCluster:
name: ""
# -- Default number of replicas for both leader and follower when not explicitly set
clusterSize: 3
clusterVersion: v7
persistenceEnabled: true
image: quay.io/opstree/redis
tag: v7.0.15
imagePullPolicy: IfNotPresent
imagePullSecrets: {}
# - name: Secret with Registry credentials
redisSecret:
secretName: ""
secretKey: ""
resources: {}
# requests:
# cpu: 100m
# memory: 128Mi
# limits:
# cpu: 100m
# memory: 128Mi
minReadySeconds: 0
# -- Some fields of statefulset are immutable, such as volumeClaimTemplates.
# When set to true, the operator will delete the statefulset and recreate it. Default is false.
recreateStatefulSetOnUpdateInvalid: false
# -- Enable pod anti-affinity between leader and follower pods by adding the appropriate label.
# Notice that this requires the operator to have its mutating webhook enabled,
# otherwise it will only add an annotation to the RedisCluster CR. Default is false.
enableMasterSlaveAntiAffinity: false
leader:
# -- Number of Redis leader (master) nodes. If not set, uses clusterSize value
replicas: 3
serviceType: ClusterIP
affinity: {}
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: disktype
# operator: In
# values:
# - ssd
tolerations: []
# - key: "key"
# operator: "Equal"
# value: "value"
# effect: "NoSchedule"
nodeSelector: null
# memory: medium
securityContext: {}
pdb:
enabled: false
maxUnavailable: 1
minAvailable: 1
livenessProbe: {}
# timeoutSeconds: 30
# periodSeconds: 45
# successThreshold: 1
# failureThreshold: 4
# initialDelaySeconds: 15
readinessProbe: {}
# timeoutSeconds: 30
# periodSeconds: 45
# successThreshold: 1
# failureThreshold: 4
# initialDelaySeconds: 15
follower:
# -- Number of Redis follower (slave) nodes. If not set, uses clusterSize value
replicas: 3
serviceType: ClusterIP
affinity: null
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: disktype
# operator: In
# values:
# - ssd
tolerations: []
# - key: "key"
# operator: "Equal"
# value: "value"
# effect: "NoSchedule"
nodeSelector: null
# memory: medium
securityContext: {}
pdb:
enabled: false
maxUnavailable: 1
minAvailable: 1
livenessProbe: {}
# timeoutSeconds: 30
# periodSeconds: 45
# successThreshold: 1
# failureThreshold: 4
# initialDelaySeconds: 15
readinessProbe: {}
# timeoutSeconds: 30
# periodSeconds: 45
# successThreshold: 1
# failureThreshold: 4
# initialDelaySeconds: 15
labels: {}
# foo: bar
# test: echo
externalConfig:
enabled: false
data: |
tcp-keepalive 400
slowlog-max-len 158
stream-node-max-bytes 2048
externalService:
enabled: false
# annotations:
# foo: bar
serviceType: LoadBalancer
port: 6379
serviceMonitor:
enabled: false
interval: 30s
scrapeTimeout: 10s
namespace: monitoring
# -- extraLabels are added to the servicemonitor when enabled set to true
extraLabels: {}
# foo: bar
# team: devops
redisExporter:
enabled: false
image: quay.io/opstree/redis-exporter
tag: "v1.44.0"
imagePullPolicy: IfNotPresent
resources: {}
# requests:
# cpu: 100m
# memory: 128Mi
# limits:
# cpu: 100m
# memory: 128Mi
env: []
# - name: VAR_NAME
# value: "value1"
securityContext: {}
sidecars:
name: ""
image: ""
imagePullPolicy: "IfNotPresent"
resources:
limits:
cpu: "100m"
memory: "128Mi"
requests:
cpu: "50m"
memory: "64Mi"
env: {}
# - name: MY_ENV_VAR
# value: "my-env-var-value"
initContainer:
enabled: false
image: ""
imagePullPolicy: "IfNotPresent"
resources: {}
# requests:
# memory: "64Mi"
# cpu: "250m"
# limits:
# memory: "128Mi"
# cpu: "500m"
env: []
command: []
args: []
priorityClassName: ""
storageSpec:
volumeClaimTemplate:
spec:
# storageClassName: standard
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi
nodeConfVolume: true
nodeConfVolumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi
# selector: {}
podSecurityContext:
runAsUser: 1000
fsGroup: 1000
# serviceAccountName: redis-sa
TLS:
ca: ca.key
cert: tls.crt
key: tls.key
secret:
secretName: ""
acl:
secret:
secretName: ""
env: []
# - name: VAR_NAME
# value: "value1"
serviceAccountName: ""

1
charts/redis-operator/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.tgz

View File

@ -0,0 +1,22 @@
---
apiVersion: v2
version: 0.21.2
appVersion: "0.21.0"
description: Provides easy redis setup definitions for Kubernetes services, and deployment.
engine: gotpl
maintainers:
- name: iamabhishek-dubey
- name: sandy724
- name: shubham-cmyk
name: redis-operator
sources:
- https://github.com/OT-CONTAINER-KIT/redis-operator
home: https://github.com/OT-CONTAINER-KIT/redis-operator
icon: https://github.com/OT-CONTAINER-KIT/redis-operator/raw/main/static/redis-operator-logo.svg
keywords:
- operator
- redis
- opstree
- kubernetes
- openshift

View File

@ -0,0 +1,138 @@
# redis
This Helm chart deploys the redis-operator into your Kubernetes cluster. The operator facilitates the deployment, scaling, and management of Redis clusters and other Redis resources provided by the OpsTree Solutions team.
**Homepage:** <https://github.com/ot-container-kit/redis-operator>
## Maintainers
| Name | Email | Url |
| ---- | ------ | --- |
| iamabhishek-dubey | | |
| sandy724 | | |
| shubham-cmyk | | |
## Pre-Requisities
- Helm v3+
- Kubernetes v1.16+
- If you plan to use cert-manager integration (certmanager.enabled=true), cert-manager must be pre-installed in your cluster
## Source Code
* <https://github.com/ot-container-kit/redis-operator>
## Installation Steps
### 1. Add Helm Repository
```bash
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts
```
### 2. Install Cert-Manager (Optional)
If you plan to use cert-manager with the redis-operator, you need to install cert-manager before deploying the operator.
You can follow the [official cert-manager installation guide](https://cert-manager.io/docs/installation/).
### 3. Install Redis Operator
Replace `<YourCertSecretName>` and `<YourPrivateKey>` with your specific values.
```bash
helm install <redis-operator> ot-helm/redis-operator --version=0.15.5 --appVersion=0.15.1 --set certificate.secretName=<YourCertSecretName> --set certmanager.enabled=true --set redisOperator.webhook=true --namespace <redis-operator> --create-namespace
```
> Note: If `certificate.secretName` is not provided, the operator will generate a self-signed certificate and use it for webhook server.
---
> Note : If you want to disable the webhook you have to pass the `--set webhook=false` and `--set certmanager.enabled=false` while installing the redis-operator.
---
> Note: If you want to use an existing `ClusterIssuer` to sign the webhook certificate, you can pass `--set issuer.create=false`, `--set issuer.kind=ClusterIssuer` and `--set issuer.name=cluster-issuer-name-here` while installing the operator.
### 4. Patch the CA Bundle (if using cert-manager)
Cert-manager injects the CA bundle into the webhook configuration.
```bash
kubectl patch crd redis.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
kubectl patch crd redisclusters.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
kubectl patch crd redisreplications.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
kubectl patch crd redissentinels.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
```
> Note: Replace `<redis-operator>` and `<serving-cert>` with your specific values i.e. release name and certificate name.
#### You can verify the patch by running the following commands
```bash
kubectl get crd redis.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
kubectl get crd redisclusters.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
kubectl get crd redisreplications.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
kubectl get crd redissentinels.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
```
### How to generate private key( Optional )
```bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt
kubectl create secret tls <webhook-server-cert> --key tls.key --cert tls.crt -n <redis-operator>
```
> Note: This secret will be used for webhook server certificate so generate it before installing the redis-operator.
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| certificate.name | string | `"serving-cert"` | |
| certificate.secretName | string | `"webhook-server-cert"` | |
| certmanager.apiVersion | string | `"cert-manager.io/v1"` | |
| certmanager.enabled | bool | `false` | |
| featureGates.GenerateConfigInInitContainer | bool | `false` | |
| issuer.create | bool | `true` | |
| issuer.email | string | `"shubham.gupta@opstree.com"` | |
| issuer.kind | string | `"Issuer"` | |
| issuer.name | string | `"redis-operator-issuer"` | |
| issuer.privateKeySecretName | string | `"letsencrypt-prod"` | |
| issuer.server | string | `"https://acme-v02.api.letsencrypt.org/directory"` | |
| issuer.solver.enabled | bool | `true` | |
| issuer.solver.ingressClass | string | `"nginx"` | |
| issuer.type | string | `"selfSigned"` | |
| manager.config.kubeClientQPS | float | `0` | If value > 0, it will override the default value in the operator |
| manager.config.kubeClientTimeout | string | `"60s"` | |
| nodeSelector | object | `{}` | |
| podSecurityContext | object | `{}` | |
| priorityClassName | string | `""` | |
| rbac.enabled | bool | `true` | |
| redisOperator.automountServiceAccountToken | bool | `true` | |
| redisOperator.env | list | `[]` | |
| redisOperator.extraArgs | list | `[]` | |
| redisOperator.imageName | string | `"ghcr.io/ot-container-kit/redis-operator/redis-operator"` | |
| redisOperator.imagePullPolicy | string | `"Always"` | |
| redisOperator.imagePullSecrets | list | `[]` | |
| redisOperator.imageTag | string | `""` | |
| redisOperator.metrics.bindAddress | string | `":8080"` | |
| redisOperator.metrics.enabled | bool | `true` | |
| redisOperator.name | string | `"redis-operator"` | |
| redisOperator.podAnnotations | object | `{}` | |
| redisOperator.podLabels | object | `{}` | |
| redisOperator.pprof.bindAddress | string | `":6060"` | |
| redisOperator.pprof.enabled | bool | `false` | |
| redisOperator.watchNamespace | string | `""` | |
| redisOperator.webhook | bool | `false` | |
| replicas | int | `1` | |
| resources.limits.cpu | string | `"500m"` | |
| resources.limits.memory | string | `"500Mi"` | |
| resources.requests.cpu | string | `"500m"` | |
| resources.requests.memory | string | `"500Mi"` | |
| securityContext | object | `{}` | |
| service.name | string | `"webhook-service"` | |
| service.namespace | string | `"redis-operator"` | |
| serviceAccount.automountServiceAccountToken | bool | `true` | |
| serviceAccountName | string | `"redis-operator"` | |
| tolerateAllTaints | bool | `false` | |
| tolerations | list | `[]` | |

View File

@ -0,0 +1,86 @@
# redis
This Helm chart deploys the redis-operator into your Kubernetes cluster. The operator facilitates the deployment, scaling, and management of Redis clusters and other Redis resources provided by the OpsTree Solutions team.
**Homepage:** <https://github.com/ot-container-kit/redis-operator>
## Maintainers
| Name | Email | Url |
| ---- | ------ | --- |
| iamabhishek-dubey | | |
| sandy724 | | |
| shubham-cmyk | | |
## Pre-Requisities
- Helm v3+
- Kubernetes v1.16+
- If you plan to use cert-manager integration (certmanager.enabled=true), cert-manager must be pre-installed in your cluster
## Source Code
* <https://github.com/ot-container-kit/redis-operator>
## Installation Steps
### 1. Add Helm Repository
```bash
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts
```
### 2. Install Cert-Manager (Optional)
If you plan to use cert-manager with the redis-operator, you need to install cert-manager before deploying the operator.
You can follow the [official cert-manager installation guide](https://cert-manager.io/docs/installation/).
### 3. Install Redis Operator
Replace `<YourCertSecretName>` and `<YourPrivateKey>` with your specific values.
```bash
helm install <redis-operator> ot-helm/redis-operator --version=0.15.5 --appVersion=0.15.1 --set certificate.secretName=<YourCertSecretName> --set certmanager.enabled=true --set redisOperator.webhook=true --namespace <redis-operator> --create-namespace
```
> Note: If `certificate.secretName` is not provided, the operator will generate a self-signed certificate and use it for webhook server.
---
> Note : If you want to disable the webhook you have to pass the `--set webhook=false` and `--set certmanager.enabled=false` while installing the redis-operator.
---
> Note: If you want to use an existing `ClusterIssuer` to sign the webhook certificate, you can pass `--set issuer.create=false`, `--set issuer.kind=ClusterIssuer` and `--set issuer.name=cluster-issuer-name-here` while installing the operator.
### 4. Patch the CA Bundle (if using cert-manager)
Cert-manager injects the CA bundle into the webhook configuration.
```bash
kubectl patch crd redis.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
kubectl patch crd redisclusters.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
kubectl patch crd redisreplications.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
kubectl patch crd redissentinels.redis.redis.opstreelabs.in -p '{"metadata":{"annotations":{"cert-manager.io/inject-ca-from":"<redis-operator>/<serving-cert>"}}}'
```
> Note: Replace `<redis-operator>` and `<serving-cert>` with your specific values i.e. release name and certificate name.
#### You can verify the patch by running the following commands
```bash
kubectl get crd redis.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
kubectl get crd redisclusters.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
kubectl get crd redisreplications.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
kubectl get crd redissentinels.redis.redis.opstreelabs.in -o=jsonpath='{.metadata.annotations}'
```
### How to generate private key( Optional )
```bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt
kubectl create secret tls <webhook-server-cert> --key tls.key --cert tls.crt -n <redis-operator>
```
> Note: This secret will be used for webhook server certificate so generate it before installing the redis-operator.
{{ template "chart.valuesSection" . }}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
{{- template "redis-operator.validateConfig" . -}}
Thank you for installing {{ .Chart.Name }}.
Your release is named {{ .Release.Name }}.
To learn more about the release, try:
$ helm status {{ .Release.Name }}
$ helm get all {{ .Release.Name }}

View File

@ -0,0 +1,43 @@
{{/* vim: set filetype=mustache: */}}
{{/* Define issuer spec based on the type */}}
{{- define "redis-operator.issuerSpec" -}}
{{- if eq .Values.issuer.type "acme" }}
acme:
email: {{ .Values.issuer.email }}
server: {{ .Values.issuer.server }}
privateKeySecretRef:
name: {{ .Values.issuer.privateKeySecretName }}
solvers:
- http01:
ingress:
class: {{ .Values.issuer.solver.ingressClass }}
{{- else }}
selfSigned: {}
{{- end }}
{{- end -}}
{{/* Common labels */}}
{{- define "redisOperator.labels" -}}
app.kubernetes.io/name: {{ .Values.redisOperator.name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: operator
app.kubernetes.io/part-of: {{ .Release.Name }}
{{- end }}
{{/* Selector labels */}}
{{- define "redisOperator.selectorLabels" -}}
name: {{ .Values.redisOperator.name }}
{{- end }}
{{/*
Validate webhook and cert-manager configuration
*/}}
{{- define "redis-operator.validateConfig" -}}
{{- if and (not .Values.redisOperator.webhook) .Values.certmanager.enabled -}}
{{- fail "certmanager.enabled should not be true when webhook is disabled" -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,40 @@
{{ if .Values.certmanager.enabled }}
{{- if .Values.issuer.create }}
apiVersion: cert-manager.io/v1
kind: {{ .Values.issuer.kind }}
metadata:
name: {{ .Values.issuer.name }}
labels:
app.kubernetes.io/name: {{ .Values.redisOperator.name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: issuer
app.kubernetes.io/part-of: {{ .Release.Name }}
spec:
{{- include "redis-operator.issuerSpec" . | nindent 2 }}
---
{{- end }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ .Values.certificate.name }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ .Values.redisOperator.name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: certificate
app.kubernetes.io/part-of: {{ .Release.Name }}
spec:
dnsNames:
- {{ .Values.service.name }}.{{ .Values.service.namespace }}.svc
- {{ .Values.service.name }}.{{ .Values.service.namespace }}.svc.cluster.local
issuerRef:
kind: {{ .Values.issuer.kind }}
name: {{ .Values.issuer.name }}
secretName: {{ .Values.certificate.secretName }}
{{ end }}

View File

@ -0,0 +1,34 @@
{{ if .Values.redisOperator.webhook }}
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: mutating-webhook-configuration
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/serving-cert
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: {{ .Release.Namespace }}
path: /mutate-core-v1-pod
failurePolicy: Fail
name: ot-mutate-pod.opstree.com
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
resources:
- pods
sideEffects: None
objectSelector:
matchExpressions:
- key: redis_setup_type
operator: Exists
{{ end }}

View File

@ -0,0 +1,131 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.redisOperator.name }}
namespace: {{ .Release.Namespace }}
labels: {{- include "redisOperator.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels: {{- include "redisOperator.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.certificate.name }}
{{- with .Values.redisOperator.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels: {{- include "redisOperator.selectorLabels" . | nindent 8 }}
{{- with .Values.redisOperator.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: {{ .Values.redisOperator.automountServiceAccountToken }}
{{- if .Values.redisOperator.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.redisOperator.imagePullSecrets | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: "{{ .Values.redisOperator.name }}"
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: "{{ .Values.redisOperator.imageName }}:{{ .Values.redisOperator.imageTag | default (printf "v%s" .Chart.AppVersion) }}"
imagePullPolicy: {{ .Values.redisOperator.imagePullPolicy }}
livenessProbe:
httpGet:
path: /healthz
port: probe
readinessProbe:
httpGet:
path: /readyz
port: probe
command:
- /operator
- manager
args:
- --leader-elect
{{- if .Values.redisOperator.pprof.enabled }}
- --pprof-bind-address={{ .Values.redisOperator.pprof.bindAddress }}
{{- end }}
{{- if .Values.redisOperator.metrics.enabled }}
- --metrics-bind-address={{ .Values.redisOperator.metrics.bindAddress }}
{{- end }}
{{- if .Values.manager.config.kubeClientTimeout }}
- --kube-client-timeout={{ .Values.manager.config.kubeClientTimeout }}
{{- end }}
{{- if and .Values.manager.config.kubeClientQPS (gt (.Values.manager.config.kubeClientQPS | float64) 0.0) }}
- --kube-client-qps={{ .Values.manager.config.kubeClientQPS }}
{{- end }}
{{- range $arg := .Values.redisOperator.extraArgs }}
- {{ $arg }}
{{- end }}
ports:
- containerPort: 8081
name: probe
protocol: TCP
{{- if .Values.redisOperator.metrics.enabled }}
- containerPort: {{ .Values.redisOperator.metrics.bindAddress | regexFind ":[0-9]+" | trimPrefix ":" }}
name: metrics
protocol: TCP
{{- end }}
{{- if .Values.redisOperator.pprof.enabled }}
- containerPort: {{ .Values.redisOperator.pprof.bindAddress | regexFind ":[0-9]+" | trimPrefix ":" }}
name: pprof
protocol: TCP
{{- end }}
{{- if .Values.redisOperator.webhook }}
- containerPort: 9443
name: webhook-server
protocol: TCP
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
{{- end }}
env:
- name: ENABLE_WEBHOOKS
value: {{ .Values.redisOperator.webhook | quote }}
{{- if .Values.redisOperator.watchNamespace }}
- name: WATCH_NAMESPACE
value: {{ .Values.redisOperator.watchNamespace | quote }}
{{- end }}
{{- range $env := .Values.redisOperator.env }}
- name: {{ $env.name }}
value: {{ $env.value | quote }}
{{- end }}
{{- if .Values.featureGates }}
- name: FEATURE_GATES
value: "{{- $first := true -}}
{{- range $feature, $enabled := .Values.featureGates -}}
{{- if not $first -}},{{- end -}}
{{- $first = false -}}
{{- $feature }}={{ $enabled -}}
{{- end -}}"
{{- end }}
{{- if .Values.resources }}
resources: {{ toYaml .Values.resources | nindent 10 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName}}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: "{{ .Values.serviceAccountName }}"
serviceAccount: "{{ .Values.serviceAccountName }}"
{{- if .Values.redisOperator.webhook }}
volumes:
- name: cert
secret:
defaultMode: 420
secretName: {{ .Values.certificate.secretName }}
{{- end }}

View File

@ -0,0 +1,23 @@
{{- if .Values.rbac.enabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.redisOperator.name }}
labels:
app.kubernetes.io/name : {{ .Values.redisOperator.name }}
helm.sh/chart : {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by : {{ .Release.Service }}
app.kubernetes.io/instance : {{ .Release.Name }}
app.kubernetes.io/version : {{ .Chart.AppVersion }}
app.kubernetes.io/component: role-binding
app.kubernetes.io/part-of : {{ .Release.Name }}
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccountName }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Values.redisOperator.name }}
apiGroup: rbac.authorization.k8s.io
{{- end }}

View File

@ -0,0 +1,128 @@
{{- if .Values.rbac.enabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.redisOperator.name }}
labels:
app.kubernetes.io/name : {{ .Values.redisOperator.name }}
helm.sh/chart : {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by : {{ .Release.Service }}
app.kubernetes.io/instance : {{ .Release.Name }}
app.kubernetes.io/version : {{ .Chart.AppVersion }}
app.kubernetes.io/component: role
app.kubernetes.io/part-of : {{ .Release.Name }}
rules:
- apiGroups:
- redis.redis.opstreelabs.in
resources:
- rediss
- redisclusters
- redisreplications
- redis
- rediscluster
- redissentinel
- redissentinels
- redisreplication
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- nonResourceURLs:
- '*'
verbs:
- get
- apiGroups:
- "apiextensions.k8s.io"
resources:
- "customresourcedefinitions"
verbs:
- "get"
- "list"
- "watch"
- apiGroups:
- redis.redis.opstreelabs.in
resources:
- redis/finalizers
- rediscluster/finalizers
- redisclusters/finalizers
- redissentinel/finalizers
- redissentinels/finalizers
- redisreplication/finalizers
- redisreplications/finalizers
verbs:
- update
- apiGroups:
- redis.redis.opstreelabs.in
resources:
- redis/status
- rediscluster/status
- redisclusters/status
- redissentinel/status
- redissentinels/status
- redisreplication/status
- redisreplications/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
- secrets
- pods/exec
- pods
- services
- configmaps
- events
- persistentvolumeclaims
- namespace
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- "coordination.k8s.io"
resources:
- leases
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- "policy"
resources:
- poddisruptionbudgets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
{{- end }}

View File

@ -0,0 +1,17 @@
{{- if .Values.rbac.enabled }}
---
apiVersion: v1
kind: ServiceAccount
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
metadata:
name: {{ .Values.redisOperator.name }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name : {{ .Values.redisOperator.name }}
helm.sh/chart : {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by : {{ .Release.Service }}
app.kubernetes.io/instance : {{ .Release.Name }}
app.kubernetes.io/version : {{ .Chart.AppVersion }}
app.kubernetes.io/component: service-account
app.kubernetes.io/part-of : {{ .Release.Name }}
{{- end }}

View File

@ -0,0 +1,22 @@
{{ if .Values.redisOperator.webhook }}
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name : {{ .Values.redisOperator.name }}
helm.sh/chart : {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by : {{ .Release.Service }}
app.kubernetes.io/instance : {{ .Release.Name }}
app.kubernetes.io/version : {{ .Chart.AppVersion }}
app.kubernetes.io/component: webhook
app.kubernetes.io/part-of : {{ .Release.Name }}
name: {{ .Values.service.name }}
namespace: {{ .Release.Namespace }}
spec:
ports:
- port: 443
protocol: TCP
targetPort: 9443
selector:
name: {{ .Values.redisOperator.name }}
{{ end }}

Some files were not shown because too many files have changed in this diff Show More