Skip to content

Commit 0fd8eab

Browse files
authored
fix: correctly apply webhook configurations (#145)
* fix: correctly apply webhook configurations * feat: release v1.0.2
1 parent 2046463 commit 0fd8eab

File tree

7 files changed

+45
-27
lines changed

7 files changed

+45
-27
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.0.1-dev
1+
v1.0.2

charts/project-workspace-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: project-workspace-operator
33
description: A Helm chart for the project-workspace-operator
44
type: application
5-
version: v1.0.1
6-
appVersion: v1.0.1
5+
version: v1.0.2
6+
appVersion: v1.0.2

charts/project-workspace-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ image:
2020
repository: ghcr.io/openmcp-project/images/project-workspace-operator
2121
pullPolicy: IfNotPresent
2222
# Overrides the image tag whose default is the chart appVersion.
23-
tag: v1.0.1
23+
tag: v1.0.2
2424

2525
imagePullSecrets: []
2626
nameOverride: ""

cmd/project-workspace-operator/app/init.go

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ import (
66
"os"
77
"time"
88

9-
"github.com/spf13/cobra"
10-
rbacv1 "k8s.io/api/rbac/v1"
11-
"k8s.io/apimachinery/pkg/runtime"
12-
"k8s.io/apimachinery/pkg/util/intstr"
13-
"k8s.io/apimachinery/pkg/util/wait"
14-
"sigs.k8s.io/controller-runtime/pkg/client"
15-
169
ctrlutils "github.com/openmcp-project/controller-utils/pkg/controller"
1710
crdutil "github.com/openmcp-project/controller-utils/pkg/crds"
1811
"github.com/openmcp-project/controller-utils/pkg/init/webhooks"
@@ -21,6 +14,12 @@ import (
2114
openmcpconst "github.com/openmcp-project/openmcp-operator/api/constants"
2215
"github.com/openmcp-project/openmcp-operator/lib/clusteraccess"
2316
libutils "github.com/openmcp-project/openmcp-operator/lib/utils"
17+
"github.com/spf13/cobra"
18+
rbacv1 "k8s.io/api/rbac/v1"
19+
"k8s.io/apimachinery/pkg/runtime"
20+
"k8s.io/apimachinery/pkg/util/intstr"
21+
"k8s.io/apimachinery/pkg/util/wait"
22+
"sigs.k8s.io/controller-runtime/pkg/client"
2423

2524
pwv1alpha1 "github.com/openmcp-project/project-workspace-operator/api/core/v1alpha1"
2625
"github.com/openmcp-project/project-workspace-operator/api/crds"
@@ -237,6 +236,19 @@ func (o *InitOptions) Run(ctx context.Context) error {
237236
opts = append(opts, webhooks.WithCustomCA{todo})
238237
*/
239238

239+
webhookTypes := []webhooks.APITypes{
240+
{
241+
Obj: &pwv1alpha1.Project{},
242+
Validator: true,
243+
Defaulter: true,
244+
},
245+
{
246+
Obj: &pwv1alpha1.Workspace{},
247+
Validator: true,
248+
Defaulter: true,
249+
},
250+
}
251+
240252
if !pwc.Spec.Webhook.Disabled {
241253
log.Info("Webhooks are enabled, ensuring required resources ...")
242254

@@ -245,15 +257,14 @@ func (o *InitOptions) Run(ctx context.Context) error {
245257
return fmt.Errorf("unable to generate webhook certificate: %w", err)
246258
}
247259

260+
// Compile-time checks to ensure Project implements the required interfaces
261+
248262
// Install webhooks
249263
err := webhooks.Install(
250264
ctx,
251265
o.PlatformCluster.Client(),
252266
onboardingScheme,
253-
[]client.Object{
254-
&pwv1alpha1.Project{},
255-
&pwv1alpha1.Workspace{},
256-
},
267+
webhookTypes,
257268
installOpts...,
258269
)
259270
if err != nil {
@@ -267,10 +278,7 @@ func (o *InitOptions) Run(ctx context.Context) error {
267278
ctx,
268279
o.PlatformCluster.Client(),
269280
onboardingScheme,
270-
[]client.Object{
271-
&pwv1alpha1.Project{},
272-
&pwv1alpha1.Workspace{},
273-
},
281+
webhookTypes,
274282
installOpts...,
275283
)
276284
if err != nil {

cmd/project-workspace-operator/main.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,25 @@ func (o *Options) runInit() {
231231
installOptions := o.WebhooksFlags.InstallOptions
232232
installOptions = append(installOptions, webhooks.WithRemoteClient{Client: crateClient})
233233

234+
webhookTypes := []webhooks.APITypes{
235+
{
236+
Obj: &pwv1alpha1.Project{},
237+
Validator: true,
238+
Defaulter: true,
239+
},
240+
{
241+
Obj: &pwv1alpha1.Workspace{},
242+
Validator: true,
243+
Defaulter: true,
244+
},
245+
}
246+
234247
// Install webhooks
235248
err := webhooks.Install(
236249
initContext,
237250
setupClient,
238251
scheme,
239-
[]client.Object{
240-
&pwv1alpha1.Project{},
241-
&pwv1alpha1.Workspace{},
242-
},
252+
webhookTypes,
243253
installOptions...,
244254
)
245255
if err != nil {

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ require (
66
github.com/go-logr/logr v1.4.3
77
github.com/onsi/ginkgo/v2 v2.27.2
88
github.com/onsi/gomega v1.38.2
9-
github.com/openmcp-project/controller-utils v0.23.4
10-
github.com/openmcp-project/project-workspace-operator/api v1.0.1
9+
github.com/openmcp-project/controller-utils v0.24.0
10+
github.com/openmcp-project/project-workspace-operator/api v1.0.2
1111
github.com/stretchr/testify v1.11.1
1212
k8s.io/api v0.34.1
1313
k8s.io/apimachinery v0.34.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns
117117
github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
118118
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
119119
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
120-
github.com/openmcp-project/controller-utils v0.23.4 h1:GUPa0tP0kccp5/DheQR9vWfPChEK37KwTpbFHVDQBhc=
121-
github.com/openmcp-project/controller-utils v0.23.4/go.mod h1:zGsvEJ7P+BjRnDQMVreCOp4Lsx5xpFQ36gm2fcVw34w=
120+
github.com/openmcp-project/controller-utils v0.24.0 h1:r8mtA9JEb2GXgH4H60FR/jbe0h4/ZbYnAeHmacMsb0g=
121+
github.com/openmcp-project/controller-utils v0.24.0/go.mod h1:BjMecTCwaSewG7KV0H4P5Y/MeFzI07DGXQstp/dtF7s=
122122
github.com/openmcp-project/openmcp-operator/api v0.17.0 h1:dhRbaGawtRx6Kd4oUbw5gSBnukEsS0xH29aTRjWIevY=
123123
github.com/openmcp-project/openmcp-operator/api v0.17.0/go.mod h1:xW9QjFThR4xntEyfhgGuJ5oRYY4mzoWOoZBjHjBBjPQ=
124124
github.com/openmcp-project/openmcp-operator/lib v0.17.0 h1:42yGu/1LoEd51/noWgr7Bmz33rfHjTm/HKKXlJjHif4=

0 commit comments

Comments
 (0)