Skip to content

Commit

Permalink
Merge pull request #499 from spotahome/error-messages
Browse files Browse the repository at this point in the history
Fix error messages and handling
  • Loading branch information
ese authored Oct 21, 2022
2 parents 5d1cd3e + 0e7d6e3 commit e93a030
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 82 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- run: make ci-unit-test

integration-test:
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.19
- name: Install conntrack
run: sudo apt-get install -y conntrack
- uses: medyagh/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.17-alpine AS build
FROM --platform=$BUILDPLATFORM golang:1.19-alpine AS build
RUN apk --no-cache add \
bash

Expand Down
2 changes: 1 addition & 1 deletion docker/development/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17-alpine
FROM golang:1.19-alpine

ENV CODEGEN_VERSION="1.11.9"

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/spotahome/redis-operator

go 1.17
go 1.19

require (
github.com/go-redis/redis/v8 v8.11.5
Expand Down
74 changes: 0 additions & 74 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion service/k8s/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func (s *ServiceService) UpdateService(namespace string, service *corev1.Service
}
func (s *ServiceService) CreateOrUpdateService(namespace string, service *corev1.Service) error {
storedService, err := s.GetService(namespace, service.Name)
log.Errorf("Error while getting service %v in %v namespace : %v", service.GetName(), namespace, err)
if err != nil {
// If no resource we need to create.
if errors.IsNotFound(err) {
return s.CreateService(namespace, service)
}
log.Errorf("Error while updating service %v in %v namespace : %v", service.GetName(), namespace, err)
return err
}

Expand Down
4 changes: 2 additions & 2 deletions service/redis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ func (c *client) GetSlaveOf(ip, port, password string) (string, error) {
info, err := rClient.Info(context.TODO(), "replication").Result()
if err != nil {
c.metricsRecorder.RecordRedisOperation(metrics.KIND_REDIS, ip, metrics.GET_SLAVE_OF, metrics.FAIL, getRedisError(err))
log.Errorf("error while getting masterIP : Failed to get info replication while querying redis instance %v", ip)
return "", err
}
match := redisMasterHostRE.FindStringSubmatch(info)
if len(match) == 0 {
c.metricsRecorder.RecordRedisOperation(metrics.KIND_REDIS, ip, metrics.GET_SLAVE_OF, metrics.FAIL, metrics.REGEX_NOT_FOUND)
log.Errorf("error while getting masterIP : No match for for %v while querying redis instance %v for replication info", redisMasterHostREString, ip)
c.metricsRecorder.RecordRedisOperation(metrics.KIND_REDIS, ip, metrics.GET_SLAVE_OF, metrics.SUCCESS, metrics.NOT_APPLICABLE)
return "", nil
}
c.metricsRecorder.RecordRedisOperation(metrics.KIND_REDIS, ip, metrics.GET_SLAVE_OF, metrics.SUCCESS, metrics.NOT_APPLICABLE)
Expand Down

0 comments on commit e93a030

Please sign in to comment.