Skip to content

Commit

Permalink
e2e: logs for mcsb and placements creation
Browse files Browse the repository at this point in the history
Signed-off-by: Parikshith <[email protected]>
  • Loading branch information
parikshithb committed Feb 7, 2025
1 parent 8634516 commit b3ebbcc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion e2e/deployers/applicationset.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (a ApplicationSet) Deploy(ctx types.Context) error {

log.Infof("Deploying applicationset in namespace %q", managementNamespace)

err := CreateManagedClusterSetBinding(McsbName, managementNamespace)
err := CreateManagedClusterSetBinding(ctx, McsbName, managementNamespace)
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions e2e/deployers/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const (
fMode = 0o600
)

func CreateManagedClusterSetBinding(name, namespace string) error {
func CreateManagedClusterSetBinding(ctx types.Context, name, namespace string) error {
log := ctx.Logger()
labels := make(map[string]string)
labels[AppLabelKey] = namespace
mcsb := &ocmv1b2.ManagedClusterSetBinding{
Expand All @@ -49,6 +50,8 @@ func CreateManagedClusterSetBinding(name, namespace string) error {
},
}

log.Debugf("Creating ManagedClusterSetBinding %q in namespace %q", name, namespace)

err := util.Ctx.Hub.Client.Create(context.Background(), mcsb)
if err != nil {
if !errors.IsAlreadyExists(err) {
Expand Down Expand Up @@ -99,13 +102,15 @@ func CreatePlacement(ctx types.Context, name, namespace string) error {
},
}

log.Debugf("Creating placement %q in namespace %q", name, namespace)

err := util.Ctx.Hub.Client.Create(context.Background(), placement)
if err != nil {
if !errors.IsAlreadyExists(err) {
return err
}

log.Info("Placement already Exists")
log.Debugf("Placement %q already Exists", name)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion e2e/deployers/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s Subscription) Deploy(ctx types.Context) error {
return err
}

err = CreateManagedClusterSetBinding(McsbName, managementNamespace)
err = CreateManagedClusterSetBinding(ctx, McsbName, managementNamespace)
if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion e2e/dractions/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@ func createPlacementManagedByRamen(ctx types.Context, name, namespace string) er
},
}

log.Debugf("Creating placement %q in namespace %q", name, namespace)

err := util.Ctx.Hub.Client.Create(context.Background(), placement)
if err != nil {
if !errors.IsAlreadyExists(err) {
return err
}

log.Info("Placement already Exists")
log.Debugf("Placement %q already Exists", name)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion e2e/dractions/discovered.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func EnableProtectionDiscoveredApps(ctx types.Context) error {
drpcName := name

// create mcsb default in ramen-ops ns
if err := deployers.CreateManagedClusterSetBinding(deployers.McsbName, managementNamespace); err != nil {
if err := deployers.CreateManagedClusterSetBinding(ctx, deployers.McsbName, managementNamespace); err != nil {
return err
}

Expand Down

0 comments on commit b3ebbcc

Please sign in to comment.