Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<feature-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
```


Expand Down
17 changes: 13 additions & 4 deletions pkg/subroutines/featuretoggles.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Loading