From 5b15086e7ae23e0b95118f9674171fe3f247a7ee Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Mon, 19 Feb 2018 17:40:36 +0100 Subject: [PATCH 1/8] [DEVOPS-FIX] Change the API version on the README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a760ab4f..b1b498c2a 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ spec: ## Usage In order to deploy a new redis-failover inside kubernetes, a specification has to be created. Here is a template: ~~~~ -apiVersion: spotahome.com/v1alpha1 +apiVersion: storage.spotahome.com/v1alpha2 kind: RedisFailover metadata: name: myredisfailover From 57c6c5c74b11f8909904c1a96b3664206baf0c6c Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Tue, 20 Feb 2018 18:07:51 +0100 Subject: [PATCH 2/8] [DEVOPS-695] Improve documentation --- README.md | 184 +++++++++++++++----------------------------- docs/development.md | 43 +++++++++++ docs/logic.md | 22 ++++++ 3 files changed, 128 insertions(+), 121 deletions(-) create mode 100644 docs/development.md create mode 100644 docs/logic.md diff --git a/README.md b/README.md index b1b498c2a..2fca2ab23 100644 --- a/README.md +++ b/README.md @@ -1,131 +1,73 @@ -# redis-operator [![Build Status](https://travis-ci.org/spotahome/redis-operator.png)](https://travis-ci.org/spotahome/redis-operator) [![Go Report Card](http://goreportcard.com/badge/spotahome/redis-operator)](http://goreportcard.com/report/spotahome/redis-operator) -Redis Operator creates/configures/manages redis failovers atop Kubernetes. +# redis-operator +[![Build Status](https://travis-ci.org/spotahome/redis-operator.png)](https://travis-ci.org/spotahome/redis-operator) +[![Go Report Card](http://goreportcard.com/badge/spotahome/redis-operator)](http://goreportcard.com/report/spotahome/redis-operator) + +**NOTE**: This is an alpha-status project. We do regular tests on the code and functionality, but we can not assure a production-ready stability. + +Redis Operator creates/configures/manages redis-failovers atop Kubernetes. ## Requirements Redis Operator is meant to be run on Kubernetes 1.8+. All dependecies have been vendored, so there's no need to any additional download. -### Images -#### Redis Operator +### Versions deployed +The image versions deployed by the operator can be found on the [constants file](operator/redisfailover/constants.go) for the RedisFailover service. + +## Images +### Redis Operator [![Redis Operator Image](https://quay.io/repository/spotahome/redis-operator/status "Redis Operator Image")](https://quay.io/repository/spotahome/redis-operator) ## Operator deployment on kubernetes -In order to create Redis failovers inside a Kubernetes cluster, the operator has to be deployed: -~~~~ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: redisoperator - name: redisoperator -spec: - replicas: 1 - selector: - matchLabels: - app: redisoperator - strategy: - type: RollingUpdate - template: - metadata: - labels: - app: redisoperator - spec: - containers: - - image: quay.io/spotahome/redis-operator:0.2.0 - imagePullPolicy: IfNotPresent - name: app - resources: - limits: - cpu: 100m - memory: 50Mi - requests: - cpu: 10m - memory: 50Mi - restartPolicy: Always -~~~~ +In order to create Redis failovers inside a Kubernetes cluster, the operator has to be deployed. It can be done with a [deployment](example/operator.yaml) or with the provided [Helm chart](charts/redisoperator). + +### Using a Deployment +To create the operator, you can directly create it with kubectl: +``` +kubectl create -f https://raw.githubusercontent.com/spotahome/redis-operator/master/example/operator.yaml +``` +This will create a deployment named `redisoperator`. + +### Using the Helm chart +``` +helm install --name redisfailover charts/redisfailover +``` ## Usage -In order to deploy a new redis-failover inside kubernetes, a specification has to be created. Here is a template: -~~~~ -apiVersion: storage.spotahome.com/v1alpha2 -kind: RedisFailover -metadata: - name: myredisfailover - namespace: mynamespace -spec: - hardAntiAffinity: false # Optional. Value by default. If true, the pods will not be scheduled on the same node. - sentinel: - replicas: 3 # Optional. Value by default, can be set higher. - resources: # Optional. If not set, it won't be defined on created reosurces - requests: - cpu: 100m - limits: - memory: 100Mi - redis: - replicas: 3 # Optional. Value by default, can be set higher. - resources: # Optional. If not set, it won't be defined on created reosurces - requests: - cpu: 100m - limits: - memory: 100Mi - exporter: false # Optional. False by default. Adds a redis-exporter container to export metrics. -~~~~ - -## Creation pipeline -The redis-operator creates a redis failover, with all the needed pieces. It does this in two separated steps: -* Ensure: checks that all the pieces needed are created. - * Redis statefulset - * Sentinel Deployment - * Sentinel service - * Redis service (if exporter enabled) -* Check & Heal: checks that the failover is working and configured as spected. - * Number of redis is equal as the set on the RF spec - * Number of sentinel is equal as the set on the RF spec - * Only one redis working as a master - * All redis slaves have the same master - * All redis slaves are connected to the master - * All sentinels points to the same redis master - * Sentinel has not death nodes - * Sentinel knows the correct slave number - -## Code folder structure -* api: definition of the RedisFailover CRD. -* client: autogenerated client to interact with redis-failovers. -* cmd: contains the starting point of the application. -* log: wrapper of logrus, created to be able to mock it. -* metrics: exposer of status of the failovers created. -* mocks: contains the mocked interfaces for testing the application. -* operator: the main logic. Manages the requests from k8s and creates/updates/deletes the pieces as needed. -* service: services/clients to interact with k8s and redises. -* vendor: vendored packages used by the application. - -## Non-code folder structure -* charts: helm chart to deploy the TPR. -* docker: Dockerfiles to generate redis-failover docker images. -* example: yaml files with spec of redis-failover. -* hack: scripts to generate the client. -* scripts: scripts used to build and run the app. - -## Development -### With Make -You can do the following commands with make: -* Build the development container. -`make docker-build` -* Generate mocks. -`make go-generate` -* Generate client -`make update-codegen` -* Run tests. -`make test` -* Build the executable file. -`make build` -* Run the app. -`make run` -* Access the docker instance with a shell. -`make shell` -* Install dependencies -`make get-deps` -* Update dependencies -`make update-deps` -* Build the app image. -`make image` +Once the operator is deployed inside a Kubernetes cluster, a new API will be accesible, so you'll be able to create, update and delete redisfailovers. + +In order to deploy a new redis-failover a [specification](example/redisfailover.yaml) has to be created: +``` +kubectl create -f https://raw.githubusercontent.com/spotahome/redis-operator/master/example/redisfailover.yaml +``` + +This redis-failover will be managed by the operator, resulting in the following elements created inside Kubernetes: +* `rfr-`: Redis configmap +* `rfr-`: Redis statefulset +* `rfr-`: Redis service (if redis-exporter is enabled) +* `rfs-`: Sentinel configmap +* `rfs-`: Sentinel deployment +* `rfs-`: Sentinel service + +**NOTE**: `NAME` is the named provided when creating the RedisFailover. + +### Connection +In order to connect to the redis-failover and use it, a [Sentinel-ready](https://redis.io/topics/sentinel-clients) library has to be used. This will connect through the Sentinel service to the Redis node working as a master. +The connection parameters are the following: +``` +url: rfs- +port: 26379 +master-name: mymaster +``` + +## Cleanup +If you want to delete the operator from your Kubernetes cluster, the operator deployment should be deleted. + +Also, the CRD has to be deleted too: +``` +kubectl delete crd redisfailovers.storage.spotahome.com +``` + +## Documentation +For the code documentation, you can lookup on the [GoDoc](https://godoc.org/github.com/spotahome/redis-operator). + +Also, you can check more deeply information on the [docs folder](docs). diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 000000000..7cdd72fac --- /dev/null +++ b/docs/development.md @@ -0,0 +1,43 @@ +# Development + +## Folder structure +### Code folder structure +* **api**: definition of the RedisFailover CRD. +* **client**: autogenerated client to interact with redis-failovers. +* **cmd**: contains the starting point of the application. +* **log**: wrapper of logrus, created to be able to mock it. +* **metrics**: exposer of status of the failovers created. +* **mocks**: contains the mocked interfaces for testing the application. +* **operator**: the main logic. Manages the requests from k8s and creates/updates/deletes the pieces as needed. +* **service**: services/clients to interact with k8s and redises. +* **vendor**: vendored packages used by the application. + +### Non-code folder structure +* **charts**: helm chart to deploy the operator. +* **docker**: Dockerfiles to generate redis-failover docker images. +* **example**: yaml files with spec of redis-failover. +* **hack**: scripts to generate the redis-failover api-client. +* **scripts**: scripts used to build and run the app. + +## Make development commands +You can do the following commands with make: +* Build the development container. +`make docker-build` +* Generate mocks. +`make go-generate` +* Generate client +`make update-codegen` +* Run tests. +`make test` +* Build the executable file. +`make build` +* Run the app. +`make run` +* Access the docker instance with a shell. +`make shell` +* Install dependencies +`make get-deps` +* Update dependencies +`make update-deps` +* Build the app image. +`make image` diff --git a/docs/logic.md b/docs/logic.md new file mode 100644 index 000000000..249cad6eb --- /dev/null +++ b/docs/logic.md @@ -0,0 +1,22 @@ +# Controller logic + +## Creation pipeline +The Redis-Operator creates Redis Failovers, with all the needed pieces. So, when a event arrives from Kubernetes (add or sync), the following steps are executed: +* Ensure: checks that all the pieces needed are created. It is important to notice that if a change is performed manually on the objects created, the operator will override them. This is done to ensure a healthy status. It will create the following: + * Redis configmap + * Redis statefulset + * Redis service (if exporter enabled) + * Sentinel configmap + * Sentinel deployment + * Sentinel service +* Check & Heal: will connect to every Redis and Sentinel and will ensure that they are working as they are supposed to do. If this is not the case, it will reconfigure the nodes to move them to the desire state. It will check the following: + * Number of Redis is equal as the set on the RF spec + * Number of Sentinel is equal as the set on the RF spec + * Only one Redis working as a master + * All Redis slaves have the same master + * All Redis slaves are connected to the master + * All Sentinels points to the same Redis master + * Sentinel has not death nodes + * Sentinel knows the correct slave number + +Most of the problems that may occur will be treated and tried to fix by the controller, except the case that there are a [split-brain](https://en.wikipedia.org/wiki/Split-brain_(computing)). **If happens to be a split-brain, an error will be logged waiting for manual fix**. From 80cdb5980c58ae7b80dd876df259f00033db9b89 Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Tue, 20 Feb 2018 18:08:07 +0100 Subject: [PATCH 3/8] [DEVOPS-695] Improve example yaml files --- example/minimum.yaml | 3 +-- example/namespace.yaml | 4 ---- example/operator.yaml | 30 ++++++++++++++++++++++++++++++ example/redisfailover.yaml | 14 +++++++------- 4 files changed, 38 insertions(+), 13 deletions(-) delete mode 100644 example/namespace.yaml create mode 100644 example/operator.yaml diff --git a/example/minimum.yaml b/example/minimum.yaml index eacac1ef9..6d848cdd0 100644 --- a/example/minimum.yaml +++ b/example/minimum.yaml @@ -1,5 +1,4 @@ apiVersion: storage.spotahome.com/v1alpha2 kind: RedisFailover metadata: - name: rfexample - namespace: example + name: redisfailover diff --git a/example/namespace.yaml b/example/namespace.yaml deleted file mode 100644 index 2a8a1284c..000000000 --- a/example/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: example diff --git a/example/operator.yaml b/example/operator.yaml new file mode 100644 index 000000000..70a581ed3 --- /dev/null +++ b/example/operator.yaml @@ -0,0 +1,30 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + app: redisoperator + name: redisoperator +spec: + replicas: 1 + selector: + matchLabels: + app: redisoperator + strategy: + type: RollingUpdate + template: + metadata: + labels: + app: redisoperator + spec: + containers: + - image: quay.io/spotahome/redis-operator:0.2.0 + imagePullPolicy: IfNotPresent + name: app + resources: + limits: + cpu: 100m + memory: 50Mi + requests: + cpu: 10m + memory: 50Mi + restartPolicy: Always diff --git a/example/redisfailover.yaml b/example/redisfailover.yaml index 536d28d33..701aed1ab 100644 --- a/example/redisfailover.yaml +++ b/example/redisfailover.yaml @@ -1,23 +1,23 @@ apiVersion: storage.spotahome.com/v1alpha2 kind: RedisFailover metadata: - name: rfexample - namespace: example + name: redisfailover spec: + hardAntiAffinity: false # Optional. Value by default. If true, the pods will not be scheduled on the same node. sentinel: - replicas: 3 - resources: + replicas: 3 # Optional. 3 by default, can be set higher. + resources: # Optional. If not set, it won't be defined on created reosurces. requests: cpu: 100m limits: memory: 100Mi redis: - replicas: 3 - resources: + replicas: 3 # Optional. 3 by default, can be set higher. + resources: # Optional. If not set, it won't be defined on created reosurces requests: cpu: 100m memory: 100Mi limits: cpu: 400m memory: 500Mi - exporter: false + exporter: false # Optional. False by default. Adds a redis-exporter container to export metrics. From e74320ac6bc51da304cc83d3043883370f22697f Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Tue, 20 Feb 2018 18:11:44 +0100 Subject: [PATCH 4/8] [DEVOPS-695] Fix typos --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fca2ab23..14537ab7f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Redis Operator is meant to be run on Kubernetes 1.8+. All dependecies have been vendored, so there's no need to any additional download. ### Versions deployed -The image versions deployed by the operator can be found on the [constants file](operator/redisfailover/constants.go) for the RedisFailover service. +The image versions deployed by the operator can be found on the [constants file](operator/redisfailover/service/constants.go) for the RedisFailover service. ## Images ### Redis Operator @@ -28,6 +28,7 @@ kubectl create -f https://raw.githubusercontent.com/spotahome/redis-operator/mas This will create a deployment named `redisoperator`. ### Using the Helm chart +From the root folder of the project, execute the following: ``` helm install --name redisfailover charts/redisfailover ``` From cac700feea8c5653b7a3746e9af87072723df8c1 Mon Sep 17 00:00:00 2001 From: Benjamin Blattberg Date: Thu, 22 Feb 2018 10:30:06 -0600 Subject: [PATCH 5/8] Use masterName var instead of "mymaster" --- service/redis/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/redis/client.go b/service/redis/client.go index 94f08f135..48e26d985 100644 --- a/service/redis/client.go +++ b/service/redis/client.go @@ -219,7 +219,7 @@ func (c *client) GetSentinelMonitor(ip string) (string, error) { } rClient := rediscli.NewClient(options) defer rClient.Close() - cmd := rediscli.NewSliceCmd("SENTINEL", "master", "mymaster") + cmd := rediscli.NewSliceCmd("SENTINEL", "master", masterName) rClient.Process(cmd) res, err := cmd.Result() if err != nil { From 8a6034e351a1f393fb71f41fe787b0b49f8f3350 Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Wed, 28 Mar 2018 15:13:12 +0200 Subject: [PATCH 6/8] [DEVOPS-738] Add init container to copy sentinel.conf --- operator/redisfailover/service/generator.go | 66 ++++++++++++++++----- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/operator/redisfailover/service/generator.go b/operator/redisfailover/service/generator.go index fc3a1fe2e..dedbc1ff0 100644 --- a/operator/redisfailover/service/generator.go +++ b/operator/redisfailover/service/generator.go @@ -31,7 +31,7 @@ func generateSentinelService(rf *redisfailoverv1alpha2.RedisFailover, labels map Spec: corev1.ServiceSpec{ Selector: labels, Ports: []corev1.ServicePort{ - corev1.ServicePort{ + { Name: "sentinel", Port: 26379, TargetPort: sentinelTargetPort, @@ -59,7 +59,7 @@ func generateRedisService(rf *redisfailoverv1alpha2.RedisFailover, labels map[st Type: corev1.ServiceTypeClusterIP, ClusterIP: corev1.ClusterIPNone, Ports: []corev1.ServicePort{ - corev1.ServicePort{ + { Port: exporterPort, Protocol: corev1.ProtocolTCP, Name: exporterPortName, @@ -144,19 +144,19 @@ func generateRedisStatefulSet(rf *redisfailoverv1alpha2.RedisFailover, labels ma Spec: corev1.PodSpec{ Affinity: createPodAntiAffinity(rf.Spec.HardAntiAffinity, labels), Containers: []corev1.Container{ - corev1.Container{ + { Name: "redis", Image: redisImage, ImagePullPolicy: "Always", Ports: []corev1.ContainerPort{ - corev1.ContainerPort{ + { Name: "redis", ContainerPort: 6379, Protocol: corev1.ProtocolTCP, }, }, VolumeMounts: []corev1.VolumeMount{ - corev1.VolumeMount{ + { Name: "redis-config", MountPath: "/redis", }, @@ -195,7 +195,7 @@ func generateRedisStatefulSet(rf *redisfailoverv1alpha2.RedisFailover, labels ma }, }, Volumes: []corev1.Volume{ - corev1.Volume{ + { Name: "redis-config", VolumeSource: corev1.VolumeSource{ ConfigMap: &corev1.ConfigMapVolumeSource{ @@ -246,21 +246,53 @@ func generateSentinelDeployment(rf *redisfailoverv1alpha2.RedisFailover, labels }, Spec: corev1.PodSpec{ Affinity: createPodAntiAffinity(rf.Spec.HardAntiAffinity, labels), + InitContainers: []corev1.Container{ + { + Name: "sentinel-config-copy", + Image: "alpine", + ImagePullPolicy: "IfNotPresent", + VolumeMounts: []corev1.VolumeMount{ + { + Name: "sentinel-config", + MountPath: "/redis", + }, + { + Name: "sentinel-config-writable", + MountPath: "/redis-writable", + }, + }, + Command: []string{ + "cp", + fmt.Sprintf("/redis/%s", sentinelConfigFileName), + fmt.Sprintf("/redis-writable/%s", sentinelConfigFileName), + }, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("10m"), + corev1.ResourceMemory: resource.MustParse("10Mi"), + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("10m"), + corev1.ResourceMemory: resource.MustParse("10Mi"), + }, + }, + }, + }, Containers: []corev1.Container{ - corev1.Container{ + { Name: "sentinel", Image: redisImage, ImagePullPolicy: "Always", Ports: []corev1.ContainerPort{ - corev1.ContainerPort{ + { Name: "sentinel", ContainerPort: 26379, Protocol: corev1.ProtocolTCP, }, }, VolumeMounts: []corev1.VolumeMount{ - corev1.VolumeMount{ - Name: "sentinel-config", + { + Name: "sentinel-config-writable", MountPath: "/redis", }, }, @@ -299,7 +331,7 @@ func generateSentinelDeployment(rf *redisfailoverv1alpha2.RedisFailover, labels }, }, Volumes: []corev1.Volume{ - corev1.Volume{ + { Name: "sentinel-config", VolumeSource: corev1.VolumeSource{ ConfigMap: &corev1.ConfigMapVolumeSource{ @@ -309,6 +341,12 @@ func generateSentinelDeployment(rf *redisfailoverv1alpha2.RedisFailover, labels }, }, }, + { + Name: "sentinel-config-writable", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, }, }, }, @@ -372,7 +410,7 @@ func createRedisExporterContainer() corev1.Container { Image: exporterImage, ImagePullPolicy: "Always", Ports: []corev1.ContainerPort{ - corev1.ContainerPort{ + { Name: "metrics", ContainerPort: exporterPort, Protocol: corev1.ProtocolTCP, @@ -416,7 +454,7 @@ func createPodAntiAffinity(hard bool, labels map[string]string) *corev1.Affinity return &corev1.Affinity{ PodAntiAffinity: &corev1.PodAntiAffinity{ RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{ - corev1.PodAffinityTerm{ + { TopologyKey: hostnameTopologyKey, LabelSelector: &metav1.LabelSelector{ MatchLabels: labels, @@ -431,7 +469,7 @@ func createPodAntiAffinity(hard bool, labels map[string]string) *corev1.Affinity return &corev1.Affinity{ PodAntiAffinity: &corev1.PodAntiAffinity{ PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{ - corev1.WeightedPodAffinityTerm{ + { Weight: 100, PodAffinityTerm: corev1.PodAffinityTerm{ TopologyKey: hostnameTopologyKey, From 15d2df7033a7ddcf3998467411bc79ce6e8fe64e Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Wed, 28 Mar 2018 15:15:52 +0200 Subject: [PATCH 7/8] [DEVOPS-738] Extra: simplify files --- operator/redisfailover/service/check_test.go | 42 ++++++++++---------- operator/redisfailover/service/heal_test.go | 24 +++++------ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/operator/redisfailover/service/check_test.go b/operator/redisfailover/service/check_test.go index 9564a2626..51cc6f72d 100644 --- a/operator/redisfailover/service/check_test.go +++ b/operator/redisfailover/service/check_test.go @@ -170,7 +170,7 @@ func TestCheckAllSlavesFromMasterGetSlaveOfError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "", }, @@ -196,7 +196,7 @@ func TestCheckAllSlavesFromMasterDifferentMaster(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -222,7 +222,7 @@ func TestCheckAllSlavesFromMaster(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -263,7 +263,7 @@ func TestCheckSentinelNumberInMemoryGetNumberSentinelInMemoryError(t *testing.T) pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -289,7 +289,7 @@ func TestCheckSentinelNumberInMemoryNumberMismatch(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -315,7 +315,7 @@ func TestCheckSentinelNumberInMemory(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -356,7 +356,7 @@ func TestCheckSentinelSlavesNumberInMemoryGetNumberSentinelSlavesInMemoryError(t pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -382,7 +382,7 @@ func TestCheckSentinelSlavesNumberInMemoryReplicasMismatch(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -408,7 +408,7 @@ func TestCheckSentinelSlavesNumberInMemory(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -488,7 +488,7 @@ func TestGetMasterIPIsMasterError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -514,12 +514,12 @@ func TestGetMasterIPMultipleMastersError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -546,12 +546,12 @@ func TestGetMasterIP(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -594,7 +594,7 @@ func TestGetNumberMastersIsMasterError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -620,12 +620,12 @@ func TestGetNumberMasters(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -653,12 +653,12 @@ func TestGetNumberMastersTwo(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -705,14 +705,14 @@ func TestGetMinimumRedisPodTime(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ StartTime: &metav1.Time{ Time: oneHour, }, }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ StartTime: &metav1.Time{ Time: oneMinute, diff --git a/operator/redisfailover/service/heal_test.go b/operator/redisfailover/service/heal_test.go index ef33b8d7d..e24f37980 100644 --- a/operator/redisfailover/service/heal_test.go +++ b/operator/redisfailover/service/heal_test.go @@ -20,7 +20,7 @@ func TestSetRandomMasterNewMasterError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -46,7 +46,7 @@ func TestSetRandomMaster(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, @@ -72,12 +72,12 @@ func TestSetRandomMasterMultiplePodsMakeSlaveOfError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -104,12 +104,12 @@ func TestSetRandomMasterMultiplePods(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -136,12 +136,12 @@ func TestSetMasterOnAllMakeMasterError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -167,12 +167,12 @@ func TestSetMasterOnAllMakeSlaveOfError(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, @@ -199,12 +199,12 @@ func TestSetMasterOnAll(t *testing.T) { pods := &corev1.PodList{ Items: []corev1.Pod{ - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "0.0.0.0", }, }, - corev1.Pod{ + { Status: corev1.PodStatus{ PodIP: "1.1.1.1", }, From 502a75c306bd5362cb0df37879b8decf0e5f970f Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Wed, 28 Mar 2018 15:17:44 +0200 Subject: [PATCH 8/8] [DEVOPS-738] Bump version to 0.2.1 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 28d402543..75205e803 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION := 0.2.0 +VERSION := 0.2.1 # Name of this service/application SERVICE_NAME := redis-operator