From 74a009cfb4ef784874906cb493f4faf06feeec5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20Echterh=C3=B6lter?= Date: Mon, 1 Dec 2025 09:15:04 +0100 Subject: [PATCH] feat: split marketplace feature into account and organization toggles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bastian Echterhölter On-behalf-of: @SAP --- README.md | 34 +++++++++++-------- ...tentconfiguration-account-marketplace.yaml | 0 ...contentconfiguration-main-marketplace.yaml | 0 pkg/subroutines/featuretoggles.go | 17 +++++++--- 4 files changed, 33 insertions(+), 18 deletions(-) rename manifests/features/{feature-enable-marketplace => feature-enable-marketplace-account}/01-platform-mesh-system/contentconfiguration-account-marketplace.yaml (100%) rename manifests/features/{feature-enable-marketplace => feature-enable-marketplace-org}/01-platform-mesh-system/contentconfiguration-main-marketplace.yaml (100%) diff --git a/README.md b/README.md index 4f0c42d..db55123 100644 --- a/README.md +++ b/README.md @@ -151,33 +151,39 @@ spec: Those values are passed 1-1 to the `platform-mesh-operator-components` chart, deployed by the "Deployment" subroutine. -### Feature toggles +### Feature Toggles -Certain features can be toggled by the user via the API: - -#### feature-enable-getting-started +Certain features can be enabled or disabled using feature toggles in the PlatformMesh resource specification. Feature toggles are configured as follows: ```yaml spec: featureToggles: - - name: "feature-enable-getting-started" + - name: "" ``` -This applies the needed ContentConfiguration for the Getting Started UI page. +#### Available Feature Toggles -#### feature-enable-iam +| Feature Toggle Name | Description | +|---------------------|-------------| +| `feature-enable-getting-started` | Applies the ContentConfiguration resources required for the Getting Started UI page | +| `feature-enable-iam` | Applies the ContentConfiguration resources for Identity and Access Management (IAM) integration | +| `feature-enable-marketplace-account` | Applies the ContentConfiguration resources for the Marketplace feature at the account level | +| `feature-enable-marketplace-org` | Applies the ContentConfiguration resources for the Marketplace feature at the organization level | -```yaml -spec: - featureToggles: - - name: "feature-enable-iam" -``` +#### Example Usage -#### feature-enable-marketplace ```yaml +apiVersion: core.platform-mesh.io/v1alpha1 +kind: PlatformMesh +metadata: + name: platform-mesh-sample + namespace: platform-mesh-system spec: featureToggles: - - name: "feature-enable-marketplace" + - name: "feature-enable-getting-started" + - name: "feature-enable-iam" + - name: "feature-enable-marketplace-account" + # ... other configuration ``` diff --git a/manifests/features/feature-enable-marketplace/01-platform-mesh-system/contentconfiguration-account-marketplace.yaml b/manifests/features/feature-enable-marketplace-account/01-platform-mesh-system/contentconfiguration-account-marketplace.yaml similarity index 100% rename from manifests/features/feature-enable-marketplace/01-platform-mesh-system/contentconfiguration-account-marketplace.yaml rename to manifests/features/feature-enable-marketplace-account/01-platform-mesh-system/contentconfiguration-account-marketplace.yaml diff --git a/manifests/features/feature-enable-marketplace/01-platform-mesh-system/contentconfiguration-main-marketplace.yaml b/manifests/features/feature-enable-marketplace-org/01-platform-mesh-system/contentconfiguration-main-marketplace.yaml similarity index 100% rename from manifests/features/feature-enable-marketplace/01-platform-mesh-system/contentconfiguration-main-marketplace.yaml rename to manifests/features/feature-enable-marketplace-org/01-platform-mesh-system/contentconfiguration-main-marketplace.yaml diff --git a/pkg/subroutines/featuretoggles.go b/pkg/subroutines/featuretoggles.go index 78a406e..d90dc7c 100644 --- a/pkg/subroutines/featuretoggles.go +++ b/pkg/subroutines/featuretoggles.go @@ -11,14 +11,15 @@ import ( "github.com/platform-mesh/golang-commons/controller/lifecycle/runtimeobject" "github.com/platform-mesh/golang-commons/errors" "github.com/platform-mesh/golang-commons/logger" - corev1alpha1 "github.com/platform-mesh/platform-mesh-operator/api/v1alpha1" - "github.com/platform-mesh/platform-mesh-operator/internal/config" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" + + corev1alpha1 "github.com/platform-mesh/platform-mesh-operator/api/v1alpha1" + "github.com/platform-mesh/platform-mesh-operator/internal/config" ) const FeatureToggleSubroutineName = "FeatureToggleSubroutine" @@ -86,9 +87,17 @@ func (r *FeatureToggleSubroutine) Process(ctx context.Context, runtimeObj runtim return ctrl.Result{}, opErr } log.Info().Msg("Enabled 'IAM configuration' feature") - case "feature-enable-marketplace": + case "feature-enable-marketplace-account": + // Implement the logic to enable the marketplace feature + _, opErr := r.applyKcpManifests(ctx, inst, operatorCfg, "/feature-enable-marketplace-account") + if opErr != nil { + log.Error().Err(opErr.Err()).Msg("Failed to apply marketplace manifests") + return ctrl.Result{}, opErr + } + log.Info().Msg("Enabled 'Marketplace configuration' feature") + case "feature-enable-marketplace-org": // Implement the logic to enable the marketplace feature - _, opErr := r.applyKcpManifests(ctx, inst, operatorCfg, "/feature-enable-marketplace") + _, opErr := r.applyKcpManifests(ctx, inst, operatorCfg, "/feature-enable-marketplace-org") if opErr != nil { log.Error().Err(opErr.Err()).Msg("Failed to apply marketplace manifests") return ctrl.Result{}, opErr