Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: spotahome/redis-operator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: powerhome/redis-operator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 5,739 additions and 476 deletions.
  1. +2 −1 .github/CODEOWNERS
  2. +59 −7 .github/workflows/ci.yaml
  3. +35 −0 .github/workflows/stale.yml
  4. +109 −9 CHANGELOG.md
  5. +94 −143 Makefile
  6. +1 −1 api/redisfailover/v1/bootstrapping.go
  7. +7 −4 api/redisfailover/v1/bootstrapping_test.go
  8. +4 −3 api/redisfailover/v1/defaults.go
  9. +96 −7 api/redisfailover/v1/types.go
  10. +12 −0 api/redisfailover/v1/validate.go
  11. +26 −9 api/redisfailover/v1/validate_test.go
  12. +107 −0 api/redisfailover/v1/zz_generated.deepcopy.go
  13. +947 −2 charts/redisoperator/crds/databases.spotahome.com_redisfailovers.yaml
  14. +12 −0 client/k8s/clientset/versioned/typed/redisfailover/v1/fake/fake_redisfailover.go
  15. +17 −0 client/k8s/clientset/versioned/typed/redisfailover/v1/redisfailover.go
  16. +39 −0 docker-bake.hcl
  17. +10 −4 docker/development/Dockerfile
  18. +17 −2 { → docs}/README.md
  19. +20 −18 docs/development.md
  20. +12 −0 example/redisfailover/bootstrapping-disabled.yaml
  21. +987 −10 manifests/databases.spotahome.com_redisfailovers.yaml
  22. +987 −10 manifests/kustomize/base/databases.spotahome.com_redisfailovers.yaml
  23. +2 −0 metrics/metrics.go
  24. +6 −0 mkdocs.yml
  25. +5 −6 mocks/log/Logger.go
  26. +30 −5 mocks/operator/redisfailover/RedisFailover.go
  27. +38 −11 mocks/operator/redisfailover/service/RedisFailoverCheck.go
  28. +142 −5 mocks/operator/redisfailover/service/RedisFailoverClient.go
  29. +24 −11 mocks/operator/redisfailover/service/RedisFailoverHeal.go
  30. +114 −5 mocks/service/k8s/Services.go
  31. +97 −60 mocks/service/redis/Client.go
  32. +15 −9 operator/redisfailover/checker.go
  33. +7 −4 operator/redisfailover/checker_test.go
  34. +39 −4 operator/redisfailover/ensurer.go
  35. +33 −6 operator/redisfailover/ensurer_test.go
  36. +6 −4 operator/redisfailover/factory.go
  37. +64 −0 operator/redisfailover/handler.go
  38. +46 −18 operator/redisfailover/service/check.go
  39. +259 −19 operator/redisfailover/service/check_test.go
  40. +154 −0 operator/redisfailover/service/client.go
  41. +17 −13 operator/redisfailover/service/constants.go
  42. +314 −9 operator/redisfailover/service/generator.go
  43. +393 −6 operator/redisfailover/service/generator_test.go
  44. +31 −13 operator/redisfailover/service/heal.go
  45. +32 −4 operator/redisfailover/service/heal_test.go
  46. +18 −0 operator/redisfailover/service/names.go
  47. +18 −0 portal.yml
  48. +3 −0 service/k8s/k8s.go
  49. +94 −0 service/k8s/networkpolicy.go
  50. +7 −0 service/k8s/redisfailover.go
  51. +2 −0 service/k8s/statefulset.go
  52. +41 −1 service/k8s/statefulset_test.go
  53. +81 −32 service/redis/client.go
  54. +7 −1 test/integration/redisfailover/creation_test.go
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @spotahome/core
# Managed by https://github.com/powerhome/software. Do not make changes here, they will be reverted.
* @powerhome/forever-people
66 changes: 59 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -3,8 +3,15 @@ name: CI
on:
push:
branches:
- main
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'

env:
DOCKER_METADATA_PR_HEAD_SHA: true

jobs:
check:
@@ -30,15 +37,24 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- run: make ci-unit-test
- run: make test-unit-ci

integration-test:
name: Integration test
runs-on: ubuntu-latest
needs: [check, unit-test]
runs-on: ubuntu-22.04
needs:
- check
- unit-test
strategy:
matrix:
kubernetes: [1.24.16, 1.25.12, 1.26.7, 1.27.3 ]
kubernetes:
- 1.21.14
- 1.22.17
- 1.23.17
- 1.24.16
- 1.25.12
- 1.26.7
- 1.27.3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
@@ -53,7 +69,7 @@ jobs:
driver: none
- name: Add redisfailover CRD
run: kubectl create -f manifests/databases.spotahome.com_redisfailovers.yaml
- run: make ci-integration-test
- run: make test-integration-ci

chart-test:
name: Chart testing
@@ -69,4 +85,40 @@ jobs:
version: v3.7.2

- name: Helm test
run: make helm-test
run: make test-helm-ci

dockerhub-image:
needs:
- check
- unit-test
- integration-test
runs-on: ubuntu-latest
steps:
-
name: Checkout
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: Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: powerhome/redis-operator
tags: |
type=semver,pattern={{raw}}
type=sha,prefix=,suffix=,format=long
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
uses: docker/bake-action@v3
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: build
push: true
35 changes: 35 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Managed by https://github.com/powerhome/software. Do not make changes here, they will be reverted.

name: 'Close stale issues and PRs'
on:
workflow_dispatch:
schedule:
- cron: '5 3 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
with:
operations-per-run: 200
delete-branch: true
stale-pr-message: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 24 hours if no further activity occurs.
If this change is desirable, please accelerate completing it. If it is not,
please close the PR. If you're blocked on something, please ensure there's
a reference to this PR in a story on your team's board so the team will
follow up, and consider closing the PR for now.
Please do not artificially extend the deadline with a dummy comment. If
necessary, provide a status update, such as "this change is being actively
tested".
Thank you for your contributions and your collaboration in reducing WIP
and cycle time.
days-before-stale: 14
days-before-close: 3
days-before-issue-stale: -1
exempt-pr-labels: dependencies
118 changes: 109 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,106 @@
# Changelog

Check [releases](https://github.com/spotahome/redis-operator/releases) section for Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Also check this project's [releases](https://github.com/powerhome/redis-operator/releases) for official release notes.

## Unreleased

## [v4.1.0] - 2025-01-16

### Changed

- [HAProxy: disconnect clients when node is demoted to replica](https://github.com/powerhome/redis-operator/pull/59)

## [v4.0.0] - 2024-12-05

### Changed

- **BREAKING** [HAProxy: avoid sending traffic to replicas on failover](https://github.com/powerhome/redis-operator/pull/57/). RedisFailovers using `haproxy:` must now use a HAProxy image of v3.1.0 or greater. The operator now uses HAProxy v3.1.0 by default.

## [v3.1.0] - 2024-09-05

- [Automatically recreate StatefulSet after volume expansion](https://github.com/powerhome/redis-operator/pull/55)
- [Upgrade default haproxy image to v2.9.6](https://github.com/powerhome/redis-operator/pull/52)

## [v3.0.0] - 2024-02-26

### Removed

- [Remove HAProxy for redis with role:slave as unnecessary and potentially dangerous](https://github.com/powerhome/redis-operator/pull/50)

Action required:

If your application is using the `rfrs-haproxy-[redisfailvover-name]` service you'll need to use the `rfrs-[redis-failover-name]` service which bypassess HAProxy altogether.

## [v2.1.0] - 2024-02-26

### Fixed

- [In version 2.0.1, the approach to generating network policy by the operator was modified. From v2.0.1 onwards, the operator no longer creates network policy for redis but continues to do it for sentinels. This fix automatically removes any leftover network policy from the namespace, eliminating the need for manual intervention](https://github.com/powerhome/redis-operator/pull/49)

### Changed

- [Add default haproxy image](https://github.com/powerhome/redis-operator/pull/47)
- [Update the default redis version to 7.2.4](https://github.com/powerhome/redis-operator/pull/46)
- [Update metrics exporter images](https://github.com/powerhome/redis-operator/pull/45)

## [v2.0.2] - 2024-02-13

### Fixed

- [Operator detects and attempts to heal excessive replication connections on the master node](https://github.com/powerhome/redis-operator/pull/43). This prevents excessive sentinel resets from the operator when extra-RedisFailvoer replication connnections are present on the "slave" nodes.

## [v2.0.1] - 2024-02-09

### Fixed
- [Sentinels shoud only be allowed to talk to pods belonging to their RedisFailover Custom Resource](https://github.com/powerhome/redis-operator/pull/42).

Update notes:

This update modifies how the operator generates network policies. In version v2.0.0, there were two separate network policies: one for Redis and another for Redis Sentinels. From version v2.0.1 onwards, the operator will only generate a network policy for Sentinels. It is crucial to be aware that following the upgrade to this version, the existing network policy for Redis instances will persist and must be deleted manually.

## [v2.0.0] - 2024-01-18

### Added
- [Set up a new HAProxy service for routing traffic specifically to Redis nodes set as slaves][https://github.com/powerhome/redis-operator/pull/40]

Update notes:

This release will change the labels of the HAProxy deployment resource.
It's important to note that in API version apps/v1, a Deployment's label selector [cannot be changed once it's created](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates). Therefore, any existing HAProxy deployment placed by an <v2.0.0 version of the redis-operator MUST be deleted so the new deployment with the correct labels and selectors can be recreated by redis-operator v2.0.0+

## [v1.8.0] - 2024-01-16

### Fixed
- [Cleanup Sentinels when bootstrapping and sentinels are not allowed](https://github.com/powerhome/redis-operator/pull/33).
- [Prevent connection throttling for more than 256 concurrent client connections](https://github.com/powerhome/redis-operator/pull/36)

### Added
- [Bootstrap settings - Add an `enabled` parameter to toggle the bootstrap mode on or off for a RedisFailover. (Defaults to `true`)](https://github.com/powerhome/redis-operator/pull/32).
- [Use the new docker bake tooling to build the developer tools image and remove vestigial development targets from the Makefile](https://github.com/powerhome/redis-operator/pull/31).

## [v1.8.0-rc2] - 2023-12-20

### Changed
- [Automate image publishing to the public image repository](https://github.com/powerhome/redis-operator/pull/30)
- [Run CI on the master branch](https://github.com/powerhome/redis-operator/pull/29)

## [v1.8.0-rc1] - 2023-12-15

### Added
- [Add public image repository](https://github.com/powerhome/redis-operator/pull/28)

## [v1.7.1] - 2023-12-14

### Changed
- [Use finer grained NetworkPolicies](https://github.com/powerhome/redis-operator/pull/25)

### Fixed
- [Fix PodDisruptionBudget deprecation warnings on kube 1.21+](https://github.com/powerhome/redis-operator/pull/19)

## [v1.1.0-rc.3] - 2022-01-19
### Changes
@@ -10,7 +110,7 @@ Check [releases](https://github.com/spotahome/redis-operator/releases) section f
### Changes
- Allow configuration of exporter resource
- Fix persistent volume claim metadata management
- Add arm64,arm,amd64 docker images
- Add arm64,arm,amd64 docker images

Update notes:

@@ -53,7 +153,7 @@ For detailed changelogs see rc relases
## [v1.0.0-rc.5] - 2020-02-07

### Changes
- Custom annotations for services #216 @alecjacobs5401
- Custom annotations for services #216 @alecjacobs5401
- Update redis-exporter #222 @VerosK
- Pod security policy to run as non root #228 @logdnalf
- Custom command renames #234 @logdnalf
@@ -62,7 +162,7 @@ For detailed changelogs see rc relases
- Add fsGroup to security context #215 @ese
- Pod disruption budget lower than replicas #229 @tkrop
- Add password support for readiness probes #235 @teamon

## [v1.0.0-rc.4] - 2019-12-17

### Changes
@@ -75,7 +175,7 @@ For detailed changelogs see rc relases
### Action required

Since update logic has been moved to operator, `PodManagementPolicy` has been set to `Parallel` in redis statefulSet. This improve bootstrap times.
This field is immutable so to upgrade from previous rc releases you need to delete statefulSets manually.
This field is immutable so to upgrade from previous rc releases you need to delete statefulSets manually.
*Note:* you can use `--cascade=false` flag to avoid disruption, pods will be adopted by the new statefulSet created by the operator.
example: `kubectl delete statefulset --cascade=false rfr-redisfailover`

@@ -97,14 +197,14 @@ example: `kubectl delete statefulset --cascade=false rfr-redisfailover`

- Add custom annotations for pods in the CRD `podAnnotations` @alecjacobs5401
- Add redis authentication @hoffoo
- Configurable imagePullSecret @romanfurst
- Configurable imagePullPolicy @mcdiae
- Support for node selector `nodeSelector` @sergeunity
- Configurable imagePullSecret @romanfurst
- Configurable imagePullPolicy @mcdiae
- Support for node selector `nodeSelector` @sergeunity

### Fix

- Add RBAC policy for the CRD finalizer @mcanevet
- Examples documentation @SataQiu @marcemq
- Examples documentation @SataQiu @marcemq
- Chart service labels @timmyers
- Memory requests and limits for sentinel @marcemq
- Execution permissions in shutdown script @glebpom
Loading