Skip to content

Commit

Permalink
fix: do not generate plan IDs for v2
Browse files Browse the repository at this point in the history
see: https://gravitee.atlassian.net/browse/GKO-772

fix: set default syncFrom for v4 APIs

see: https://gravitee.atlassian.net/browse/GKO-771

fix: do no set plan IDs for V2 APis

see: https://gravitee.atlassian.net/browse/GKO-772
  • Loading branch information
kamiiiel committed Nov 13, 2024
1 parent 3e4f52d commit 41c257c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha1/apiv2definition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ func (api *ApiDefinition) generateEmptyPlanIDs() {
plan.CrossID = uuid.FromStrings(api.Spec.ID, separator, plan.Name)
}

if plan.ID == "" {
plan.ID = uuid.FromStrings(plan.CrossID, separator, plan.Name)
if id, ok := api.Status.Plans[plan.CrossID]; ok {
plan.ID = id
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions controllers/apim/apidefinition/internal/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func createOrUpdateV2(ctx context.Context, apiDefinition *v1alpha1.ApiDefinition
}

if spec.IsLocal {
retrieveMgmtPlanIds(spec, status)
return updateConfigMap(ctx, cp)
}

Expand Down Expand Up @@ -136,3 +137,14 @@ func createOrUpdateV4(ctx context.Context, apiDefinition *v1alpha1.ApiV4Definiti
}
return nil
}

// Retrieve the plan ids from the API CRD status.
func retrieveMgmtPlanIds(spec *v1alpha1.ApiDefinitionV2Spec, status *base.Status) {
plans := spec.Plans
planIds := status.Plans

for _, plan := range plans {
plan.ID = planIds[plan.CrossID]
plan.Api = &status.ID
}
}

0 comments on commit 41c257c

Please sign in to comment.