Skip to content

Commit

Permalink
Merge branch 'release/v0.14.3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jelemux authored and cesmarvin committed Oct 2, 2023
2 parents f542131 + fefcfdb commit cdf6280
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.14.3] - 2023-10-02
### Fixed
- [#44] Fix a bug where the service discovery only updated one single ingress switching maintenance mode.

## [v0.14.2] - 2023-09-20
### Changed
- [#38] updated go dependencies
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN make compile-generic
FROM gcr.io/distroless/static:nonroot
LABEL maintainer="[email protected]" \
NAME="k8s-service-discovery" \
VERSION="0.14.2"
VERSION="0.14.3"

WORKDIR /

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Set these to the desired values
ARTIFACT_ID=k8s-service-discovery
VERSION=0.14.2
VERSION=0.14.3

## Image URL to use all building/pushing image targets
IMAGE_DEV=${K3CES_REGISTRY_URL_PREFIX}/${ARTIFACT_ID}:${VERSION}
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ kind: Kustomization
images:
- name: controller
newName: cloudogu/k8s-service-discovery
newTag: 0.14.2
newTag: 0.14.3
3 changes: 2 additions & 1 deletion controllers/maintenanceModeUpdater.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ func (scu *maintenanceModeUpdater) getAllServices(ctx context.Context) (v1Servic

var modifiableServiceList v1ServiceList
for _, svc := range serviceList.Items {
modifiableServiceList = append(modifiableServiceList, &svc)
copySvc := svc
modifiableServiceList = append(modifiableServiceList, &copySvc)
}

return modifiableServiceList, nil
Expand Down
27 changes: 27 additions & 0 deletions controllers/maintenanceModeUpdater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controllers

import (
"context"
"sigs.k8s.io/controller-runtime/pkg/client"
"testing"
"time"

Expand Down Expand Up @@ -487,6 +488,32 @@ func Test_maintenanceModeUpdater_getAllServices(t *testing.T) {
assert.ErrorIs(t, err, assert.AnError)
assert.ErrorContains(t, err, "failed to get list of all services in namespace [el-espacio-del-nombre]:")
})

t.Run("should return multiple services", func(t *testing.T) {
// given
clientMock := newMockK8sClient(t)
serviceA := corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "A and not equal B"}}
serviceB := corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "B and not equal A"}}
services := []corev1.Service{serviceA, serviceB}
serviceList := &corev1.ServiceList{Items: services}
clientMock.EXPECT().List(testCtx, mock.Anything, mock.Anything).Run(func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) {
c := list.(*corev1.ServiceList)
c.Items = serviceList.Items
}).Return(nil)

sut := &maintenanceModeUpdater{
client: clientMock,
namespace: "el-espacio-del-nombre",
}

// when
result, err := sut.getAllServices(testCtx)

// then
require.NoError(t, err)
assert.Len(t, result, 2)
assert.NotEqual(t, result[0].Name, result[1].Name)
})
}

func Test_maintenanceModeUpdater_deactivateMaintenanceMode(t *testing.T) {
Expand Down

0 comments on commit cdf6280

Please sign in to comment.