From 4610c55c539a52353684a2c5658b1f4b68f00115 Mon Sep 17 00:00:00 2001 From: Simon Beck Date: Thu, 30 May 2024 11:15:39 +0200 Subject: [PATCH 1/3] Test with removed custom throttling --- operator_command.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/operator_command.go b/operator_command.go index 2cdac420..88c2c479 100644 --- a/operator_command.go +++ b/operator_command.go @@ -55,9 +55,6 @@ func (c *operatorCommand) execute(ctx *cli.Context) error { return err }) p.AddStepFromFunc("create manager", func(ctx context.Context) error { - // configure client-side throttling - c.kubeconfig.QPS = 100 - c.kubeconfig.Burst = 150 // more Openshift friendly mgr, err := ctrl.NewManager(c.kubeconfig, ctrl.Options{ // controller-runtime uses both ConfigMaps and Leases for leader election by default. From 4682a262b482e0499e1a33f66493fb128188a226 Mon Sep 17 00:00:00 2001 From: Simon Beck Date: Thu, 30 May 2024 11:34:00 +0200 Subject: [PATCH 2/3] Fix docker build for macos --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 17a42ce2..889e0330 100644 --- a/Makefile +++ b/Makefile @@ -33,11 +33,11 @@ build: build-bin build-docker ## All-in-one build .PHONY: build-bin build-bin: export CGO_ENABLED = 0 build-bin: fmt vet ## Build binary - @go build -o $(BIN_FILENAME) . + @GOOS=linux GOARCH=amd64 go build -o $(BIN_FILENAME) . .PHONY: build-docker build-docker: build-bin ## Build docker image - $(DOCKER_CMD) build -t $(CONTAINER_IMG) . + $(DOCKER_CMD) build -t $(CONTAINER_IMG) . --platform=linux/amd64 .PHONY: test test: test-go ## All-in-one test From 928bd91520d64bbc1453734ca3edc3560fb895c6 Mon Sep 17 00:00:00 2001 From: Gabriel Saratura Date: Thu, 30 May 2024 11:33:57 +0200 Subject: [PATCH 3/3] Fix tls certs --- go.mod | 4 ++-- go.sum | 4 ++++ operator_command.go | 5 +++++ test/controllerconfig-exoscale.yaml | 4 ---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 65a71296..a8a60bc5 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( k8s.io/apimachinery v0.30.1 k8s.io/client-go v0.30.1 k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 - sigs.k8s.io/controller-runtime v0.18.2 + sigs.k8s.io/controller-runtime v0.18.3 sigs.k8s.io/controller-tools v0.15.0 ) @@ -111,7 +111,7 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.30.0 // indirect + k8s.io/apiextensions-apiserver v0.30.1 // indirect k8s.io/klog/v2 v2.120.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/go.sum b/go.sum index 12946fd9..861b5a46 100644 --- a/go.sum +++ b/go.sum @@ -391,6 +391,8 @@ k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY= k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM= k8s.io/apiextensions-apiserver v0.30.0 h1:jcZFKMqnICJfRxTgnC4E+Hpcq8UEhT8B2lhBcQ+6uAs= k8s.io/apiextensions-apiserver v0.30.0/go.mod h1:N9ogQFGcrbWqAY9p2mUAL5mGxsLqwgtUce127VtRX5Y= +k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws= +k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4= k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U= k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q= @@ -403,6 +405,8 @@ k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCI k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.18.2 h1:RqVW6Kpeaji67CY5nPEfRz6ZfFMk0lWQlNrLqlNpx+Q= sigs.k8s.io/controller-runtime v0.18.2/go.mod h1:tuAt1+wbVsXIT8lPtk5RURxqAnq7xkpv2Mhttslg7Hw= +sigs.k8s.io/controller-runtime v0.18.3 h1:B5Wmmo8WMWK7izei+2LlXLVDGzMwAHBNLX68lwtlSR4= +sigs.k8s.io/controller-runtime v0.18.3/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= sigs.k8s.io/controller-tools v0.15.0 h1:4dxdABXGDhIa68Fiwaif0vcu32xfwmgQ+w8p+5CxoAI= sigs.k8s.io/controller-tools v0.15.0/go.mod h1:8zUSS2T8Hx0APCNRhJWbS3CAQEbIxLa07khzh7pZmXM= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/operator_command.go b/operator_command.go index 88c2c479..e39da924 100644 --- a/operator_command.go +++ b/operator_command.go @@ -2,6 +2,7 @@ package main import ( "context" + "sigs.k8s.io/controller-runtime/pkg/webhook" "time" pipeline "github.com/ccremer/go-command-pipeline" @@ -67,6 +68,10 @@ func (c *operatorCommand) execute(ctx *cli.Context) error { LeaderElectionResourceLock: resourcelock.LeasesResourceLock, LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + WebhookServer: webhook.NewServer(webhook.Options{ + Port: 9443, + CertDir: c.WebhookCertDir, + }), }) c.manager = mgr return err diff --git a/test/controllerconfig-exoscale.yaml b/test/controllerconfig-exoscale.yaml index 5d14f513..9a6d9965 100644 --- a/test/controllerconfig-exoscale.yaml +++ b/test/controllerconfig-exoscale.yaml @@ -8,7 +8,3 @@ spec: env: - name: LOG_LEVEL value: "2" - volumeMounts: - - mountPath: /tmp/k8s-webhook-server/serving-certs/ - name: tls-server-certs - readOnly: true