From df2a18fc36cd4681ba63f154ab7682e3a5b5148b Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 18 Oct 2024 11:02:59 +0200 Subject: [PATCH 1/7] #63 Update cesapp and registry lib --- go.mod | 5 +++-- go.sum | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8d0ab15..d0d77ea 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,9 @@ toolchain go1.22.5 require ( github.com/bombsimon/logrusr/v2 v2.0.1 - github.com/cloudogu/cesapp-lib v0.12.2 + github.com/cloudogu/cesapp-lib v0.14.2 github.com/cloudogu/k8s-dogu-operator v1.2.0 - github.com/cloudogu/k8s-registry-lib v0.3.1 + github.com/cloudogu/k8s-registry-lib v0.5.0 github.com/gin-gonic/gin v1.10.0 github.com/go-logr/logr v1.4.2 github.com/hashicorp/go-multierror v1.1.1 @@ -42,6 +42,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.5 // indirect + github.com/gammazero/toposort v0.1.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/zapr v1.3.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect diff --git a/go.sum b/go.sum index 4ecdcc1..506ed7a 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cloudogu/cesapp-lib v0.12.2 h1:++yK7s69DMCtpIt1nQ2x05cGAe6UH4KnsgEscV7wdq0= github.com/cloudogu/cesapp-lib v0.12.2/go.mod h1:PTQqI3xs1ReJMXYE6BGTF33yAfmS4J7P8UiE4AwDMDY= +github.com/cloudogu/cesapp-lib v0.14.2 h1:AtRsQbS31d71DY7DXUhzwO07ZFI0Gz2+IHOhyeJdBhc= +github.com/cloudogu/cesapp-lib v0.14.2/go.mod h1:52PfkrFYg54FjF8Se8P9b1zOfAhmg3PBFKr7YfS+Q+8= github.com/cloudogu/k8s-dogu-operator v1.2.0 h1:TZ7pkQ2EBinwZMWY7H0/Bs4xVSHIWnQEbA3sWg2CMyc= github.com/cloudogu/k8s-dogu-operator v1.2.0/go.mod h1:GnYsLM82oVlf4szJtJ2XQuOf/B5IcRVj8Wk+7jPPNa0= github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240902154134-ac5de5082fd2 h1:pu0NewkMER/gXRdNV2kE0c6ae6D2j5kF1gLMu11k+dM= @@ -39,6 +41,8 @@ github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240906114853-a5c3c4c9a088 h1:SHL github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240906114853-a5c3c4c9a088/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= github.com/cloudogu/k8s-registry-lib v0.3.1 h1:ew+/CupcQUv9HlFWme/TL9EjaxiCc/4L0gVSg9A1b1k= github.com/cloudogu/k8s-registry-lib v0.3.1/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= +github.com/cloudogu/k8s-registry-lib v0.5.0 h1:mdo8+0cSLicCNyymc8GbTl8ku5sMGA3IR/n5ga2WIvI= +github.com/cloudogu/k8s-registry-lib v0.5.0/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= @@ -82,6 +86,8 @@ github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4= github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4= +github.com/gammazero/toposort v0.1.1 h1:OivGxsWxF3U3+U80VoLJ+f50HcPU1MIqE1JlKzoJ2Eg= +github.com/gammazero/toposort v0.1.1/go.mod h1:H2cozTnNpMw0hg2VHAYsAxmkHXBYroNangj2NTBQDvw= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= From c09d672192598552a53fe01371236ff39bfcb0d1 Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 18 Oct 2024 11:42:43 +0200 Subject: [PATCH 2/7] #63 Use dogu v2 and update go to 1.23.2 --- CHANGELOG.md | 2 + Dockerfile | 2 +- Jenkinsfile | 2 +- Makefile | 2 +- controllers/deploymentController.go | 4 +- controllers/ingressUpdater.go | 12 +- controllers/ingressUpdater_test.go | 38 ++-- controllers/maintenanceModeUpdater.go | 2 +- controllers/serviceController_int_test.go | 6 +- controllers/sslCertificateUpdater_test.go | 4 +- controllers/suite_test.go | 6 +- .../mock_WatchConfigurationContext_test.go | 188 ------------------ go.mod | 12 +- go.sum | 42 +--- main.go | 4 +- 15 files changed, 56 insertions(+), 270 deletions(-) delete mode 100644 controllers/warp/types/mock_WatchConfigurationContext_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a8cf08e..b16731c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ 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). ## [Unreleased] +### Changed +- [#63] Use dogu v2 api ## [v0.15.2] - 2024-09-19 ### Changed diff --git a/Dockerfile b/Dockerfile index 0880c82..b70caea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.22 AS builder +FROM golang:1.23.2 AS builder WORKDIR /workspace diff --git a/Jenkinsfile b/Jenkinsfile index 26db0dc..0fc48ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ github = new GitHub(this, git) changelog = new Changelog(this) Docker docker = new Docker(this) gpg = new Gpg(this, docker) -goVersion = "1.22" +goVersion = "1.23.2" makefile = new Makefile(this) // Configuration of repository diff --git a/Makefile b/Makefile index adbc956..ce674c7 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ ARTIFACT_ID=k8s-service-discovery VERSION=0.15.2 IMAGE=cloudogu/${ARTIFACT_ID}:${VERSION} -GOTAG?=1.22 +GOTAG?=1.23.2 MAKEFILES_VERSION=9.1.0 ADDITIONAL_CLEAN=dist-clean diff --git a/controllers/deploymentController.go b/controllers/deploymentController.go index 9a6c1e7..a907df0 100644 --- a/controllers/deploymentController.go +++ b/controllers/deploymentController.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - k8sv1 "github.com/cloudogu/k8s-dogu-operator/api/v1" + doguv2 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" ctrl "sigs.k8s.io/controller-runtime" @@ -80,7 +80,7 @@ func (r *deploymentReconciler) getDeployment(ctx context.Context, req ctrl.Reque func hasDoguLabel(deployment client.Object) bool { for label := range deployment.GetLabels() { - if label == legacyDoguLabel || label == k8sv1.DoguLabelName { + if label == legacyDoguLabel || label == doguv2.DoguLabelName { return true } } diff --git a/controllers/ingressUpdater.go b/controllers/ingressUpdater.go index a38fe0c..9a4def2 100644 --- a/controllers/ingressUpdater.go +++ b/controllers/ingressUpdater.go @@ -4,8 +4,8 @@ import ( "context" "encoding/json" "fmt" - doguv1 "github.com/cloudogu/k8s-dogu-operator/api/v1" - "github.com/cloudogu/k8s-dogu-operator/controllers/annotation" + doguv2 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" + "github.com/cloudogu/k8s-dogu-operator/v2/controllers/annotation" "github.com/cloudogu/k8s-service-discovery/controllers/dogustart" "github.com/cloudogu/k8s-service-discovery/controllers/util" corev1 "k8s.io/api/core/v1" @@ -160,7 +160,7 @@ func (i *ingressUpdater) getCesServices(service *corev1.Service) ([]CesService, func (i *ingressUpdater) upsertIngressForCesService(ctx context.Context, cesService CesService, service *corev1.Service, isMaintenanceMode bool) error { namespacedName := types.NamespacedName{Name: service.Name, Namespace: service.Namespace} - dogu := &doguv1.Dogu{} + dogu := &doguv2.Dogu{} err := i.client.Get(ctx, namespacedName, dogu) if err != nil { return fmt.Errorf("failed to get dogu for service [%s]: %w", service.Name, err) @@ -190,8 +190,8 @@ func (i *ingressUpdater) upsertIngressForCesService(ctx context.Context, cesServ return err } -func getAdditionalIngressAnnotations(doguService *corev1.Service) (doguv1.IngressAnnotations, error) { - annotations := doguv1.IngressAnnotations(nil) +func getAdditionalIngressAnnotations(doguService *corev1.Service) (doguv2.IngressAnnotations, error) { + annotations := doguv2.IngressAnnotations(nil) annotationsJson, exists := doguService.Annotations[annotation.AdditionalIngressAnnotationsAnnotation] if exists { err := json.Unmarshal([]byte(annotationsJson), &annotations) @@ -203,7 +203,7 @@ func getAdditionalIngressAnnotations(doguService *corev1.Service) (doguv1.Ingres return annotations, nil } -func (i *ingressUpdater) upsertMaintenanceModeIngressObject(ctx context.Context, cesService CesService, service *corev1.Service, dogu *doguv1.Dogu) error { +func (i *ingressUpdater) upsertMaintenanceModeIngressObject(ctx context.Context, cesService CesService, service *corev1.Service, dogu *doguv2.Dogu) error { ctrl.LoggerFrom(ctx).Info(fmt.Sprintf("system is in maintenance mode -> create maintenance ingress object for service [%s]", service.GetName())) annotations := map[string]string{ingressRewriteTargetAnnotation: staticContentBackendRewrite} diff --git a/controllers/ingressUpdater_test.go b/controllers/ingressUpdater_test.go index 131a291..f4059d8 100644 --- a/controllers/ingressUpdater_test.go +++ b/controllers/ingressUpdater_test.go @@ -3,8 +3,8 @@ package controllers import ( "context" "encoding/json" - v1 "github.com/cloudogu/k8s-dogu-operator/api/v1" - "github.com/cloudogu/k8s-dogu-operator/controllers/annotation" + doguv2 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" + "github.com/cloudogu/k8s-dogu-operator/v2/controllers/annotation" registryconfig "github.com/cloudogu/k8s-registry-lib/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -218,7 +218,7 @@ func Test_ingressUpdater_UpdateIngressOfService(t *testing.T) { {Name: "testPort", Port: 55}, }}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() creator, creationError := NewIngressUpdater(clientMock, getGlobalConfigRepoMockWithMaintenance(t, false), myNamespace, myIngressClass, newMockEventRecorder(t)) require.NoError(t, creationError) @@ -259,10 +259,10 @@ func Test_ingressUpdater_UpdateIngressOfService(t *testing.T) { }}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() recorderMock := newMockEventRecorder(t) - recorderMock.EXPECT().Eventf(mock.IsType(&v1.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") + recorderMock.EXPECT().Eventf(mock.IsType(&doguv2.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") creator, creationError := NewIngressUpdater(clientMock, getGlobalConfigRepoMockWithMaintenance(t, false), myNamespace, myIngressClass, recorderMock) require.NoError(t, creationError) @@ -300,10 +300,10 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { Namespace: myNamespace, Labels: map[string]string{"dogu.name": "test"}}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() recorderMock := newMockEventRecorder(t) - recorderMock.EXPECT().Eventf(mock.IsType(&v1.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") + recorderMock.EXPECT().Eventf(mock.IsType(&doguv2.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, recorderMock) require.NoError(t, creationError) @@ -355,10 +355,10 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { Namespace: myNamespace, Labels: map[string]string{"dogu.name": "test"}}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() recorderMock := newMockEventRecorder(t) - recorderMock.EXPECT().Eventf(mock.IsType(&v1.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") + recorderMock.EXPECT().Eventf(mock.IsType(&doguv2.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, recorderMock) require.NoError(t, creationError) @@ -413,10 +413,10 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { }, }, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() recorderMock := newMockEventRecorder(t) - recorderMock.EXPECT().Eventf(mock.IsType(&v1.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") + recorderMock.EXPECT().Eventf(mock.IsType(&doguv2.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, recorderMock) require.NoError(t, creationError) @@ -473,7 +473,7 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { }, }, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, nil) @@ -506,10 +506,10 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { Namespace: myNamespace, Labels: map[string]string{"dogu.name": doguName}}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: doguName, Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: doguName, Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() recorderMock := newMockEventRecorder(t) - recorderMock.EXPECT().Eventf(mock.IsType(&v1.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", doguName) + recorderMock.EXPECT().Eventf(mock.IsType(&doguv2.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", doguName) creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, recorderMock) require.NoError(t, creationError) @@ -557,10 +557,10 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { service := corev1.Service{ ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() recorderMock := newMockEventRecorder(t) - recorderMock.EXPECT().Eventf(mock.IsType(&v1.Dogu{}), "Normal", "IngressCreation", "Ingress for service [%s] has been updated to maintenance mode.", "test") + recorderMock.EXPECT().Eventf(mock.IsType(&doguv2.Dogu{}), "Normal", "IngressCreation", "Ingress for service [%s] has been updated to maintenance mode.", "test") creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, recorderMock) require.NoError(t, creationError) @@ -607,7 +607,7 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { Namespace: myNamespace, Labels: map[string]string{"dogu.name": "test"}}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu).Build() creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, newMockEventRecorder(t)) require.NoError(t, creationError) @@ -683,10 +683,10 @@ func Test_ingressUpdater_upsertIngressForCesService(t *testing.T) { }, }}}}}}}}}, } - dogu := &v1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "test", Namespace: myNamespace}} clientMock := testclient.NewClientBuilder().WithScheme(getScheme()).WithObjects(dogu, existingIngress).Build() recorderMock := newMockEventRecorder(t) - recorderMock.EXPECT().Eventf(mock.IsType(&v1.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") + recorderMock.EXPECT().Eventf(mock.IsType(&doguv2.Dogu{}), "Normal", "IngressCreation", "Created regular ingress for service [%s].", "test") creator, creationError := NewIngressUpdater(clientMock, nil, myNamespace, myIngressClass, recorderMock) require.NoError(t, creationError) diff --git a/controllers/maintenanceModeUpdater.go b/controllers/maintenanceModeUpdater.go index f42c718..1eabee3 100644 --- a/controllers/maintenanceModeUpdater.go +++ b/controllers/maintenanceModeUpdater.go @@ -7,7 +7,7 @@ import ( "github.com/cloudogu/k8s-registry-lib/repository" "strings" - k8sv1 "github.com/cloudogu/k8s-dogu-operator/api/v1" + k8sv1 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" "github.com/hashicorp/go-multierror" appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" diff --git a/controllers/serviceController_int_test.go b/controllers/serviceController_int_test.go index 15c279c..ef57fcb 100644 --- a/controllers/serviceController_int_test.go +++ b/controllers/serviceController_int_test.go @@ -7,7 +7,7 @@ import ( "context" _ "embed" "fmt" - doguv1 "github.com/cloudogu/k8s-dogu-operator/api/v1" + doguv2 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" "github.com/cloudogu/k8s-registry-lib/repository" "github.com/cloudogu/k8s-service-discovery/controllers/dogustart" "k8s.io/api/apps/v1" @@ -96,10 +96,10 @@ var _ = Describe("Creating ingress objects with the ingress generator", func() { It("Should do nothing if service without annotations", func() { By("Create dogu") - dogu := &doguv1.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "nexus", Namespace: myNamespace}} + dogu := &doguv2.Dogu{ObjectMeta: metav1.ObjectMeta{Name: "nexus", Namespace: myNamespace}} Expect(k8sApiClient.Create(context.Background(), dogu)).Should(Succeed()) Eventually(func() bool { - err := k8sApiClient.Get(ctx, types.NamespacedName{Name: "nexus", Namespace: myNamespace}, &doguv1.Dogu{}) + err := k8sApiClient.Get(ctx, types.NamespacedName{Name: "nexus", Namespace: myNamespace}, &doguv2.Dogu{}) return err == nil }, timeoutInterval, pollingInterval).Should(BeTrue()) diff --git a/controllers/sslCertificateUpdater_test.go b/controllers/sslCertificateUpdater_test.go index 7dcbb01..8dcc989 100644 --- a/controllers/sslCertificateUpdater_test.go +++ b/controllers/sslCertificateUpdater_test.go @@ -2,7 +2,7 @@ package controllers import ( "context" - doguv1 "github.com/cloudogu/k8s-dogu-operator/api/v1" + doguv2 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" "github.com/cloudogu/k8s-registry-lib/config" "github.com/cloudogu/k8s-registry-lib/repository" "github.com/stretchr/testify/assert" @@ -28,7 +28,7 @@ func getScheme() *runtime.Scheme { Group: "k8s.cloudogu.com", Version: "v1", Kind: "Dogu", - }, &doguv1.Dogu{}) + }, &doguv2.Dogu{}) return scheme } diff --git a/controllers/suite_test.go b/controllers/suite_test.go index da76223..c954108 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -6,7 +6,7 @@ package controllers import ( "context" "fmt" - doguv1 "github.com/cloudogu/k8s-dogu-operator/api/v1" + doguv2 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" "github.com/cloudogu/k8s-registry-lib/config" "github.com/cloudogu/k8s-registry-lib/repository" "github.com/stretchr/testify/mock" @@ -63,12 +63,12 @@ var _ = BeforeSuite(func() { ctx, cancel = context.WithCancel(context.TODO()) testScheme := scheme.Scheme - err := doguv1.AddToScheme(testScheme) + err := doguv2.AddToScheme(testScheme) Expect(err).NotTo(HaveOccurred()) By("bootstrapping test environment") testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "vendor", "github.com", "cloudogu", "k8s-dogu-operator", "api", "v1")}, + CRDDirectoryPaths: []string{filepath.Join("..", "vendor", "github.com", "cloudogu", "k8s-dogu-operator", "v2", "api", "v2")}, ErrorIfCRDPathMissing: true, Scheme: testScheme, } diff --git a/controllers/warp/types/mock_WatchConfigurationContext_test.go b/controllers/warp/types/mock_WatchConfigurationContext_test.go deleted file mode 100644 index e043859..0000000 --- a/controllers/warp/types/mock_WatchConfigurationContext_test.go +++ /dev/null @@ -1,188 +0,0 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. - -package types - -import ( - context "context" - - client "go.etcd.io/etcd/client/v2" - - mock "github.com/stretchr/testify/mock" -) - -// MockWatchConfigurationContext is an autogenerated mock type for the WatchConfigurationContext type -type MockWatchConfigurationContext struct { - mock.Mock -} - -type MockWatchConfigurationContext_Expecter struct { - mock *mock.Mock -} - -func (_m *MockWatchConfigurationContext) EXPECT() *MockWatchConfigurationContext_Expecter { - return &MockWatchConfigurationContext_Expecter{mock: &_m.Mock} -} - -// Get provides a mock function with given fields: key -func (_m *MockWatchConfigurationContext) Get(key string) (string, error) { - ret := _m.Called(key) - - if len(ret) == 0 { - panic("no return value specified for Get") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(string) (string, error)); ok { - return rf(key) - } - if rf, ok := ret.Get(0).(func(string) string); ok { - r0 = rf(key) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(key) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockWatchConfigurationContext_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' -type MockWatchConfigurationContext_Get_Call struct { - *mock.Call -} - -// Get is a helper method to define mock.On call -// - key string -func (_e *MockWatchConfigurationContext_Expecter) Get(key interface{}) *MockWatchConfigurationContext_Get_Call { - return &MockWatchConfigurationContext_Get_Call{Call: _e.mock.On("Get", key)} -} - -func (_c *MockWatchConfigurationContext_Get_Call) Run(run func(key string)) *MockWatchConfigurationContext_Get_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockWatchConfigurationContext_Get_Call) Return(_a0 string, _a1 error) *MockWatchConfigurationContext_Get_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockWatchConfigurationContext_Get_Call) RunAndReturn(run func(string) (string, error)) *MockWatchConfigurationContext_Get_Call { - _c.Call.Return(run) - return _c -} - -// GetChildrenPaths provides a mock function with given fields: key -func (_m *MockWatchConfigurationContext) GetChildrenPaths(key string) ([]string, error) { - ret := _m.Called(key) - - if len(ret) == 0 { - panic("no return value specified for GetChildrenPaths") - } - - var r0 []string - var r1 error - if rf, ok := ret.Get(0).(func(string) ([]string, error)); ok { - return rf(key) - } - if rf, ok := ret.Get(0).(func(string) []string); ok { - r0 = rf(key) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(key) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockWatchConfigurationContext_GetChildrenPaths_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetChildrenPaths' -type MockWatchConfigurationContext_GetChildrenPaths_Call struct { - *mock.Call -} - -// GetChildrenPaths is a helper method to define mock.On call -// - key string -func (_e *MockWatchConfigurationContext_Expecter) GetChildrenPaths(key interface{}) *MockWatchConfigurationContext_GetChildrenPaths_Call { - return &MockWatchConfigurationContext_GetChildrenPaths_Call{Call: _e.mock.On("GetChildrenPaths", key)} -} - -func (_c *MockWatchConfigurationContext_GetChildrenPaths_Call) Run(run func(key string)) *MockWatchConfigurationContext_GetChildrenPaths_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockWatchConfigurationContext_GetChildrenPaths_Call) Return(_a0 []string, _a1 error) *MockWatchConfigurationContext_GetChildrenPaths_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockWatchConfigurationContext_GetChildrenPaths_Call) RunAndReturn(run func(string) ([]string, error)) *MockWatchConfigurationContext_GetChildrenPaths_Call { - _c.Call.Return(run) - return _c -} - -// Watch provides a mock function with given fields: ctx, key, recursive, eventChannel -func (_m *MockWatchConfigurationContext) Watch(ctx context.Context, key string, recursive bool, eventChannel chan *client.Response) { - _m.Called(ctx, key, recursive, eventChannel) -} - -// MockWatchConfigurationContext_Watch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Watch' -type MockWatchConfigurationContext_Watch_Call struct { - *mock.Call -} - -// Watch is a helper method to define mock.On call -// - ctx context.Context -// - key string -// - recursive bool -// - eventChannel chan *client.Response -func (_e *MockWatchConfigurationContext_Expecter) Watch(ctx interface{}, key interface{}, recursive interface{}, eventChannel interface{}) *MockWatchConfigurationContext_Watch_Call { - return &MockWatchConfigurationContext_Watch_Call{Call: _e.mock.On("Watch", ctx, key, recursive, eventChannel)} -} - -func (_c *MockWatchConfigurationContext_Watch_Call) Run(run func(ctx context.Context, key string, recursive bool, eventChannel chan *client.Response)) *MockWatchConfigurationContext_Watch_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(bool), args[3].(chan *client.Response)) - }) - return _c -} - -func (_c *MockWatchConfigurationContext_Watch_Call) Return() *MockWatchConfigurationContext_Watch_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWatchConfigurationContext_Watch_Call) RunAndReturn(run func(context.Context, string, bool, chan *client.Response)) *MockWatchConfigurationContext_Watch_Call { - _c.Call.Return(run) - return _c -} - -// NewMockWatchConfigurationContext creates a new instance of MockWatchConfigurationContext. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockWatchConfigurationContext(t interface { - mock.TestingT - Cleanup(func()) -}) *MockWatchConfigurationContext { - mock := &MockWatchConfigurationContext{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/go.mod b/go.mod index d0d77ea..1b708dc 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,11 @@ module github.com/cloudogu/k8s-service-discovery -go 1.22.0 - -toolchain go1.22.5 +go 1.23.2 require ( github.com/bombsimon/logrusr/v2 v2.0.1 github.com/cloudogu/cesapp-lib v0.14.2 - github.com/cloudogu/k8s-dogu-operator v1.2.0 + github.com/cloudogu/k8s-dogu-operator/v2 v2.2.1 github.com/cloudogu/k8s-registry-lib v0.5.0 github.com/gin-gonic/gin v1.10.0 github.com/go-logr/logr v1.4.2 @@ -18,7 +16,6 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.9.0 github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f - go.etcd.io/etcd/client/v2 v2.305.15 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.31.0 k8s.io/apimachinery v0.31.0 @@ -84,8 +81,9 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect github.com/x448/float16 v0.8.4 // indirect - go.etcd.io/etcd/api/v3 v3.5.15 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect + go.etcd.io/etcd/api/v3 v3.5.14 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect + go.etcd.io/etcd/client/v2 v2.305.13 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/arch v0.9.0 // indirect diff --git a/go.sum b/go.sum index 506ed7a..83108f0 100644 --- a/go.sum +++ b/go.sum @@ -17,30 +17,10 @@ github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK3 github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloudogu/cesapp-lib v0.12.2 h1:++yK7s69DMCtpIt1nQ2x05cGAe6UH4KnsgEscV7wdq0= -github.com/cloudogu/cesapp-lib v0.12.2/go.mod h1:PTQqI3xs1ReJMXYE6BGTF33yAfmS4J7P8UiE4AwDMDY= github.com/cloudogu/cesapp-lib v0.14.2 h1:AtRsQbS31d71DY7DXUhzwO07ZFI0Gz2+IHOhyeJdBhc= github.com/cloudogu/cesapp-lib v0.14.2/go.mod h1:52PfkrFYg54FjF8Se8P9b1zOfAhmg3PBFKr7YfS+Q+8= -github.com/cloudogu/k8s-dogu-operator v1.2.0 h1:TZ7pkQ2EBinwZMWY7H0/Bs4xVSHIWnQEbA3sWg2CMyc= -github.com/cloudogu/k8s-dogu-operator v1.2.0/go.mod h1:GnYsLM82oVlf4szJtJ2XQuOf/B5IcRVj8Wk+7jPPNa0= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240902154134-ac5de5082fd2 h1:pu0NewkMER/gXRdNV2kE0c6ae6D2j5kF1gLMu11k+dM= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240902154134-ac5de5082fd2/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240903085344-8243d9b2a921 h1:CvL2tOOEY3wKIZ3bmnvxXHSwL+BO+Nn0Ok2js2U+02k= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240903085344-8243d9b2a921/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240903144847-29a402fef2a4 h1:q+CzYCvPN6Md8Pl0NBSIO+/FFXVTw/9UKlSpjg2/mPY= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240903144847-29a402fef2a4/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904061508-05f892e03923 h1:pqkZfUFgSgfgcly/hi1llGA3GaB3T1jyDx3jhPnFGTk= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904061508-05f892e03923/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904064049-025690531ee0 h1:e85GZ10DOYeRiN8a7InB88P8wERJabf36gSFxhGXYK8= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904064049-025690531ee0/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904095659-19d33e7cb7b8 h1:DXkyNYhuKrfVZGAgPTIfhvXmFu16FgxclOXfItmgeow= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904095659-19d33e7cb7b8/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904125215-38d25f37caf9 h1:iBnsM5N/4RJwLjIf1nNw/TZLyibavvBaWP7AzIDmnzE= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240904125215-38d25f37caf9/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240906114853-a5c3c4c9a088 h1:SHL35qUOd7vaE1VbZp0kn6aMbMwp6vRY6NcP/ufk1qM= -github.com/cloudogu/k8s-registry-lib v0.2.2-0.20240906114853-a5c3c4c9a088/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= -github.com/cloudogu/k8s-registry-lib v0.3.1 h1:ew+/CupcQUv9HlFWme/TL9EjaxiCc/4L0gVSg9A1b1k= -github.com/cloudogu/k8s-registry-lib v0.3.1/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= +github.com/cloudogu/k8s-dogu-operator/v2 v2.2.1 h1:/fMddoTvhBtr7QD9oyryszQ1DLm55a/o27MggOjRCkQ= +github.com/cloudogu/k8s-dogu-operator/v2 v2.2.1/go.mod h1:yfvaFn951pWxFMapJmEz2ZPpT5unEOcTwEhspGehNYQ= github.com/cloudogu/k8s-registry-lib v0.5.0 h1:mdo8+0cSLicCNyymc8GbTl8ku5sMGA3IR/n5ga2WIvI= github.com/cloudogu/k8s-registry-lib v0.5.0/go.mod h1:OHIrWCAOcc4nlmBK8G+vdHHJ8vo5QQvKCKIGTiFwYBo= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= @@ -151,8 +131,6 @@ github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQu github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -197,8 +175,6 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/spdystream v0.4.0 h1:Vy79D6mHeJJjiPdFEL2yku1kl0chZpJfZcPpb16BRl8= -github.com/moby/spdystream v0.4.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= @@ -216,8 +192,6 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -299,12 +273,12 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk= -go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM= -go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA= -go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU= -go.etcd.io/etcd/client/v2 v2.305.15 h1:VG2xbf8Vz1KJh65Ar2V5eDmfkp1bpzkSEHlhJM3usp8= -go.etcd.io/etcd/client/v2 v2.305.15/go.mod h1:Ad5dRjPVb/n5yXgAWQ/hXzuXXkBk0Y658ocuXYaUU48= +go.etcd.io/etcd/api/v3 v3.5.14 h1:vHObSCxyB9zlF60w7qzAdTcGaglbJOpSj1Xj9+WGxq0= +go.etcd.io/etcd/api/v3 v3.5.14/go.mod h1:BmtWcRlQvwa1h3G2jvKYwIQy4PkHlDej5t7uLMUdJUU= +go.etcd.io/etcd/client/pkg/v3 v3.5.14 h1:SaNH6Y+rVEdxfpA2Jr5wkEvN6Zykme5+YnbCkxvuWxQ= +go.etcd.io/etcd/client/pkg/v3 v3.5.14/go.mod h1:8uMgAokyG1czCtIdsq+AGyYQMvpIKnSvPjFMunkgeZI= +go.etcd.io/etcd/client/v2 v2.305.13 h1:RWfV1SX5jTU0lbCvpVQe3iPQeAHETWdOTb6pxhd77C8= +go.etcd.io/etcd/client/v2 v2.305.13/go.mod h1:iQnL7fepbiomdXMb3om1rHq96htNNGv2sJkEcZGDRRg= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= diff --git a/main.go b/main.go index 2a0968a..c946810 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook" // +kubebuilder:scaffold:imports - "github.com/cloudogu/k8s-dogu-operator/api/v1" + "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" "github.com/cloudogu/k8s-service-discovery/controllers" "github.com/cloudogu/k8s-service-discovery/controllers/logging" @@ -56,7 +56,7 @@ type k8sManager interface { func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(v1.AddToScheme(scheme)) + utilruntime.Must(v2.AddToScheme(scheme)) // +kubebuilder:scaffold:scheme if err := logging.ConfigureLogger(); err != nil { From 45aad3a4e8c851dc3b0de33c4ff7c99fa6c45064 Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 18 Oct 2024 11:56:28 +0200 Subject: [PATCH 3/7] #63 Update makefiles --- Makefile | 2 +- build/make/bats.mk | 2 +- build/make/bats/Dockerfile | 4 +++- build/make/build.mk | 2 +- build/make/k8s.mk | 2 +- build/make/static-analysis.mk | 4 ++-- build/make/vulnerability-scan.mk | 13 +++++++++++++ 7 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 build/make/vulnerability-scan.mk diff --git a/Makefile b/Makefile index ce674c7..506bcf2 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ VERSION=0.15.2 IMAGE=cloudogu/${ARTIFACT_ID}:${VERSION} GOTAG?=1.23.2 -MAKEFILES_VERSION=9.1.0 +MAKEFILES_VERSION=9.3.1 ADDITIONAL_CLEAN=dist-clean diff --git a/build/make/bats.mk b/build/make/bats.mk index ce1319c..7e73553 100644 --- a/build/make/bats.mk +++ b/build/make/bats.mk @@ -9,7 +9,7 @@ BATS_SUPPORT=$(BATS_LIBRARY_DIR)/bats-support BATS_FILE=$(BATS_LIBRARY_DIR)/bats-file BATS_BASE_IMAGE?=bats/bats BATS_CUSTOM_IMAGE?=cloudogu/bats -BATS_TAG?=1.2.1 +BATS_TAG?=1.11.0 BATS_DIR=build/make/bats BATS_WORKDIR="${WORKDIR}"/"${BATS_DIR}" diff --git a/build/make/bats/Dockerfile b/build/make/bats/Dockerfile index 428ee05..7167a94 100644 --- a/build/make/bats/Dockerfile +++ b/build/make/bats/Dockerfile @@ -1,7 +1,9 @@ ARG BATS_BASE_IMAGE ARG BATS_TAG -FROM ${BATS_BASE_IMAGE}:${BATS_TAG} +FROM ${BATS_BASE_IMAGE:-bats/bats}:${BATS_TAG:-1.11.0} # Make bash more findable by scripts and tests RUN apk add make git bash +# suppress git "detected dubious ownership" error/warning for repos which are checked out later +RUN git config --global --add safe.directory /workspace \ No newline at end of file diff --git a/build/make/build.mk b/build/make/build.mk index 857c11d..d3581de 100644 --- a/build/make/build.mk +++ b/build/make/build.mk @@ -3,7 +3,7 @@ ADDITIONAL_LDFLAGS?=-extldflags -static LDFLAGS?=-ldflags "$(ADDITIONAL_LDFLAGS) -X main.Version=$(VERSION) -X main.CommitID=$(COMMIT_ID)" GOIMAGE?=golang -GOTAG?=1.22 +GOTAG?=1.23 GOOS?=linux GOARCH?=amd64 PRE_COMPILE?= diff --git a/build/make/k8s.mk b/build/make/k8s.mk index 9f798f4..2b79315 100644 --- a/build/make/k8s.mk +++ b/build/make/k8s.mk @@ -138,7 +138,7 @@ ${K8S_RESOURCE_TEMP_FOLDER}: ##@ K8s - Docker .PHONY: docker-build -docker-build: check-docker-credentials check-k8s-image-env-var ## Builds the docker image of the K8s app. +docker-build: check-docker-credentials check-k8s-image-env-var ${BINARY_YQ} ## Builds the docker image of the K8s app. @echo "Building docker image $(IMAGE)..." @DOCKER_BUILDKIT=1 docker build . -t $(IMAGE) diff --git a/build/make/static-analysis.mk b/build/make/static-analysis.mk index 0ed0de3..00c406f 100644 --- a/build/make/static-analysis.mk +++ b/build/make/static-analysis.mk @@ -2,12 +2,12 @@ STATIC_ANALYSIS_DIR=$(TARGET_DIR)/static-analysis GOIMAGE?=golang -GOTAG?=1.22 +GOTAG?=1.23 CUSTOM_GO_MOUNT?=-v /tmp:/tmp REVIEW_DOG=$(TMP_DIR)/bin/reviewdog LINT=$(TMP_DIR)/bin/golangci-lint -LINT_VERSION?=v1.58.2 +LINT_VERSION?=v1.61.0 # ignore tests and mocks LINTFLAGS=--tests=false --exclude-files="^.*_mock.go$$" --exclude-files="^.*/mock.*.go$$" --timeout 10m --issues-exit-code 0 ADDITIONAL_LINTER=-E bodyclose -E containedctx -E contextcheck -E decorder -E dupl -E errname -E forcetypeassert -E funlen -E unparam diff --git a/build/make/vulnerability-scan.mk b/build/make/vulnerability-scan.mk new file mode 100644 index 0000000..5698206 --- /dev/null +++ b/build/make/vulnerability-scan.mk @@ -0,0 +1,13 @@ +##@ Vulnerability scan + +GOVULNCHECK_BIN=${UTILITY_BIN_PATH}/govulncheck +GOVULNCHECK_VERSION?=latest + +${GOVULNCHECK_BIN}: ${UTILITY_BIN_PATH} + $(call go-get-tool,$(GOVULNCHECK_BIN),golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION)) + +.PHONY: govulncheck +govulncheck: ${GOVULNCHECK_BIN} ## This target is used to scan the go repository against known vulnerabilities + @echo "Start vulnerability against repository" + ${GOVULNCHECK_BIN} -show verbose ./... + @echo "Finished scan" \ No newline at end of file From cc6502351d90e2c0013e30ede4bc2e0d2ceabd51 Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 18 Oct 2024 12:00:01 +0200 Subject: [PATCH 4/7] #63 Update ces-build-lib --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0fc48ae..8c520b7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ #!groovy -@Library(['github.com/cloudogu/ces-build-lib@1.68.0']) +@Library(['github.com/cloudogu/ces-build-lib@2.5.0']) import com.cloudogu.ces.cesbuildlib.* // Creating necessary git objects From 0d2bb8c9bac9b235acef10a529fb439d47839305 Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 18 Oct 2024 13:41:21 +0200 Subject: [PATCH 5/7] #63 Refactoring --- controllers/maintenanceModeUpdater.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/maintenanceModeUpdater.go b/controllers/maintenanceModeUpdater.go index 1eabee3..bd0b30d 100644 --- a/controllers/maintenanceModeUpdater.go +++ b/controllers/maintenanceModeUpdater.go @@ -7,7 +7,7 @@ import ( "github.com/cloudogu/k8s-registry-lib/repository" "strings" - k8sv1 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" + doguv2 "github.com/cloudogu/k8s-dogu-operator/v2/api/v2" "github.com/hashicorp/go-multierror" appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" @@ -144,7 +144,7 @@ func (mmu *maintenanceModeUpdater) handleMaintenanceModeUpdate(ctx context.Conte func (mmu *maintenanceModeUpdater) restartStaticNginxPod(ctx context.Context) error { podList := &v1.PodList{} - staticNginxRequirement, _ := labels.NewRequirement(k8sv1.DoguLabelName, selection.Equals, []string{"nginx-static"}) + staticNginxRequirement, _ := labels.NewRequirement(doguv2.DoguLabelName, selection.Equals, []string{"nginx-static"}) err := mmu.client.List(ctx, podList, &client.ListOptions{Namespace: mmu.namespace, LabelSelector: labels.NewSelector().Add(*staticNginxRequirement)}) if err != nil { return fmt.Errorf("failed to list [%s] pods: %w", "nginx-static", err) @@ -247,7 +247,7 @@ func rewriteNonSimpleServiceRoute(ctx context.Context, cli k8sClient, recorder e return nil } - if service.Spec.Selector[k8sv1.DoguLabelName] == "" { + if service.Spec.Selector[doguv2.DoguLabelName] == "" { return nil } @@ -260,10 +260,10 @@ func rewriteNonSimpleServiceRoute(ctx context.Context, cli k8sClient, recorder e var serviceEventMsg string if rewriteToMaintenance { serviceEventMsg = "Maintenance mode was activated, rewriting exposed service %s" - service.Spec.Selector = map[string]string{k8sv1.DoguLabelName: exposedServiceMaintenanceSelectorKey} + service.Spec.Selector = map[string]string{doguv2.DoguLabelName: exposedServiceMaintenanceSelectorKey} } else { serviceEventMsg = "Maintenance mode was deactivated, restoring exposed service %s" - service.Spec.Selector = map[string]string{k8sv1.DoguLabelName: service.Labels[k8sv1.DoguLabelName]} + service.Spec.Selector = map[string]string{doguv2.DoguLabelName: service.Labels[doguv2.DoguLabelName]} } recorder.Eventf(service, v1.EventTypeNormal, maintenanceChangeEventReason, serviceEventMsg, service.Name) @@ -276,5 +276,5 @@ func rewriteNonSimpleServiceRoute(ctx context.Context, cli k8sClient, recorder e } func isServiceNginxRelated(service *v1.Service) bool { - return strings.HasPrefix(service.Spec.Selector[k8sv1.DoguLabelName], "nginx-") + return strings.HasPrefix(service.Spec.Selector[doguv2.DoguLabelName], "nginx-") } From 5220c06fef9fe53cb0c078ab736a52ed1488020f Mon Sep 17 00:00:00 2001 From: meiserloh Date: Fri, 18 Oct 2024 13:57:37 +0200 Subject: [PATCH 6/7] Bump version --- Dockerfile | 2 +- Makefile | 2 +- k8s/helm/component-patch-tpl.yaml | 2 +- k8s/helm/values.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b70caea..6cda9dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ RUN make compile-generic FROM gcr.io/distroless/static:nonroot LABEL maintainer="hello@cloudogu.com" \ NAME="k8s-service-discovery" \ - VERSION="0.15.2" + VERSION="1.0.0" WORKDIR / diff --git a/Makefile b/Makefile index 506bcf2..089522f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Set these to the desired values ARTIFACT_ID=k8s-service-discovery -VERSION=0.15.2 +VERSION=1.0.0 IMAGE=cloudogu/${ARTIFACT_ID}:${VERSION} GOTAG?=1.23.2 diff --git a/k8s/helm/component-patch-tpl.yaml b/k8s/helm/component-patch-tpl.yaml index a21cb5e..999950a 100644 --- a/k8s/helm/component-patch-tpl.yaml +++ b/k8s/helm/component-patch-tpl.yaml @@ -1,7 +1,7 @@ apiVersion: v1 values: images: - serviceDiscovery: cloudogu/k8s-service-discovery:0.15.2 + serviceDiscovery: cloudogu/k8s-service-discovery:1.0.0 kubeRbacProxy: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1 patches: values.yaml: diff --git a/k8s/helm/values.yaml b/k8s/helm/values.yaml index dc875fa..c749cd2 100644 --- a/k8s/helm/values.yaml +++ b/k8s/helm/values.yaml @@ -33,7 +33,7 @@ kubeRbacProxy: manager: image: repository: cloudogu/k8s-service-discovery - tag: 0.15.2 + tag: 1.0.0 env: logLevel: info stage: production From 4c01e75ce385b765b84292d7eec2ade7b82f4973 Mon Sep 17 00:00:00 2001 From: meiserloh Date: Fri, 18 Oct 2024 13:57:43 +0200 Subject: [PATCH 7/7] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b16731c..e3bae1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ 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). ## [Unreleased] + +## [v1.0.0] - 2024-10-18 ### Changed - [#63] Use dogu v2 api