Skip to content
Open
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
6 changes: 6 additions & 0 deletions e2e/deployers/appset.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package deployers

import (
recipe "github.com/ramendr/recipe/api/v1alpha1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"

"github.com/ramendr/ramen/e2e/config"
Expand Down Expand Up @@ -135,6 +136,11 @@ func (a ApplicationSet) IsDiscovered() bool {
return false
}

// GetRecipe returns nil as ApplicationSet deployer does not use Recipe.
func (a ApplicationSet) GetRecipe(ctx types.TestContext) *recipe.Recipe {
return nil
}

func init() {
register("appset", NewApplicationSet)
}
24 changes: 24 additions & 0 deletions e2e/deployers/disapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ import (
"os"
"time"

recipe "github.com/ramendr/recipe/api/v1alpha1"

"github.com/ramendr/ramen/e2e/config"
"github.com/ramendr/ramen/e2e/recipes"
"github.com/ramendr/ramen/e2e/types"
"github.com/ramendr/ramen/e2e/util"
)

type DiscoveredApp struct {
DeployerSpec config.Deployer
disappRecipe *recipe.Recipe
}

func NewDiscoveredApp(deployer config.Deployer) types.Deployer {
Expand Down Expand Up @@ -118,6 +122,26 @@ func (d DiscoveredApp) IsDiscovered() bool {
return true
}

// GetRecipe returns the recipe associated with the deployer
func (d *DiscoveredApp) GetRecipe(ctx types.TestContext) *recipe.Recipe {
if d.disappRecipe != nil {
return d.disappRecipe
}

if d.shouldGenerateRecipe() {
r, err := recipes.Generate(ctx, d.DeployerSpec.Recipe)
if err == nil {
d.disappRecipe = r
}
}

return d.disappRecipe
}

func (d DiscoveredApp) shouldGenerateRecipe() bool {
return d.DeployerSpec.Recipe != nil && d.DeployerSpec.Recipe.Type == "generate"
}

func DeleteDiscoveredApps(ctx types.TestContext, cluster *types.Cluster, namespace string) error {
if err := deleteDiscoveredApps(ctx, cluster, namespace, false); err != nil {
return err
Expand Down
6 changes: 6 additions & 0 deletions e2e/deployers/subscr.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package deployers

import (
recipe "github.com/ramendr/recipe/api/v1alpha1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
subscriptionv1 "open-cluster-management.io/multicloud-operators-subscription/pkg/apis/apps/v1"

Expand Down Expand Up @@ -151,6 +152,11 @@ func (s Subscription) IsDiscovered() bool {
return false
}

// GetRecipe returns nil as Subscription deployer does not use Recipe.
func (s Subscription) GetRecipe(ctx types.TestContext) *recipe.Recipe {
return nil
}

func init() {
register("subscr", NewSubscription)
}
3 changes: 3 additions & 0 deletions e2e/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type Deployer interface {
DeleteResources(TestContext) error
// WaitForResourcesDelete waits for all workload resources to be deleted
WaitForResourcesDelete(TestContext) error

// GetRecipe returns the recipe associated with the deployer
GetRecipe(TestContext) *recipe.Recipe
}

// nolint:interfacebloat
Expand Down
Loading