-
Notifications
You must be signed in to change notification settings - Fork 82
Conversation
# Conflicts: # chart/compass/values.yaml
# Conflicts: # chart/compass/values.yaml # components/director/internal/domain/formation/service.go
@@ -1499,7 +1503,7 @@ func (s *service) DeleteAutomaticScenarioAssignment(ctx context.Context, in *mod | |||
return errors.Wrap(err, "while deleting the Assignment") | |||
} | |||
|
|||
if err = s.asaEngine.RemoveAssignedScenario(ctx, in, s.UnassignFormation); err != nil { | |||
if err = s.asaEngine.RemoveAssignedScenario(ctx, in, s.UnassignFormationIgnoreASA); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using UnassignFormationIgnoreASA
instead of UnassignFormation
is not needed as in RemoveAssignedScenario
the ASA is being deleted before using the processing function for unassign.
@@ -267,6 +267,7 @@ func TestServiceUnassignFormation(t *testing.T) { | |||
ObjectType graphql.FormationObjectType | |||
ObjectID string | |||
InputFormation model.Formation | |||
ShouldSkipASA bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test where the value is true
and the scenario is comming from ASA to validate that it will be deleted.
@@ -862,35 +863,46 @@ func (r *Resolver) EventingConfiguration(ctx context.Context, obj *graphql.Runti | |||
// deleteAssociatedScenarioAssignments ensures that scenario assignments which are responsible for creation of certain runtime labels are deleted, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the comment as the ASAs are not actualy deleted now
for _, parentTenantID := range tntMapping.Parents { | ||
ctxWithParentTenant := tenant.SaveToContext(ctx, parentTenantID, "") | ||
|
||
scenariosLbl, err := r.runtimeService.GetLabel(ctxWithParentTenant, runtimeID, model.ScenariosKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scenarioLabel
will soon be removed. Instead of relying on it we should list the ASAs where the Tenant
property of the ASA is amoung the tntMapping.Parents
. Then we can remove the assigned scenarios using the ASAs. This will reduce the complexity and will remove unneeded calls to the DB.
@@ -1509,7 +1513,7 @@ func (s *service) DeleteAutomaticScenarioAssignment(ctx context.Context, in *mod | |||
// RemoveAssignedScenarios removes all the scenarios that are coming from any of the provided ASAs | |||
func (s *service) RemoveAssignedScenarios(ctx context.Context, in []*model.AutomaticScenarioAssignment) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename the method to something like UnassignFormationsCommingFromASA
. The current name is a bit missleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same applies to the asaEngine method as well
|
||
conditions := repo.Or(repo.ConditionTreesFromConditions(scenarioConditions)...) | ||
|
||
if err := r.conditionLister.ListConditionTree(ctx, resource.AutomaticScenarioAssigment, tenantID, &collection, conditions); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the standard lister with repo.NewInConditionForStringValues(scenarioColumn, scenarioNames)
instead of this one
@@ -862,35 +863,46 @@ func (r *Resolver) EventingConfiguration(ctx context.Context, obj *graphql.Runti | |||
// deleteAssociatedScenarioAssignments ensures that scenario assignments which are responsible for creation of certain runtime labels are deleted, | |||
// if runtime doesn't have the scenarios label or is part of a scenario for which no scenario assignment exists => noop | |||
func (r *Resolver) deleteAssociatedScenarioAssignments(ctx context.Context, runtimeID string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the method as we no longer delete the ASAs
/hold |
} | ||
|
||
scenarios, err := labelPkg.ValueToStringsSlice(scenariosLbl.Value) | ||
scenarios, err := r.asaEngine.GetScenariosFromMatchingASAs(ctx, runtimeID, graphql.FormationObjectTypeRuntime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ctxWithParentTenant
@@ -37,6 +38,7 @@ type repository struct { | |||
creator repo.CreatorGlobal | |||
singleGetter repo.SingleGetter | |||
lister repo.Lister | |||
conditionLister repo.ConditionTreeLister |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this lister is unused
# Conflicts: # chart/compass/values.yaml # components/director/internal/domain/root_resolver.go
@la4ezar: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: emmakarova, ognyvrac, StanislavStefanov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
When we delete a runtime that has ASA for it we should delete the associated scenarios labels and ASA for it. The problem is that the scenarios label is in the parent tenant and we are using the child tenant which comes from the context. But there are no such records in the database(for the child) and we don't process the scenarios labels, ASAs, and don't unassign the runtime from the formation.
Changes proposed in this pull request:
Related issue(s)
Pull Request status
chart/compass/values.yaml
is updated