Skip to content

Commit

Permalink
e2e: logs for mcsb and placement functions
Browse files Browse the repository at this point in the history
Add debug logs for Create and delete ManagedClusterSetBinding,
createPlacementManagedByRamen, CreatePlacement and DeletePlacement

Signed-off-by: Parikshith <[email protected]>
  • Loading branch information
parikshithb authored and nirs committed Feb 17, 2025
1 parent ad1b697 commit cfb0395
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 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
19 changes: 15 additions & 4 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 @@ -54,8 +55,12 @@ func CreateManagedClusterSetBinding(name, namespace string) error {
if !errors.IsAlreadyExists(err) {
return err
}

log.Debugf("ManagedClusterSetBinding \"%s/%s\" already exist", namespace, name)
}

log.Debugf("Created ManagedClusterSetBinding \"%s/%s\"", namespace, name)

return nil
}

Expand All @@ -74,9 +79,11 @@ func DeleteManagedClusterSetBinding(ctx types.Context, name, namespace string) e
return err
}

log.Infof("ManagedClusterSetBinding %q not found", name)
log.Debugf("ManagedClusterSetBinding \"%s/%s\" not found", namespace, name)
}

log.Debugf("Deleted ManagedClusterSetBinding \"%s/%s\"", namespace, name)

return nil
}

Expand Down Expand Up @@ -105,9 +112,11 @@ func CreatePlacement(ctx types.Context, name, namespace string) error {
return err
}

log.Info("Placement already Exists")
log.Debugf("Placement \"%s/%s\" already Exists", namespace, name)
}

log.Debugf("Created placement \"%s/%s\"", namespace, name)

return nil
}

Expand All @@ -126,9 +135,11 @@ func DeletePlacement(ctx types.Context, name, namespace string) error {
return err
}

log.Info("Placement not found")
log.Debugf("Placement \"%s/%s\" not found", namespace, name)
}

log.Debugf("Deleted placement \"%s/%s\"", namespace, 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 @@ -135,9 +135,11 @@ func createPlacementManagedByRamen(ctx types.Context, name, namespace string) er
return err
}

log.Info("Placement already Exists")
log.Debugf("Placement \"%s/%s\" already Exists", namespace, name)
}

log.Debugf("Created placement \"%s/%s\"", namespace, 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 @@ -25,7 +25,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 cfb0395

Please sign in to comment.