-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the /apis endpoint call with expand false flag. #2934
Conversation
f151590
to
cc42966
Compare
bce83b3
to
51bc34c
Compare
if xdsAPIList != nil { | ||
xds.UpdateEnforcerAPIList(env, xdsAPIList) | ||
} | ||
} | ||
return | ||
} | ||
// TODO: (VirajSalaka) Temporarily removed. |
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.
Let's remove this unused.
@@ -511,12 +510,13 @@ func MarshalAPIMetataAndReturnList(apiList *types.APIList, initialAPIUUIDListMap | |||
// DeleteAPIAndReturnList removes the API from internal maps and returns the marshalled API List. | |||
// If the apiUUID is not found in the internal map under the provided environment, then it would return a | |||
// nil value. Hence it is required to check if the return value is nil, prior to updating the XDS cache. | |||
func DeleteAPIAndReturnList(apiUUID, organizationUUID string, gatewayLabel string) *subscription.APIList { | |||
func DeleteAPIAndReturnList(apiUUID string, gatewayLabel string) *subscription.APIList { | |||
if _, ok := APIListMap[gatewayLabel]; !ok { | |||
logger.LoggerXds.Debugf("No API Metadata is available under gateway Environment : %s", gatewayLabel) | |||
return nil | |||
} | |||
delete(APIListMap[gatewayLabel], apiUUID) |
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.
Check for apiUUID and return nil if it is not found.
@@ -511,12 +510,13 @@ func MarshalAPIMetataAndReturnList(apiList *types.APIList, initialAPIUUIDListMap | |||
// DeleteAPIAndReturnList removes the API from internal maps and returns the marshalled API List. | |||
// If the apiUUID is not found in the internal map under the provided environment, then it would return a | |||
// nil value. Hence it is required to check if the return value is nil, prior to updating the XDS cache. | |||
func DeleteAPIAndReturnList(apiUUID, organizationUUID string, gatewayLabel string) *subscription.APIList { |
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.
Check if we can unify the APIList and APIs
// But if the API is a default version, those APIs needs to be kept. But with the lifecycle state != BLOCKED. | ||
if status != blockedStatus && !apiEntry.IsDefaultVersion { | ||
return DeleteAPIAndReturnList(apiUUID, gatewayLabel) | ||
} |
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.
Comment out the possibilities the code could reach this far
APIListMap[gatewayLabel][apiUUID] = &subscription.APIs{ | ||
Uuid: apiUUID, | ||
LcState: status, | ||
} |
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.
We can return the List straightaway.
logger.LoggerXds.Debugf("No API Metadata for API ID: %s is available under gateway Environment : %s", | ||
apiUUID, gatewayLabel) | ||
return nil | ||
if apiEntry, ok := APIListMap[gatewayLabel][apiUUID]; !ok { |
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.
See the possiblities of improving the readability of the code.
@@ -0,0 +1,107 @@ | |||
/* |
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.
Move Admin API related DTOs to a single folder within models directory.
} | ||
} | ||
} | ||
// Set<String> set = apiMap.keySet() |
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.
Remove This as it simply returns null
9c9987e
to
c42b9c7
Compare
…made only during the startup
…-versioned, it will be no longer sent to the enforcer via APIListDiscoveryClient
… to the global adapter. It can only hold 20 node IDs.
c42b9c7
to
30b0d4e
Compare
40998f8
to
2e0dcdd
Compare
closing the PR as #2985 covers the same implementation but in more organized manner in terms of commits. |
Purpose
Since the /apis endpoint call was a costly operation (due to API Manager DB operations), this was removed from the choreo branch. As a result of that, switching an API to Blocked Lifecycle state did not function.
With this PR, the /apis endpoint call will be added again. Hence the fore-mentioned limitation will be removed.
In this case, the /apis endpoint will be called with the query parameter
expand=false
so that it would return default APIs and blocked APIs only. This call is made during the startup. Then onwards, the blocked APIs and default APIs are identified using message events.In addition, the unnecessary properties within the protobuf files are removed too.
Issues
Fixes #
Automation tests
Tested environments
Not Tested
Maintainers: Check before merge