diff --git a/VERSION b/VERSION index c5b0623..b482243 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.0.1-dev \ No newline at end of file +v1.0.2 \ No newline at end of file diff --git a/charts/project-workspace-operator/Chart.yaml b/charts/project-workspace-operator/Chart.yaml index 511dac6..7e1e063 100644 --- a/charts/project-workspace-operator/Chart.yaml +++ b/charts/project-workspace-operator/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: project-workspace-operator description: A Helm chart for the project-workspace-operator type: application -version: v1.0.1 -appVersion: v1.0.1 +version: v1.0.2 +appVersion: v1.0.2 diff --git a/charts/project-workspace-operator/values.yaml b/charts/project-workspace-operator/values.yaml index 47b2736..7bc8039 100644 --- a/charts/project-workspace-operator/values.yaml +++ b/charts/project-workspace-operator/values.yaml @@ -20,7 +20,7 @@ image: repository: ghcr.io/openmcp-project/images/project-workspace-operator pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: v1.0.1 + tag: v1.0.2 imagePullSecrets: [] nameOverride: "" diff --git a/cmd/project-workspace-operator/app/init.go b/cmd/project-workspace-operator/app/init.go index 92cb23b..7a6b109 100644 --- a/cmd/project-workspace-operator/app/init.go +++ b/cmd/project-workspace-operator/app/init.go @@ -6,13 +6,6 @@ import ( "os" "time" - "github.com/spf13/cobra" - rbacv1 "k8s.io/api/rbac/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/intstr" - "k8s.io/apimachinery/pkg/util/wait" - "sigs.k8s.io/controller-runtime/pkg/client" - ctrlutils "github.com/openmcp-project/controller-utils/pkg/controller" crdutil "github.com/openmcp-project/controller-utils/pkg/crds" "github.com/openmcp-project/controller-utils/pkg/init/webhooks" @@ -21,6 +14,12 @@ import ( openmcpconst "github.com/openmcp-project/openmcp-operator/api/constants" "github.com/openmcp-project/openmcp-operator/lib/clusteraccess" libutils "github.com/openmcp-project/openmcp-operator/lib/utils" + "github.com/spf13/cobra" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/wait" + "sigs.k8s.io/controller-runtime/pkg/client" pwv1alpha1 "github.com/openmcp-project/project-workspace-operator/api/core/v1alpha1" "github.com/openmcp-project/project-workspace-operator/api/crds" @@ -237,6 +236,19 @@ func (o *InitOptions) Run(ctx context.Context) error { opts = append(opts, webhooks.WithCustomCA{todo}) */ + webhookTypes := []webhooks.APITypes{ + { + Obj: &pwv1alpha1.Project{}, + Validator: true, + Defaulter: true, + }, + { + Obj: &pwv1alpha1.Workspace{}, + Validator: true, + Defaulter: true, + }, + } + if !pwc.Spec.Webhook.Disabled { log.Info("Webhooks are enabled, ensuring required resources ...") @@ -245,15 +257,14 @@ func (o *InitOptions) Run(ctx context.Context) error { return fmt.Errorf("unable to generate webhook certificate: %w", err) } + // Compile-time checks to ensure Project implements the required interfaces + // Install webhooks err := webhooks.Install( ctx, o.PlatformCluster.Client(), onboardingScheme, - []client.Object{ - &pwv1alpha1.Project{}, - &pwv1alpha1.Workspace{}, - }, + webhookTypes, installOpts..., ) if err != nil { @@ -267,10 +278,7 @@ func (o *InitOptions) Run(ctx context.Context) error { ctx, o.PlatformCluster.Client(), onboardingScheme, - []client.Object{ - &pwv1alpha1.Project{}, - &pwv1alpha1.Workspace{}, - }, + webhookTypes, installOpts..., ) if err != nil { diff --git a/cmd/project-workspace-operator/main.go b/cmd/project-workspace-operator/main.go index ef5263d..b25e215 100644 --- a/cmd/project-workspace-operator/main.go +++ b/cmd/project-workspace-operator/main.go @@ -231,15 +231,25 @@ func (o *Options) runInit() { installOptions := o.WebhooksFlags.InstallOptions installOptions = append(installOptions, webhooks.WithRemoteClient{Client: crateClient}) + webhookTypes := []webhooks.APITypes{ + { + Obj: &pwv1alpha1.Project{}, + Validator: true, + Defaulter: true, + }, + { + Obj: &pwv1alpha1.Workspace{}, + Validator: true, + Defaulter: true, + }, + } + // Install webhooks err := webhooks.Install( initContext, setupClient, scheme, - []client.Object{ - &pwv1alpha1.Project{}, - &pwv1alpha1.Workspace{}, - }, + webhookTypes, installOptions..., ) if err != nil { diff --git a/go.mod b/go.mod index cba5424..8d9f0f0 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/go-logr/logr v1.4.3 github.com/onsi/ginkgo/v2 v2.27.2 github.com/onsi/gomega v1.38.2 - github.com/openmcp-project/controller-utils v0.23.4 - github.com/openmcp-project/project-workspace-operator/api v1.0.1 + github.com/openmcp-project/controller-utils v0.24.0 + github.com/openmcp-project/project-workspace-operator/api v1.0.2 github.com/stretchr/testify v1.11.1 k8s.io/api v0.34.1 k8s.io/apimachinery v0.34.1 diff --git a/go.sum b/go.sum index 2307cc9..545d86b 100644 --- a/go.sum +++ b/go.sum @@ -117,8 +117,8 @@ github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A= github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= -github.com/openmcp-project/controller-utils v0.23.4 h1:GUPa0tP0kccp5/DheQR9vWfPChEK37KwTpbFHVDQBhc= -github.com/openmcp-project/controller-utils v0.23.4/go.mod h1:zGsvEJ7P+BjRnDQMVreCOp4Lsx5xpFQ36gm2fcVw34w= +github.com/openmcp-project/controller-utils v0.24.0 h1:r8mtA9JEb2GXgH4H60FR/jbe0h4/ZbYnAeHmacMsb0g= +github.com/openmcp-project/controller-utils v0.24.0/go.mod h1:BjMecTCwaSewG7KV0H4P5Y/MeFzI07DGXQstp/dtF7s= github.com/openmcp-project/openmcp-operator/api v0.17.0 h1:dhRbaGawtRx6Kd4oUbw5gSBnukEsS0xH29aTRjWIevY= github.com/openmcp-project/openmcp-operator/api v0.17.0/go.mod h1:xW9QjFThR4xntEyfhgGuJ5oRYY4mzoWOoZBjHjBBjPQ= github.com/openmcp-project/openmcp-operator/lib v0.17.0 h1:42yGu/1LoEd51/noWgr7Bmz33rfHjTm/HKKXlJjHif4=